Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Fody + .NET 9 project: Hot Reload (EnC) broken due to wrong/duplicate System.Runtime reference (CS7038) #3937

Open
jaredthirsk opened this issue Dec 5, 2024 · 0 comments
Labels

Comments

@jaredthirsk
Copy link

jaredthirsk commented Dec 5, 2024

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

  1. Create .NET 9 project
  2. Add ReactiveUI.Fody nuget
  3. Make a class with [Reactive] property
  4. Debug in VS2022 Preview, or dotnet watch
  5. Try to make a change for hot reload
  6. 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'.
  1. 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

  1. If I change my project back to .NET 8, hot reload works.
  2. If I drop ReactiveUI.Fody and use ReactiveUI.SourceGenerators instead, it works. (Though it has breaking changes to my code.)

Additional information ℹ️

Related issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant