Share via

Codedomprovider can't parse nullable ?

인용 김 41 Reputation points
2022-03-23T18:48:27.827+00:00

I tried to use codedomprovider compile some code

if it met nullable expression '?' , it says error is occurred

is it any way to parse nullable expression by codedomprovider ?

Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.


Answer accepted by question author

Bruce (SqlWork.com) 84,086 Reputation points
2022-03-23T20:17:15.82+00:00

you are probably not using the new roslyn compilers (c# 6+) required for this nullable support. did you add the nuget package?

you can tell, because your bin folder will have the roslyn compilers installed in it, the versions installed will control what c# language versions are supported.

note: before c# 6.0, the C# CodeDomProvider had the actual compiler code included in the dll, but if you want current roslyn compiler services, you need to add the roslyn compilers to the project.

Was this answer helpful?

1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.