tunnelvisionlabs / ReferenceAssemblyAnnotator

IL weaver to add nullability annotations to .NET reference assemblies
MIT License
72 stars 8 forks source link

MSB4044: The "AnnotatorBuildTask" task was not given a value for the required parameter "DisabledWarnings". #55

Closed jnm2 closed 4 years ago

jnm2 commented 4 years ago

This is on old-style csproj (stuck on old csproj only till 16.4 releases). Regardless, seems like a simple fix. Maybe we don't make it a required parameter after all? I didn't understand why we added it originally.

https://github.com/tunnelvisionlabs/ReferenceAssemblyAnnotator/blob/ea0490148d3c8b158b68ede5e81f1ccf012175f5/TunnelVisionLabs.ReferenceAssemblyAnnotator/AnnotatorBuildTask.cs#L53-L58

sharwell commented 4 years ago

The parameter is required to ensure that calls to the task include all expected parameters. If data is not getting passed, we end up with other bugs that are even less informative. The solution here is to make sure that the call has the parameter set correctly.

jnm2 commented 4 years ago

What can we do so that it no longer forces me to declare a dummy \ value in the consuming csproj?

sharwell commented 4 years ago

😕 Is it treating an empty value the same as not passing anything at all?

jnm2 commented 4 years ago

I thought that was how it worked, let me double-check.

jnm2 commented 4 years ago

Can confirm, adding <NoWarn></NoWarn> to the csproj does not fix the MSB4044 error. (Even if it did, I'd ask to not have to do that.)

My workaround for now is <NoWarn>_</NoWarn>.

sharwell commented 4 years ago

So we forgot to set AllowEmptyStrings?

jnm2 commented 4 years ago

I didn't know about that property, thought RequiredAttribute was coming from an MSBuild namespace. Sounds like it would work.

sharwell commented 4 years ago

Yep, seems the MSBuild version of this attribute does not have the same property. Checking into alternatives...

sharwell commented 4 years ago

@jnm2 This property should not be marked as required, since MSBuild does not distinguish between empty and missing. The same applies for all string properties for which empty is a valid input.