CommunityToolkit / CommunityToolkit/dotnet
Incorrect code generation when declaring an observable property with a source-generated type
- Dominant language
- C#
- Stars
- 3.8k
- Forks
- 400
- PR merge metrics
- No merged PRs in 30d
Description
### 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
```text
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

### IDE and version
VS 2022 Preview
### IDE version
VisualStudio.17.Preview/17.7.0-pre.2.0+33808.371
### Nuget packages
- [ ] CommunityToolkit.Common
- [ ] CommunityToolkit.Diagnostics
- [ ] CommunityToolkit.HighPerformance
- [X] CommunityToolkit.Mvvm (aka MVVM Toolkit)
### Nuget package version(s)
8.2.1
### Additional context
_No response_
### Help us help you
Yes, but only if others can assist
Contributor guide
Assessment
This issue has not been assessed yet.