- 
                Notifications
    
You must be signed in to change notification settings  - Fork 10.5k
 
Validate scopes in OpenApiDocumentProvider tests and fix scope #58307
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
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.
Was this customer reported?
          
 Do I count as a customer? 😆 I was getting an exception in dotnet/eshop that I showed @captainsafia and she knew what the problem was.  | 
    
| 
           /backport to release/9.0  | 
    
| 
           Started backporting to release/9.0: https://github.com/dotnet/aspnetcore/actions/runs/11258408430  | 
    
| 
           I am experiencing crashes when using OpenApi. The code responsible for the crash is in  
 and should have been backported to 9.0 if I interpret this pull request correctly. However, in the NuGet package version 9.0.0 available online, the fix is missing!? Here is a screenshot of what I am seeing:  | 
    
| 
           Based on #58320 (comment), the fix wasn't actually backported as it was thought to be practically impossible. If you're seeing it in .NET 9.0.0, then maybe not.  | 
    
| 
           So I will review my code and try to understand what I am doing, which triggers this impossible situation.  | 
    
* Validate scopes in OpenApiDocumentProvider tests and fix scope * Use IOptionsMonitor to resolve OpenApiOptions
* Validate scopes in OpenApiDocumentProvider tests and fix scope * Use IOptionsMonitor to resolve OpenApiOptions

This PR resolves an issue where an
IOptionsSnapshot<>instance was incorrectly resolved from the root provider. It also updates the tests forOpenApiDocumentProviderto validate scopes so we can catch this issue in tests.