Source Generator support for WPF project blocked?
See original GitHub issueVersion Used: dotnet 5 preview 8, visual studio 16.8 preview 2
Steps to Reproduce: Create fresh WPF project from VS modify project like this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<LangVersion>preview</LangVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\SourceGenerators\SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>
</Project>
Expected Behavior: The source generator referenced works for me in a console dotnet core app. I would expect this to work in a WPF project too.
Actual Behavior: In a freshly created WPF (dotnet core) project from the VS-template, however the generator does not seem to run.
Is this intended behavior?
As the generator is not used at all, I have not included it here. It is a slight variation of the HelloWorld sample.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:12
- Comments:20 (8 by maintainers)
Top Results From Across the Web
Source Generator not functioning with XAML files in .NET 6
This seems to be a regression bug with the current release of .NET SDK 6.0.302, and the fix is either a slight change...
Read more >Source Generators an Exercise in futility - Dan Siegel
Forms projects stable, I was immediately blocked. While the generators did run for netstandard2.0 and Xamarin.iOS and MonoAndroid targets, no ...
Read more >Improved Source Generators and Code Fixers Arrive in . ...
Note: there is a known issue with source generators in older versions of Roslyn that might cause IntelliSense to sometimes not work correctly ......
Read more >Why is no-one using Roslyn token-based code generation ...
I'm planning to rewrite all of our company's old T4-based codegen tools into Source Generators. I've been looking at how other Source ......
Read more >Even More MVVM Source Generator Awesomeness for .NET ...
Regardless if you are developing a .NET MAUI, WPF, WinUI, Uno, or Avalonia app, if you are using MVVM then you need to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Intent is to fix the behavior, not document it.
Thanks for pointing this out, @Zalutskii. Existing source generator and PackageReference issues have not been linked to the source generator change: #3846. Apologies.
This was made ‘opt-in’ to reduce the possibility of breaking compilation of existing WPF applications, but will eventually be turned on by default in .NET 6.0.