Skip to content

Commit

Permalink
Merge pull request #341 from microsoft/fix/parse-node-cancellation
Browse files Browse the repository at this point in the history
fix: missing cancellation token
  • Loading branch information
baywet authored Aug 22, 2024
2 parents e1654ef + 8e4a03b commit 5155bd7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
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 @@ public abstract class ParseNodeProxyFactory : IAsyncParseNodeFactory
/// <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)
{
_concrete = concrete ?? throw new ArgumentNullException(nameof(concrete));
_onBefore = onBefore;
Expand Down Expand Up @@ -79,7 +79,7 @@ public async Task<IParseNode> GetRootParseNodeAsync(string contentType, Stream c
{
throw new Exception("IAsyncParseNodeFactory is required for async operations");
}
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);
}
}

0 comments on commit 5155bd7

Please sign in to comment.