-
Notifications
You must be signed in to change notification settings - Fork 434
Model for async StackFrames. #3285
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
base: dev
Are you sure you want to change the base?
Conversation
32b1680 to
6b98d1c
Compare
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
6b98d1c to
07fc02f
Compare
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
...soft.IdentityModel.Tokens/Experimental/Validation/Results/Details/IdentityModelStackFrame.cs
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Tokens/Experimental/Validation/Results/Details/ValidationError.cs
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Tokens/Experimental/Validation/Results/Details/ValidationError.cs
Outdated
Show resolved
Hide resolved
| if (!ValidationError.TryGetStackFrame(out stackFrame)) | ||
| stackFrame = ValidationError.GetAsyncStackFrame(new StackFrame(0, true)); | ||
|
|
||
| return result.Error!.AddStackFrame(stackFrame ?? new StackFrame(0, true)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stackFrame is never null in these cases - either TryGetStackFrame or GetAsyncStackFrame returns one frame.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pmaytak you are correct, i understand we can mark the class that if Succeeded is false then Error cannot be null.
Do you know how to do that?
src/Microsoft.IdentityModel.Tokens/Experimental/Validation/Results/Details/ValidationError.cs
Show resolved
Hide resolved
test/Microsoft.IdentityModel.Tokens.Tests/Validation/IssuerValidationResultTests.cs
Outdated
Show resolved
Hide resolved
test/Microsoft.IdentityModel.Tokens.Tests/Validation/IssuerValidationResultTests.cs
Outdated
Show resolved
Hide resolved
6d51e80 to
d392b84
Compare
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
d007aac to
48399d6
Compare
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
48399d6 to
eedc9b5
Compare
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
997f90b to
6d6e62d
Compare
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
8fcd048 to
e96f2b8
Compare
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
e96f2b8 to
da6eac3
Compare
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
144c59b to
af557be
Compare
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
6b6d6d3 to
8dee83c
Compare
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
8dee83c to
694c3c3
Compare
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
src/Microsoft.IdentityModel.JsonWebTokens/Experimental/JsonWebTokenHandler.ValidateSignature.cs
Show resolved
Hide resolved
src/Microsoft.IdentityModel.JsonWebTokens/Experimental/JsonWebTokenHandler.ValidateSignature.cs
Outdated
Show resolved
Hide resolved
| if (!ValidationError.TryGetStackFrame(key, out stackFrame)) | ||
| stackFrame = ValidationError.GetAsyncStackFrame(key, new StackFrame(0, true)); | ||
|
|
||
| return readResult.Error!.AddStackFrame(stackFrame!); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If !Succeeded, Error is guaranteed to be not null, yes?
Do we need to add a NotNull annotation ValidationResult similar to what OperationResult had? Or adjust null analysis settings for net FW?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@keegan-caruso I will try NotNull annotation first.
...osoft.IdentityModel.JsonWebTokens/Experimental/JsonWebTokenHandler.ValidateToken.Internal.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Tokens.Saml/Saml/Experimental/SamlSecurityTokenHandler.ReadToken.cs
Show resolved
Hide resolved
| { | ||
| using (var reader = XmlDictionaryReader.CreateTextReader(Encoding.UTF8.GetBytes(token), XmlDictionaryReaderQuotas.Max)) | ||
| { | ||
| return ReadSamlToken(reader); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
src/Microsoft.IdentityModel.Tokens.Saml/Saml/Experimental/SamlTokenUtilities.Experimental.cs
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Tokens.Saml/Saml/Experimental/SamlTokenUtilities.Experimental.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Tokens.Saml/Saml/Experimental/SamlTokenUtilities.Experimental.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Tokens.Saml/Saml/Experimental/SamlTokenUtilities.Experimental.cs
Show resolved
Hide resolved
...icrosoft.IdentityModel.Tokens.Saml/Saml2/Experimental/Saml2SecurityTokenHandler.ReadToken.cs
Show resolved
Hide resolved
| return ValidationError.NullParameter( | ||
| nameof(token), | ||
| ValidationError.GetCurrentStackFrame()); | ||
| stackFrame!); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can't be null, do we need the suppression?
...soft.IdentityModel.Tokens/Experimental/Validation/Results/Details/IdentityModelStackFrame.cs
Outdated
Show resolved
Hide resolved
...soft.IdentityModel.Tokens/Experimental/Validation/Results/Details/IdentityModelStackFrame.cs
Outdated
Show resolved
Hide resolved
...soft.IdentityModel.Tokens/Experimental/Validation/Results/Details/IdentityModelStackFrame.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Tokens/Experimental/Validation/Results/Details/ValidationError.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Tokens/Experimental/Validation/Results/Details/ValidationError.cs
Outdated
Show resolved
Hide resolved
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
Address PR comments
f6b4b7c to
8ea735e
Compare
SummarySummary
CoverageMicrosoft.IdentityModel.JsonWebTokens - 80.3%
|
This is a follow up to the draft PR for obtaining StackFrames in async and lamda call graphs.
This model uses additional code in async methods, throughout the entire method, even though it is reported that it is needed only after the await. This is just for consistency. Methods that are not in an async method use the original model.
The idea is to generate a 'key' that maps to the StackFrame we want, look for the StackFrame, if found use it, otherwise create a StackFrame and cache it.
We could have assigned 'guids' instead of composing keys and maintained some type of searchable organization, but that seemed like too much work with little value.
This PR also: