CommunityToolkit / dotnet

.NET Community Toolkit is a collection of helpers and APIs that work for all .NET developers and are agnostic of any specific UI platform. The toolkit is maintained and published by Microsoft, and part of the .NET Foundation.
https://docs.microsoft.com/dotnet/communitytoolkit/?WT.mc_id=dotnet-0000-bramin
Other
3.07k stars 299 forks source link

Incorrect code generation when declaring an observable property with a source-generated type #733

Open Aurumaker72 opened 1 year ago

Aurumaker72 commented 1 year ago

Describe the bug

Declaring an observable property with a source-generated type fails at compile-time.

Source generators should have access to other source-generated code.

Steps to reproduce

1. Create a project
2. Add CsWin32
3. Add CommunityToolkit.MVVM
4. Register `WindowFromPoint` in the `NativeMethods.txt` file
5. Add an observable property of type `HWND`
6. `The type or namespace name 'HWND' could not be found ...\SpySharp.Views.WPF.MainWindow.g.cs`

Expected behavior

The project should compile as it does with non-source-generated types.

Screenshots

image

IDE and version

VS 2022 Preview

IDE version

VisualStudio.17.Preview/17.7.0-pre.2.0+33808.371

Nuget packages

Nuget package version(s)

8.2.1

Additional context

No response

Help us help you

Yes, but only if others can assist

Balkoth commented 1 year ago

I guess this is an inherent issue with source generators as Source generators cannot see the output of other source generators