❔ Roslyn compilation error (dynamic keyword)
Hello everyone,
I'm pretty new to C# and had to start using it due to my new job. In the project i'm working on we use quite a lot of autogenerated code that is compiled using roslyn. So I decided to look at it some more and try using it in a couple example projects. But I've encountered a problem compiling code in roslyn that uses dynamic objects.
The following code gives the compile error:
And the error message is:
7 Replies
That code compiles fine for me, you've got something else going on. What version of .NET are you targeting?
It compiles fine itself, but as soon as I try compile it CSharpCompilation it fails. But home atm, but as soon as I am I can send the compilation code.
I tried .NET 6, 7 and 8 with the same result.
Just created a new program to test it, same thing:
Jesus, seeing this thread I thought it's an issue with source generators... turns out it's an issue with compiling a string...?
Who-wee
sorry to disappoint you...
Nah, I'm not disappointed, it's more like... seeing someone drive a car with square wheels lol, my condolences that you have to work with a codebase like that
Yeah, it's not the nicest to work with, but at least it's paid well^^
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.