NullableAttribute Missing #4119
Replies: 5 comments 2 replies
-
Does adding nullable directive help?
|
Beta Was this translation helpful? Give feedback.
-
At the top of one of the Recipe scripts, I added Just tried again with |
Beta Was this translation helpful? Give feedback.
-
Additional information: I've stripped the whole project down to bare bones: all code commented out in the Cake Recipe scripts, the Cake Addin code, and the I then started un-commenting one piece at a time, to see what actually causes the exeptions. I can see that Cake is loading the Recipes/Addin package properly (even when empty). I've added some small code back into the Recipe scripts and the Addin assembly, and they still work fine. So far so good.
I then un-commented a simple Alias method in the Addin assembly, and Cake still found it, compiled, & ran. But as soon as I changed the Alias signature to include nullable reference types ( Is there anything special I have to do to use nullable reference types in the Alias signature inside my Addin assembly? |
Beta Was this translation helpful? Give feedback.
-
Looking through the Cake source code, it would seem the Roslyn compiler is responsible for finding/generating that attribute. (At least, in my limited knowledge, I can't see where Cake is to blame here.) I started a new discussion in the Roslyn repo to see if they might have any answers, because this is a real blocker for me. |
Beta Was this translation helpful? Give feedback.
-
Alright, I've stripped my project down to the bare minimum that still reproduces the errors: Cake.zip It's a repo that includes a Cake Addin project. The goal is to compile the Cake Addin first (when The problem comes once we get inside the Cake Addin code. It would appear that I can call a Cake Alias method that uses nullable reference types, no problem. BUT--if that Alias method calls another Alias method that also uses nullable reference types, then the Cake/Roslyn compiler bombs: |
Beta Was this translation helpful? Give feedback.
-
I'm using Cake.Tool 3.0.0 to build my .NET 6/7 solution. I'm pulling in a few NuGet dependencies as Addins, including one combination Addin/Recipe package built in-house at my company. All are up-to-date versions.
However I'm having trouble debugging a recent error that popped up in the Cake scripts. Running Cake in
Diagnostic
mode, I can see:But when it gets to the step where Cake compiles the build script, it throws these two errors:
What I can infer is that the
NullableAttribute
class that is supposed to be generated by the compiler, is not being generated. I can inspect each of the NuGet Addins and see that attribute exists in each of them, but for some reason Cake is not finding it -- and I really don't know how to go about debugging this further.Is there a way to view/debug the actual Roslyn script created by Cake?
Beta Was this translation helpful? Give feedback.
All reactions