Skip to content

Commit 5155bd7

Browse files
authored
Merge pull request #341 from microsoft/fix/parse-node-cancellation
fix: missing cancellation token
2 parents e1654ef + 8e4a03b commit 5155bd7

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.12.1] - 2024-08-21
11+
12+
### Changed
13+
14+
- Fixed a bug where the cancellation token would not be passed to the ParseNodeFactory.
15+
1016
## [1.12.0] - 2024-08-20
1117

1218
### Changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22
<!-- Common default project properties for ALL projects-->
33
<PropertyGroup>
4-
<VersionPrefix>1.12.0</VersionPrefix>
4+
<VersionPrefix>1.12.1</VersionPrefix>
55
<VersionSuffix></VersionSuffix>
66
<!-- This is overidden in test projects by setting to true-->
77
<IsTestProject>false</IsTestProject>

src/abstractions/serialization/ParseNodeProxyFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public abstract class ParseNodeProxyFactory : IAsyncParseNodeFactory
2727
/// <param name="concrete">The concrete factory to wrap.</param>
2828
/// <param name="onBefore">The callback to invoke before the deserialization of any model object.</param>
2929
/// <param name="onAfter">The callback to invoke after the deserialization of any model object.</param>
30-
public ParseNodeProxyFactory(IParseNodeFactory concrete, Action<IParsable> onBefore, Action<IParsable> onAfter)
30+
protected ParseNodeProxyFactory(IParseNodeFactory concrete, Action<IParsable> onBefore, Action<IParsable> onAfter)
3131
{
3232
_concrete = concrete ?? throw new ArgumentNullException(nameof(concrete));
3333
_onBefore = onBefore;
@@ -79,7 +79,7 @@ public async Task<IParseNode> GetRootParseNodeAsync(string contentType, Stream c
7979
{
8080
throw new Exception("IAsyncParseNodeFactory is required for async operations");
8181
}
82-
var node = await asyncConcrete.GetRootParseNodeAsync(contentType, content).ConfigureAwait(false);
82+
var node = await asyncConcrete.GetRootParseNodeAsync(contentType, content, cancellationToken).ConfigureAwait(false);
8383
WireParseNode(node);
8484
return node;
8585
}

src/serialization/form/FormParseNodeFactory.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ public async Task<IParseNode> GetRootParseNodeAsync(string contentType, Stream c
3939
throw new ArgumentNullException(nameof(content));
4040

4141
using var reader = new StreamReader(content);
42+
#if NET7_0_OR_GREATER
43+
var rawValue = await reader.ReadToEndAsync(cancellationToken).ConfigureAwait(false);
44+
#else
4245
var rawValue = await reader.ReadToEndAsync().ConfigureAwait(false);
46+
#endif
4347
return new FormParseNode(rawValue);
4448
}
4549
}

0 commit comments

Comments
 (0)