-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Introduce IBindableFromHttpContext<TSelf> #41100
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
Conversation
@jmarolf after updating to Microsoft.CodeAnalysis.PublicApiAnalyzers 3.3.3 (from 3.3.0) we're getting a lot of new errors for existing APIs. Is this expected for a patch-level update? |
29ddebf
to
77bc86e
Compare
whoops responded to you privately but should have just done so here. The change you are seeing was originally made in this PR six years ago: dotnet/roslyn-analyzers#984. At the time we considered this a bugfix on the grounds of "There are public APIs that we are not tracking that we need to track". We have taken a similar approach with the SDK analyzers in that bugfix releases are allowed to fail the build if the diagnostic should have always been reported. |
We're also seeing other issues:
-~Microsoft.AspNetCore.Http.Features.FeatureReference<> (forwarded, contained in Microsoft.Extensions.Features)
-~Microsoft.AspNetCore.Http.Features.FeatureReferences<> (forwarded, contained in Microsoft.Extensions.Features)
+Microsoft.AspNetCore.Http.Features.FeatureReference<T> (forwarded, contained in Microsoft.Extensions.Features)
+Microsoft.AspNetCore.Http.Features.FeatureReference<T>.Fetch(Microsoft.AspNetCore.Http.Features.IFeatureCollection! features) -> T? (forwarded, contained in Microsoft.Extensions.Features)
+Microsoft.AspNetCore.Http.Features.FeatureReference<T>.Update(Microsoft.AspNetCore.Http.Features.IFeatureCollection! features, T feature) -> T (forwarded, contained in Microsoft.Extensions.Features)
+static readonly Microsoft.AspNetCore.Http.Features.FeatureReference<T>.Default -> Microsoft.AspNetCore.Http.Features.FeatureReference<T> (forwarded, contained in Microsoft.Extensions.Features)
+Microsoft.AspNetCore.Http.Features.FeatureReference<T>.FeatureReference() -> void (forwarded, contained in Microsoft.Extensions.Features)
+Microsoft.AspNetCore.Http.Features.FeatureReferences<TCache> (forwarded, contained in Microsoft.Extensions.Features)
+Microsoft.AspNetCore.Http.Features.FeatureReferences<TCache>.Cache -> TCache? (forwarded, contained in Microsoft.Extensions.Features)
+Microsoft.AspNetCore.Http.Features.FeatureReferences<TCache>.Collection.get -> Microsoft.AspNetCore.Http.Features.IFeatureCollection! (forwarded, contained in Microsoft.Extensions.Features)
+Microsoft.AspNetCore.Http.Features.FeatureReferences<TCache>.FeatureReferences(Microsoft.AspNetCore.Http.Features.IFeatureCollection! collection) -> void (forwarded, contained in Microsoft.Extensions.Features)
+Microsoft.AspNetCore.Http.Features.FeatureReferences<TCache>.Fetch<TFeature, TState>(ref TFeature? cached, TState state, System.Func<TState, TFeature?>! factory) -> TFeature? (forwarded, contained in Microsoft.Extensions.Features)
+Microsoft.AspNetCore.Http.Features.FeatureReferences<TCache>.Fetch<TFeature>(ref TFeature? cached, System.Func<Microsoft.AspNetCore.Http.Features.IFeatureCollection!, TFeature?>! factory) -> TFeature? (forwarded, contained in Microsoft.Extensions.Features)
+Microsoft.AspNetCore.Http.Features.FeatureReferences<TCache>.Initalize(Microsoft.AspNetCore.Http.Features.IFeatureCollection! collection) -> void (forwarded, contained in Microsoft.Extensions.Features)
+Microsoft.AspNetCore.Http.Features.FeatureReferences<TCache>.Initalize(Microsoft.AspNetCore.Http.Features.IFeatureCollection! collection, int revision) -> void (forwarded, contained in Microsoft.Extensions.Features)
+Microsoft.AspNetCore.Http.Features.FeatureReferences<TCache>.FeatureReferences() -> void (forwarded, contained in Microsoft.Extensions.Features)
+Microsoft.AspNetCore.Http.Features.FeatureReferences<TCache>.Revision.get -> int (forwarded, contained in Microsoft.Extensions.Features)
|
I'm also confused by this. We were at Microsoft.CodeAnalysis.PublicApiAnalyzers v3.3.0 before the small bump in this PR to v3.3.3. The dotnet/roslyn-analyzers#984 changes should have been part of every public release of that package (because those releases started in 2019). What led to us hitting the new behaviours at this time❔ |
More generally, can we back up to v3.3.1 or v3.3.2 and get the fix that avoids NREs when parsing the |
Or we could just accept the current changes needed and file issues for future improvements: #41115 |
I tried that and it seems unfortunately only v3.3.3 fixes the stack overflow 😞 |
Except that seems to throw away our intent of keeping the PublicAPI.Shipped.txt files aligned w/ what we shipped in .NET 6.0.0 (modulo nullability) e.g. the additions in src/Http/Http.Features/src/PublicAPI.Shipped.txt. It also leaves us using an analyzer that doesn't seem to grok |
Oh, bad example. That's the |
What additions? New APIs are still going to be in unshipped. |
That file contains a bunch of |
But my more important point was that |
The code in this PR is ready for review, but is still blocked from merging pending #41115 |
Blocked by #41115 |
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.
LGTM. I hope resolving the merge conflict and build issues won't be too much more effort.
@DamianEdwards we just merged #41115 🎉 Resolve conflicts (Many thanks to @BrennanConroy for his perseverance.) |
src/Http/Http.Extensions/test/ParameterBindingMethodCacheTests.cs
Outdated
Show resolved
Hide resolved
@@ -1188,6 +1242,28 @@ public static void BindAsync(HttpContext context) | |||
=> throw new NotImplementedException(); | |||
} | |||
|
|||
private class BindAsyncFromImplicitStaticAbstractInterface : IBindableFromHttpContext<BindAsyncFromImplicitStaticAbstractInterface> |
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.
Add a test that has both IBindableFromHttpContext
and an implemented BindAsync method (without Parameter) to see if it chooses the IBindableFromHttpContext
.
Co-authored-by: Stephen Halter <[email protected]>
dbb8138
to
3e86f30
Compare
src/Http/Http.Extensions/test/ParameterBindingMethodCacheTests.cs
Outdated
Show resolved
Hide resolved
🥳 🎉 🎈 and so on❕ |
* Added IBindableFromHttpContext<TSelf> interface * Discover BindAsync via IBindableFromHttpContext interface * Added tests Co-authored-by: Stephen Halter <[email protected]>
Introduces the new
IBindableFromHttpContext<TSelf> where TSelf : IBindableFromHttpContext<TSelf>
interface that defines astatic abstract
BindAsync
method.Fixes #40927