CommunityToolkit / CommunityToolkit/dotnet

Add fully qualified name to cref ObservableObject in xml comments for files generated by ObservableObjectGenerator

Open
#963 0 comments 0 reactions 0 assignees View on GitHub
bug :bug:
Dominant language
C#
Stars
3.8k
Forks
400
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug

When using the ObservableObject attribute from the CommunityToolkit.Mvvm v8.3.2 package on the code behind partial class of a WPF UserControl like this:

![Image](https://github.com/user-attachments/assets/f1ff4525-d9d9-4528-94b2-1f799b5c03f7)

The reference `` symbol reference is not resolved in the *.g.cs file generated by the ObservableObjectGenerator.

![Image](https://github.com/user-attachments/assets/3c6ad1ad-67c6-4cca-9293-f6f9de0aa56a)

First, I opened a [ticket in the DocFx project](https://github.com/dotnet/docfx/issues/10259) because I found this issue working with DocFx. Analyzing the problem with a contributor from the DocFx team, I was sent over here.

**How to fix problem**
ObservableObject should be referenced by using fully qualified name.
(e,g, ``)

It probably can be fixed by changing following line.
https://github.com/CommunityToolkit/dotnet/blob/v8.3.2/src/CommunityToolkit.Mvvm/ComponentModel/ObservableObject.cs#L275

### Regression

_No response_

### Steps to reproduce

Have a look at my test project [DocFxTest](https://github.com/RobGess/DocFxTest) to reproduce this issue or follow these steps:

1. Create WPF project.
2. Add UserControl
3. Add [ObservableObject] attribute to partial class *.xaml.cs of the UserControl.
4. Check SourceGenerator's *.g.cs file's SetProperty method's comments.

### Expected behavior

Symbol should be resolved (and highlighted).

### Screenshots

_No response_

### IDE and version

VS 2022

### IDE version

17.11.5

### Nuget packages

- [ ] CommunityToolkit.Common
- [ ] CommunityToolkit.Diagnostics
- [ ] CommunityToolkit.HighPerformance
- [x] CommunityToolkit.Mvvm (aka MVVM Toolkit)

### Nuget package version(s)

8.3.2

### Additional context

_No response_

### Help us help you

Yes, I'd like to be assigned to work on this item.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.