Skip to content
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

RequestDelegateGenerator throws NullReferenceException in ASP.NET Core 8 preview 2 #47202

Closed
1 task done
martincostello opened this issue Mar 14, 2023 · 3 comments
Closed
1 task done
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved

Comments

@martincostello
Copy link
Member

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Building an existing .NET 7 solution with .NET 8 preview 2 fails with the following error:

CSC : error CS8785: Generator 'RequestDelegateGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'NullReferenceException' with message 'Object reference not set to an instance of an object.' [/home/runner/work/lambda-test-server/lambda-test-server/src/AwsLambdaTestServer/MartinCostello.Testing.AwsLambdaTestServer.csproj::TargetFramework=net8.0]

Expected Behavior

The solution compiles and tests pass.

Steps To Reproduce

  1. Clone the martincostello/lambda-test-server repository
  2. Checkout the repository at martincostello/lambda-test-server@e47cc13
  3. Run build.ps1

Exceptions (if any)

CSC : error CS8785: Generator 'RequestDelegateGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'NullReferenceException' with message 'Object reference not set to an instance of an object.' [/home/runner/work/lambda-test-server/lambda-test-server/src/AwsLambdaTestServer/MartinCostello.Testing.AwsLambdaTestServer.csproj::TargetFramework=net8.0]

.NET Version

8.0.100-preview.2.23157.25

Anything else?

No response

@danmoseley
Copy link
Member

Should we be including callstack in these warning messages for any exception that shouldn't occur from user error?

@captainsafia
Copy link
Member

Should we be including callstack in these warning messages for any exception that shouldn't occur from user error?

Unfortunately, we don't control the way these callstacks show up. The compiler does.

@martincostello The issue that you've described is a dupe of #47148 and should be resolved in the latest preview3 nightly.

By the way, the RequestDelegateGenerator is intended to be off by default in applications. However, the logic to turn it off by default lives in the Web SDK. I notice that you are referencing the ASP.NET runtime using a framework reference. Unfortunately, there is a known limitation with our current approach for turning it off that should be resolved in preview3. Check out this issue for more info.

For now, you can manually remove the generator from your compilation using this MSBuild target.

@captainsafia captainsafia added the ✔️ Resolution: Duplicate Resolved as a duplicate of another issue label Mar 14, 2023
@ghost ghost added the Status: Resolved label Mar 14, 2023
martincostello added a commit to martincostello/lambda-test-server that referenced this issue Mar 15, 2023
Add workaround for dotnet/aspnetcore#47202.
@ghost
Copy link

ghost commented Mar 15, 2023

This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes.

See our Issue Management Policies for more information.

@ghost ghost closed this as completed Mar 15, 2023
martincostello added a commit to martincostello/lambda-test-server that referenced this issue Apr 11, 2023
Add workaround for dotnet/aspnetcore#47202.
martincostello added a commit to martincostello/lambda-test-server that referenced this issue Apr 12, 2023
Add workaround for dotnet/aspnetcore#47202.
@ghost ghost locked as resolved and limited conversation to collaborators Apr 15, 2023
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Aug 25, 2023
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved
Projects
None yet
Development

No branches or pull requests

5 participants