Closed woz6 closed 1 year ago
Misunderstood what I was looking at. Seems to be working. Sorry for any time wasted.
This seems to be an issue.
I have the same exact problem using version 8.1.0.
Version 8.1.0 gives me the "Unsupported C# language version" message.
Then, as soon as I add a new property inside a class that makes use of the mvvm attributes, the source generator seems to fail as intellisense underlines some existing observable properties as missing.
Version 8.0.0 works fine though : no error message at all under the source generator node and the source generators don't fail when I add code in classes.
Would you be able to share a minimal repro?
These are work related repos and not shareable.
I've created a new WinUI3 project from scratch and added a few observable objects to make use of the attributes.
I've imported the 8.0.1 version.
I still get the error messages :
The difference in this case is that, unlike my work related projects, the source generators doesn't randomly fail when I add properties throughout files. These work related projects have many other references and I'm not sure how one of them could make the source generators fail ?
Those are not error messages. That's just VS showing you that the generator can produce those diagnostics, as they're declared in the various analyzers. But those being there is not an actual warning at all 🙂
Ok, so, why these warnings are not showing up when using the 8.0.0 version ?
Also, that makes me really wonder why the source generators from the 8.0.0 doesn't fail while the 8.0.1 fails ...
Because in 8.0 all those diagnostics are produces by source generators, whereas in 8.1 we moved most of them to diagnostic analyzers (eg. see #433 and #581). The benefit is that diagnostic analyzers run out of process and asynchronously, so moving the diagnostics there help keep the IDE faster and more responsive, as the generators have less work to do (since they run synchronously as you type instead). As a side bonus, diagnostic analyzers explicitly declare all diagnostics they can potentially produce, so VS also shows all of them in that list, which also gives you the ability to optionally override the severity of each of them, if you want. So it's both faster and more configurable 🙂
"makes me really wonder why the source generators from the 8.0.0 doesn't fail while the 8.0.1 fails"
That might be related to #493, which is a separate issue.
Describe the bug
MVVM Toolkit 8.1.0 Code Generator fails with error Unsupported C# language version.
The error description says: The source generator features from the MVVM Toolkit require consuming projects to set the C# language version to at least C# 8.0. Make sure to add
<LangVersion>8.0</LangVersion>
(or above) to your .csproj file.I am running Visual Studio 2022, .NET 6.0 which should be using C# 10.0 by default. Adding
<LangVersion>8.0</LangVersion>
or<LangVersion>10.0</LangVersion>
to the csproj file did not resolve the error.I am trying to create a WinUI3 project, but have seen the same error reported on StackOverflow by someone who was creating a MAUI project.
This error does not appear when using MVVM Toolkit version 8.0.0
Regression
No response
Steps to reproduce
Expected behavior
There should be no C# language version error and Source Generators should generator code.
Screenshots
No response
IDE and version
VS 2022
IDE version
17.4.5
Nuget packages
Nuget package version(s)
8.1.0
Additional context
No response
Help us help you
No, just wanted to report this