Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A Source Generator should add code to the compilation of a WPF application when one of the app's XAML files is declaring an app-local namespace #49658

Closed
dev-mano opened this issue Nov 29, 2020 · 2 comments
Labels
Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead

Comments

@dev-mano
Copy link

Versions Used:

VS versions 16.8.2 and 16.9.0 Preview 1.0
Microsoft.CodeAnalysis.Analyzers version 3.3.1
Microsoft.CodeAnalysis.CSharp.Workspaces version 3.8.0

Steps to Reproduce:

  1. Create a new project using the 'WPF App (.NET)' template in VS
  2. Add a source generator to the project as described in the Source Generators Cookbook
  3. Manually add code to the app that depends on code generated by the source generator in order to compile correctly, e.g. by implementing an interface like INotifyPropertyChanged, as shown in the Source Generators Cookbook examples.
  4. Compile the project.

Expected Behavior:

The source generator adds code to the compilation and the build succeeds.

Actual Behavior:

The build emits error messages due to missing code that the source generator was supposed to generate, but didn't.
The build will succeed though if the following, not used 'local' namespace declaration is removed from app.xaml:
xmlns:local="clr-namespace:NameOfWpfApp"

The behavior is the same for these flavors of .NET used by the test app: .NET Core 3.1, .NET 5, .NET Framework 4.7.2.

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Nov 29, 2020
@dev-mano dev-mano changed the title A Source generator should add code to the compilation of a WPF application when one of it's XAML files is declaring an app-local namespace A Source Generator should add code to the compilation of a WPF application when one of the app's XAML files is declaring an app-local namespace Nov 29, 2020
@jaredpar
Copy link
Member

jaredpar commented Dec 1, 2020

@chsienki is the same WPF issue that we are fixing for 16.9?

@chsienki
Copy link
Contributor

chsienki commented Dec 2, 2020

Yes, I believe this is the same issue as dotnet/wpf#3404

I'm not sure why removing the namespace makes it succeed, but I assume it causes the generated XAML code to not reference something it is failing with. This isn't a Roslyn issue, but a WPF one. Closing as a dupe of the above issue.

@chsienki chsienki closed this as completed Dec 2, 2020
@chsienki chsienki reopened this Dec 2, 2020
@chsienki chsienki closed this as completed Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

No branches or pull requests

4 participants