Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ramya/merge dotnet beta #3004

Merged
merged 4 commits into from
Oct 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -15,3 +15,6 @@ dotnet_style_qualification_for_field = true

[CHANGELOG.md]
trim_trailing_whitespace = false
[src/Stripe.net/**/*.cs]

dotnet_diagnostic.CA2007.severity = error
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 46.2.0 - 2024-10-09
* [#3002](https://github.com/stripe/stripe-dotnet/pull/3002) Add ConfigureAwait calls to async calls that are awaited
* Fixes issue [#2998](https://github.com/stripe/stripe-dotnet/issues/2998) that was introduced in v46

## 46.2.0-beta.3 - 2024-10-08
* [#2975](https://github.com/stripe/stripe-dotnet/pull/2975) Update generated code for beta
* Add support for `SubmitCard` test helper method on resource `Issuing.Card`
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ update-version:
@perl -pi -e 's|<Version>[.\-\d\w]+</Version>|<Version>$(VERSION)</Version>|' src/Stripe.net/Stripe.net.csproj

codegen-format:
dotnet format src/Stripe.net/Stripe.net.csproj --severity warn
TargetFramework=net5.0 dotnet format src/Stripe.net/Stripe.net.csproj --severity warn

ci-test:
dotnet test --no-build src/StripeTests/StripeTests.csproj -c Release
6 changes: 3 additions & 3 deletions src/Stripe.net/Infrastructure/Public/StripeClient.cs
Original file line number Diff line number Diff line change
@@ -151,7 +151,7 @@ public async Task<T> RequestAsync<T>(
CancellationToken cancellationToken = default)
where T : IStripeEntity
{
return await this.Requestor.RequestAsync<T>(BaseAddress.Api, method, path, options, requestOptions, cancellationToken);
return await this.Requestor.RequestAsync<T>(BaseAddress.Api, method, path, options, requestOptions, cancellationToken).ConfigureAwait(false);
}

/// <inheritdoc/>
@@ -162,7 +162,7 @@ public async Task<Stream> RequestStreamingAsync(
RequestOptions requestOptions,
CancellationToken cancellationToken = default)
{
return await this.Requestor.RequestStreamingAsync(BaseAddress.Api, method, path, options, requestOptions, cancellationToken);
return await this.Requestor.RequestStreamingAsync(BaseAddress.Api, method, path, options, requestOptions, cancellationToken).ConfigureAwait(false);
}

/// <summary>Sends a request to Stripe's API as a synchronous operation.</summary>
@@ -196,7 +196,7 @@ public async Task<StripeResponse> RawRequestAsync(
RawRequestOptions requestOptions = null,
CancellationToken cancellationToken = default)
{
return await this.Requestor.RawRequestAsync(method, path, content, requestOptions, cancellationToken);
return await this.Requestor.RawRequestAsync(method, path, content, requestOptions, cancellationToken).ConfigureAwait(false);
}

/// <summary>
12 changes: 6 additions & 6 deletions src/Stripe.net/Services/_base/Service.cs
Original file line number Diff line number Diff line change
@@ -281,7 +281,7 @@ internal async IAsyncEnumerable<T> V2ListRequestAutoPagingAsync<T>(
url,
options,
requestOptions,
cancellationToken);
cancellationToken).ConfigureAwait(false);

while (true)
{
@@ -315,7 +315,7 @@ internal async IAsyncEnumerable<T> V2ListRequestAutoPagingAsync<T>(
page.NextPageUrl,
new BaseOptions(),
requestOptions,
cancellationToken);
cancellationToken).ConfigureAwait(false);
}
}

@@ -358,7 +358,7 @@ internal async IAsyncEnumerable<T> V1ListRequestAutoPagingAsync<T>(
url,
options,
requestOptions,
cancellationToken);
cancellationToken).ConfigureAwait(false);

options = options ?? new ListOptions();
bool iterateBackward = false;
@@ -417,7 +417,7 @@ internal async IAsyncEnumerable<T> V1ListRequestAutoPagingAsync<T>(
url,
options,
requestOptions,
cancellationToken);
cancellationToken).ConfigureAwait(false);
}
}

@@ -498,7 +498,7 @@ internal async IAsyncEnumerable<T> SearchRequestAutoPagingAsync<T>(
url,
options,
requestOptions,
cancellationToken);
cancellationToken).ConfigureAwait(false);

options = options ?? new SearchOptions();

@@ -532,7 +532,7 @@ internal async IAsyncEnumerable<T> SearchRequestAutoPagingAsync<T>(
url,
options,
requestOptions,
cancellationToken);
cancellationToken).ConfigureAwait(false);
}
}
}

Unchanged files with check annotations Beta

using Stripe.V2.Billing;
public class NewExample
{

Check warning on line 10 in src/Examples/NewExample.cs

GitHub Actions / Build and test

Check warning on line 10 in src/Examples/NewExample.cs

GitHub Actions / Build and test

Check warning on line 10 in src/Examples/NewExample.cs

GitHub Actions / Build and test

Check warning on line 10 in src/Examples/NewExample.cs

GitHub Actions / Build and test

public static async Task Run()

Check warning on line 12 in src/Examples/NewExample.cs

GitHub Actions / Build and test

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 12 in src/Examples/NewExample.cs

GitHub Actions / Build and test

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 12 in src/Examples/NewExample.cs

GitHub Actions / Build and test

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 12 in src/Examples/NewExample.cs

GitHub Actions / Build and test

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
var apiKey = "{{API_KEY}}";

Check warning on line 14 in src/Examples/NewExample.cs

GitHub Actions / Build and test

The variable 'apiKey' is assigned but its value is never used

Check warning on line 14 in src/Examples/NewExample.cs

GitHub Actions / Build and test

The variable 'apiKey' is assigned but its value is never used

Check warning on line 14 in src/Examples/NewExample.cs

GitHub Actions / Build and test

The variable 'apiKey' is assigned but its value is never used

Check warning on line 14 in src/Examples/NewExample.cs

GitHub Actions / Build and test

The variable 'apiKey' is assigned but its value is never used
try
{
{
}
public static async Task Main(string[] args)

Check warning on line 12 in src/Examples/Program.cs

GitHub Actions / Build and test

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 12 in src/Examples/Program.cs

GitHub Actions / Build and test

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 12 in src/Examples/Program.cs

GitHub Actions / Build and test

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 12 in src/Examples/Program.cs

GitHub Actions / Build and test

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
// To create an example, clone NewExample.cs, implement the example
// copy this line and replace the class name with your new class.
private readonly StripeClient _client;
private readonly string _webhookSecret;
public WebhookController()

Check warning on line 18 in src/Examples/V2/StripeWebhookHandler.cs

GitHub Actions / Build and test

Non-nullable field '_webhookSecret' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.

Check warning on line 18 in src/Examples/V2/StripeWebhookHandler.cs

GitHub Actions / Build and test

Non-nullable field '_webhookSecret' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
{
var apiKey = Environment.GetEnvironmentVariable("STRIPE_API_KEY");
_client = new StripeClient(apiKey);
_webhookSecret = Environment.GetEnvironmentVariable("WEBHOOK_SECRET");

Check warning on line 23 in src/Examples/V2/StripeWebhookHandler.cs

GitHub Actions / Build and test

Possible null reference assignment.

Check warning on line 23 in src/Examples/V2/StripeWebhookHandler.cs

GitHub Actions / Build and test

Possible null reference assignment.
}
[HttpPost]