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

Enabling C# 8 nullable reference types throws exception on interface messages #5488

Merged
merged 7 commits into from Nov 15, 2019

Conversation

@andreasohlund
Copy link
Member

andreasohlund commented Nov 12, 2019

Symptoms

Message contracts defined using interfaces will cause endpoints to throwArgumentNullException on startup if C# 8 nullable reference types are enabled.

Who's affected

All users defining messages using interfaces with nullable reference types turn on.

Root cause

Our custom message mapper was not prepared for the attributes emitted by the compiler.

Related to

#5480
#5481

@andreasohlund

This comment has been minimized.

Copy link
Member Author

andreasohlund commented Nov 13, 2019

@SimonCropp just to confirm, the way to workaround this is to disable the checks for the message contracts that have the issues? (or does this affect all message contracts that are interfaces)

@SimonCropp

This comment has been minimized.

Copy link
Contributor

SimonCropp commented Nov 13, 2019

the way to workaround this is to disable the checks for the message contracts that have the issues

not sure what you mean? what checks would you disable?

@andreasohlund

This comment has been minimized.

Copy link
Member Author

andreasohlund commented Nov 13, 2019

I had a faint memory that you could exclude certain files/types from being included but I can't find anything in https://docs.microsoft.com/en-us/dotnet/csharp/tutorials/nullable-reference-types

So there is no workaround that can get you unstuck other than turning the nullable ref types off for the csproj that contains the message contracts?

@andreasohlund

This comment has been minimized.

Copy link
Member Author

andreasohlund commented Nov 13, 2019

@danielmarbach you had some ideas for a workaround with manually implemented proxies?

@SimonCropp

This comment has been minimized.

Copy link
Contributor

SimonCropp commented Nov 13, 2019

why not fix the underlying issue, that the proxy generation makes assumptions about the nullability of parameter names?

is my others pr a viable start to that?

@andreasohlund

This comment has been minimized.

Copy link
Member Author

andreasohlund commented Nov 13, 2019

@andreasohlund andreasohlund changed the title Support C# nullable reference types for interface messages Support C# 8 nullable reference types for interface messages Nov 14, 2019
@andreasohlund andreasohlund marked this pull request as ready for review Nov 14, 2019
@andreasohlund andreasohlund requested a review from bording Nov 14, 2019
SimonCropp and others added 3 commits Nov 8, 2019
@bording bording force-pushed the nullable-interface-messages branch from f04d3ec to 441f684 Nov 14, 2019
bording added 4 commits Nov 14, 2019
@andreasohlund andreasohlund merged commit 16a4218 into master Nov 15, 2019
7 checks passed
7 checks passed
Compile Finished TeamCity Build NServiceBus / Core / 1. Compile : Running
Details
Inspections Finished TeamCity Build NServiceBus / Core / 2. Inspections : Running
Details
Test .NET Core on Linux Finished TeamCity Build NServiceBus / Core / 3.3 Test (.NET Core on Linux) : Tests passed: 1209, ignored: 46
Details
Test .NET Core on Windows Finished TeamCity Build NServiceBus / Core / 3.2 Test (.NET Core on Windows) : Tests passed: 1209, ignored: 46
Details
Test .NET Framework on Windows Finished TeamCity Build NServiceBus / Core / 3.1 Test (Framework on Windows) : Tests passed: 1467, ignored: 101
Details
WIP Ready for review
Details
license/cla Contributor License Agreement is signed.
Details
@andreasohlund andreasohlund deleted the nullable-interface-messages branch Nov 15, 2019
@andreasohlund andreasohlund added the Bug label Jan 21, 2020
@andreasohlund andreasohlund added this to the 7.2.1 milestone Jan 21, 2020
@andreasohlund andreasohlund changed the title Support C# 8 nullable reference types for interface messages C# 8 nullable reference types throws exception on interface messages Jan 21, 2020
@andreasohlund andreasohlund mentioned this pull request Jan 28, 2020
@andreasohlund andreasohlund changed the title C# 8 nullable reference types throws exception on interface messages Enabling C# 8 nullable reference types throws exception on interface messages Jan 29, 2020
@andreasohlund andreasohlund modified the milestones: 7.2.1, 7.2.2 Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.