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

fix: missing cancellation token #341

Merged
merged 2 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.12.1] - 2024-08-21

### Changed

- Fixed a bug where the cancellation token would not be passed to the ParseNodeFactory.

## [1.12.0] - 2024-08-20

### Changed
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<!-- Common default project properties for ALL projects-->
<PropertyGroup>
<VersionPrefix>1.12.0</VersionPrefix>
<VersionPrefix>1.12.1</VersionPrefix>
<VersionSuffix></VersionSuffix>
<!-- This is overidden in test projects by setting to true-->
<IsTestProject>false</IsTestProject>
Expand Down
4 changes: 2 additions & 2 deletions src/abstractions/serialization/ParseNodeProxyFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/// <param name="concrete">The concrete factory to wrap.</param>
/// <param name="onBefore">The callback to invoke before the deserialization of any model object.</param>
/// <param name="onAfter">The callback to invoke after the deserialization of any model object.</param>
public ParseNodeProxyFactory(IParseNodeFactory concrete, Action<IParsable> onBefore, Action<IParsable> onAfter)
protected ParseNodeProxyFactory(IParseNodeFactory concrete, Action<IParsable> onBefore, Action<IParsable> onAfter)
calebkiage marked this conversation as resolved.
Show resolved Hide resolved
{
_concrete = concrete ?? throw new ArgumentNullException(nameof(concrete));
_onBefore = onBefore;
Expand All @@ -39,7 +39,7 @@
/// <param name="content">The stream to read the parse node from.</param>
/// <param name="contentType">The content type of the parse node.</param>
/// <returns>A parse node.</returns>
[Obsolete("Use GetRootParseNodeAsync instead")]

Check warning on line 42 in src/abstractions/serialization/ParseNodeProxyFactory.cs

View workflow job for this annotation

GitHub Actions / Build

Do not forget to remove this deprecated code someday. (https://rules.sonarsource.com/csharp/RSPEC-1133)

Check warning on line 42 in src/abstractions/serialization/ParseNodeProxyFactory.cs

View workflow job for this annotation

GitHub Actions / Build

Do not forget to remove this deprecated code someday. (https://rules.sonarsource.com/csharp/RSPEC-1133)

Check warning on line 42 in src/abstractions/serialization/ParseNodeProxyFactory.cs

View workflow job for this annotation

GitHub Actions / Build

Do not forget to remove this deprecated code someday. (https://rules.sonarsource.com/csharp/RSPEC-1133)

Check warning on line 42 in src/abstractions/serialization/ParseNodeProxyFactory.cs

View workflow job for this annotation

GitHub Actions / Build

Do not forget to remove this deprecated code someday. (https://rules.sonarsource.com/csharp/RSPEC-1133)

Check warning on line 42 in src/abstractions/serialization/ParseNodeProxyFactory.cs

View workflow job for this annotation

GitHub Actions / Build

Do not forget to remove this deprecated code someday. (https://rules.sonarsource.com/csharp/RSPEC-1133)
public IParseNode GetRootParseNode(string contentType, Stream content)
{
var node = _concrete.GetRootParseNode(contentType, content);
Expand Down Expand Up @@ -77,9 +77,9 @@
{
if(_concrete is not IAsyncParseNodeFactory asyncConcrete)
{
throw new Exception("IAsyncParseNodeFactory is required for async operations");

Check warning on line 80 in src/abstractions/serialization/ParseNodeProxyFactory.cs

View workflow job for this annotation

GitHub Actions / Build

'System.Exception' should not be thrown by user code. (https://rules.sonarsource.com/csharp/RSPEC-112)

Check warning on line 80 in src/abstractions/serialization/ParseNodeProxyFactory.cs

View workflow job for this annotation

GitHub Actions / Build

'System.Exception' should not be thrown by user code. (https://rules.sonarsource.com/csharp/RSPEC-112)

Check warning on line 80 in src/abstractions/serialization/ParseNodeProxyFactory.cs

View workflow job for this annotation

GitHub Actions / Build

'System.Exception' should not be thrown by user code. (https://rules.sonarsource.com/csharp/RSPEC-112)

Check warning on line 80 in src/abstractions/serialization/ParseNodeProxyFactory.cs

View workflow job for this annotation

GitHub Actions / Build

'System.Exception' should not be thrown by user code. (https://rules.sonarsource.com/csharp/RSPEC-112)

Check warning on line 80 in src/abstractions/serialization/ParseNodeProxyFactory.cs

View workflow job for this annotation

GitHub Actions / Build

'System.Exception' should not be thrown by user code. (https://rules.sonarsource.com/csharp/RSPEC-112)
}
var node = await asyncConcrete.GetRootParseNodeAsync(contentType, content).ConfigureAwait(false);
var node = await asyncConcrete.GetRootParseNodeAsync(contentType, content, cancellationToken).ConfigureAwait(false);
WireParseNode(node);
return node;
}
Expand Down
4 changes: 4 additions & 0 deletions src/serialization/form/FormParseNodeFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ public async Task<IParseNode> GetRootParseNodeAsync(string contentType, Stream c
throw new ArgumentNullException(nameof(content));

using var reader = new StreamReader(content);
#if NET7_0_OR_GREATER
var rawValue = await reader.ReadToEndAsync(cancellationToken).ConfigureAwait(false);
#else
var rawValue = await reader.ReadToEndAsync().ConfigureAwait(false);
#endif
return new FormParseNode(rawValue);
}
}
Loading