SignalR.Strong icon indicating copy to clipboard operation
SignalR.Strong copied to clipboard

Add '#nullable enable' in generated code

Open webcoyote opened this issue 1 year ago • 1 comments

For C# nullable types, e.g. string?, this change aims to avoid this warning:

warning CS8669: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.

webcoyote avatar Jul 14 '22 20:07 webcoyote

Hi @webcoyote ! Thank you so much for this MR.

Have you had a chance to test this change?

I believe this should work without any side effects. I haven't updated this repo in a while because I actually ended up contributing a much improved version to .NET 7. https://devblogs.microsoft.com/dotnet/asp-net-core-updates-in-net-7-preview-1/#signalr-client-source-generator However I'm happy to merge and cut a new release with this change.

In the ASP.NET Core 'native' version, same directive worked without much trouble.

Also I'm curious if .NET 7 (when released) would work for your use case or if you still feel a third party library is better. Let me know!

mehmetakbulut avatar Jul 16 '22 15:07 mehmetakbulut

As this feature didn't make the RC/RTM (https://github.com/dotnet/aspnetcore/pull/42720) in .NET 7, could this PR be merged? If further testing is required I can assist.

pixsperdavid avatar Dec 01 '22 11:12 pixsperdavid