✅ OneOf library code generation not working?
I'm trying to set up the https://github.com/mcintyre321/OneOf library. Wanted to try the class generator example, and installed that part as well as the base OneOf library
Running into an issue when trying to run the example code they listed https://github.com/mcintyre321/OneOf?tab=readme-ov-file#oneofbase-source-generation
the red squiggly is under
StringOrNumber
:
There is no argument given that corresponds to the required parameter 'input' of 'OneOfBase<string, int>.OneOfBase(OneOf<string, int>)'
new to source code generation related stuff and C#, help is appreciated, thank you!8 Replies
you probably just need to restart your IDE
$vsdrunk
* close VS
* remove the hidden folder
.vs
* remove all bin
and obj
folder next to each csproj (DO NOT TOUCH THE .git
FOLDER OR WHAT'S INSIDE)
* restart vsRemoving the
.vs
folder is probably enoughI'm on vscode so I don't have a
.vs
folder,
I removed the bin and obj folders and tried running the project but it seems like the generator itself is failing:
CSC : warning CS8785: Generator 'OneOfGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'ArgumentException' with message 'The hintName '<global namespace>_StringOrNumber.g.cs' contains an invalid character '<' at position 0. (Parameter 'hintName')'.
I also tried running it in rider and I'm also getting the same issuesIs
StringOrNumber
within a namespace?
Try putting it in one, seems like a bug in the SG.yeah this fixed it, thanks for the help!
I’d file a bug in the OneOf repo then.