Open
Description
Describe the bug 🐞
Hot reload fails (both dotnet watch, and in VS2022 Preview) on .NET 9.0 project with ReactiveUI.Fody.Helpers.
If I remove [Reactive] attribute and ReactiveUI.Fody (I think version 19.5.41), hot reload works.
(If I add ReactiveUI.SourceGenerators, and use their different [Reactive] attribute on a field, it works.)
Step to reproduce
- Create .NET 9 project
- Add ReactiveUI.Fody nuget
- Make a class with [Reactive] property
- Debug in VS2022 Preview, or
dotnet watch
- Try to make a change for hot reload
- Fails with error:
dotnet watch :x: error CS7038: Failed to emit module 'Xyz.Core': Changing the version of an assembly reference is not allowed during debugging: 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' changed version to '9.0.0.0'.
- If I inspect the DLL with dotPeek, I see there are two references for System.Runtime, version 8.0 and 9.0. I suspect this is where the problem is. Microsoft's Hot Reload should ideally detect that both were there before and after so no version was changed, but I suspect this scenario of two versions of the same DLL is not supposed to happen (I'm not an expert though, so I can't say for sure.)
Reproduction repository
No response
Expected behavior
- Expectation: Hot reload should work
- Expectation: DLL shouldn't have two references to System.Runtime (v8, v9)
Screenshots 🖼️
No response
IDE
Visual Studio 2022
Operating system
Windows 10
ReactiveUI Version
19.5.41
Workarounds
- If I change my project back to .NET 8, hot reload works.
- If I drop ReactiveUI.Fody and use ReactiveUI.SourceGenerators instead, it works. (Though it has breaking changes to my code.)
Additional information ℹ️
Related issues: