CommunityToolkit / CommunityToolkit/dotnet
Generating of `[ObservableObject]` fails if interface is declared but not implemented
- Dominant language
- C#
- Stars
- 3.8k
- Forks
- 400
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the bug
If a class implements an interface that itself inherits `INotifyPropertyChanged` or `INotifyPropertyChanging` but does not implement the interface methods, code-generation aborts.
Current tests only test diagnostics for an _implementation_ of `INotifyPropertyChanged` / `INotifyPropertyChanging`:
https://github.com/CommunityToolkit/dotnet/blob/7b53ae23dfc6a7fb12d0fc058b89b6e948f48448/tests/CommunityToolkit.Mvvm.SourceGenerators.UnitTests/Test_SourceGeneratorsDiagnostics.cs#L33-L37
### Regression
_No response_
### Steps to reproduce
```cs
interface IStuff : INotifyPropertyChanged {
// ...
}
[ObservableObject]
class B : BaseClass, IStuff {
// No implementation of INotifyPropertyChanged
// source generation
}
```
### Expected behavior
The implementation of `INotifyPropertyChanged` should be generated.
### Screenshots
_No response_
### IDE and version
VS 2022
### IDE version
_No response_
### Nuget packages
- [X] CommunityToolkit.Mvvm (aka MVVM Toolkit)
### Nuget package version(s)
8.2.2
### Additional context
Similar to #620 but slightly different scenario
### Help us help you
Yes, I'd like to be assigned to work on this item
Contributor guide
Assessment
This issue has not been assessed yet.