Closed jnm2 closed 4 years ago
Would it be possible to optionally expose the attributes as public
? Can we perhaps take advantage of InternalsVisibleToAttribute
?
@chucker Public is dangerous. Rather than adding a new option that is a workaround, I think it would be better for WPF projects for now to opt out with <GenerateNullableAttributes>false</GenerateNullableAttributes>
and manually add a source file with public attributes. Especially since the WPF team is considering fixing this problem: https://github.com/dotnet/wpf/issues/810#issuecomment-640919316
I figured out how to fix it.
Usage of any nullability attributes in a WPF project result in this:
The error is reported as coming from a project named
YourProjectName_*_wpftmp.csproj
.The reason is that the NullableAttributes.cs file is not included in such a way that this WPF build task can see it:
https://github.com/dotnet/wpf/blob/master/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft.WinFx.targets#L401 https://github.com/dotnet/wpf/blob/master/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/GenerateTemporaryTargetAssembly.cs#L90
Repro: