-
-
Notifications
You must be signed in to change notification settings - Fork 730
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
Execution of Cake script fails if an addin defines an alias that uses nullable reference types in its signature #4197
Comments
I tried to track down the problem by debugging into Cake. The issue seems to be in ParameterEmitter. It writes out all of the method parameter's attributes into the generated Cake script, including This attribute is thus not visible to the generated Cake script, causing the compilation error. I could see multiple ways to fix this
I hope this information is helpful. |
Ideally the proxy methods generated would have the same signature as the original addin extension method with the exception of the context being supplied. The warnings could once be pragma disabled and enabled before and after method generation. |
Okay, so that would point to special-casing the "Nullable" attribute and emitting a |
…ases work with the Cake scripting runner The Cake scriptng runner is currently not compatible with aliases that contain nullablility annotations. To make the Asciidoctor aliases work in Cake scripting, disable nullability in the AsciidoctorAliases class. Add integration tests that run simple Cake builds that use the Asciidoctor aliases to verify the aliases can be loaded correctly (for both Cake scripting and Cake.Frosting). See-Also: cake-build/cake#4197
* fixes cake-build#4150 - Fix styling warnings * fixes cake-build#4197 - Fix parameter nullability error
* fixes cake-build#4150 - Fix styling warnings * fixes cake-build#4197 - Fix parameter nullability error
* fixes cake-build#4150 - Fix styling warnings * fixes cake-build#4197 - Fix parameter nullability error
* fixes cake-build#4150 - Fix styling warnings * fixes cake-build#4197 - Fix parameter nullability error
* fixes cake-build#4150 - Fix styling warnings * fixes cake-build#4197 - Fix parameter nullability error
GH4150/4197: Codegen styling & nullable param
🎉 This issue has been resolved in version v4.0.0 🎉 The release is available on: Your GitReleaseManager bot 📦🚀 |
Prerequisites
Cake runner
Cake .NET Tool
Cake version
3.1
Operating system
Windows
Operating system architecture
64-Bit
CI Server
No response
What are you seeing?
I created an alias with an parameter that is allowed to be
null
and is thus marked as nullable, e.g.When the assembly that contains the alias is used in a Cake script, compilation of the script fails with the following error(s)
What is expected?
I would expect the script to be executed successfully, even is nullable reference types do not seem to be enabled in the scripting runner.
Steps to Reproduce
I prepared a repo here: https://github.com/ap0llo/repro-cake-nullable-reference-types-in-alias
build.cake
file that loads "ExampleAddin" using the#reference
preprocessor directiveI added a little more detailed instructions on how to run the repo in the repository's README
Output log
The text was updated successfully, but these errors were encountered: