Skip to content

Conversation

@JamesNK
Copy link
Member

@JamesNK JamesNK commented Dec 12, 2020

Addresses #5680

Copy link
Member

@Tratcher Tratcher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diagnostics look fine. I'll let Justin review Rewrite 😁.

~Microsoft.AspNetCore.Rewrite.RewriteContext.Logger.set -> void
~Microsoft.AspNetCore.Rewrite.RewriteContext.StaticFileProvider.get -> Microsoft.Extensions.FileProviders.IFileProvider
~Microsoft.AspNetCore.Rewrite.RewriteContext.StaticFileProvider.set -> void
Microsoft.AspNetCore.Rewrite.RewriteContext.HttpContext.get -> Microsoft.AspNetCore.Http.HttpContext!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is ~ supposed to be removed here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. No ~ means it is annotated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, ~ means that the signature contains at least one reference type which is not known to be either nullable or non-nullable

@@ -1,48 +1 @@
#nullable enable
Microsoft.AspNetCore.Builder.DeveloperExceptionPageOptions.FileProvider.get -> Microsoft.Extensions.FileProviders.IFileProvider?
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this duplication in PublicAPI files was caused by dotnet/roslyn-analyzers#4584

@@ -1,18 +1,25 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 The encoding changes are concerning

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My changes are removing the BOMs which I assume is correct 🤷

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C# source files should have a byte order mark. It looks like the repository has an incorrectly-configured .editorconfig file which is causing these changes to appear.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

➡️ Filed #28697 to fix this

}

return new MatchResults { BackReferences = prevBackReferences, Success = condResult.Success };
return new MatchResults(condResult!.Success, prevBackReferences);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Consider proper argument validation instead of suppression. If conditions is empty when this method is called, a NullReferenceException will be thrown here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at the source and this method will only be called if there are conditions, which means there will be a condResult. I've added a Debug.Assert with message to make that explicit.

if (condResult.Success && trackAllCaptures && prevBackReferences != null)
{
prevBackReferences.Add(currentBackReferences);
prevBackReferences.Add(currentBackReferences!);
Copy link
Contributor

@sharwell sharwell Dec 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 If applicable, consider applying MemberNotNullWhen to condResult.Success, and changing this line to:

Suggested change
prevBackReferences.Add(currentBackReferences!);
prevBackReferences.Add(condResult.BackReferences);

@JamesNK JamesNK merged commit e79d740 into master Dec 17, 2020
@JamesNK JamesNK deleted the jamesnk/nullable-rewrite branch December 17, 2020 08:35
@amcasey amcasey added the area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares label Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants