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

Hot Reload unusable with CS8055 if a file created via "Move type to X.cs" is not touched by the user #72984

Open
Rekkonnect opened this issue Apr 11, 2024 · 3 comments

Comments

@Rekkonnect
Copy link
Contributor

Version Used

VS 2022 Version 17.9.5
Roslyn 4.9.0 (a98c90d)

Project info
C# 12.0
.NET 8.0

Steps to Reproduce

  1. Create a file XYZ.cs that contains a type named XYZ
  2. Within that same file declare another type named ABC (different than XYZ)
  3. Use the "Move type to ABC.cs" code action
  4. Run the program with a debugger
  5. Pause execution at any point
  6. Edit any file within the assembly containing the above types (XYZ and ABC)
  7. Ensure that there are no compiler errors after the edits
  8. Use Hot Reload to load the changes onto the program and continue execution

Expected Behavior

Hot Reload works as expected, without any errors.

Actual Behavior

Hot Reload fails, and the following is observed in the output of Hot Reload:

19:44 51.27 [Error] E:\repos\[truncated]\File.cs (line 1): error CS8055: Cannot emit debug information for a source text without encoding.
19:44 51.27 Invalid changes were found. Please refer to the Error List window to fix those issues.

The user is prompted to edit the code or rerun the program anew, after Hot Reload fails.

The bug can be worked around by manually changing and saving changes to the ABC file before hot reloading, without stopping the current execution. Once the file is manually changed, hot reloading works.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Interactive untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 11, 2024
@danports
Copy link

I've run into this so many times, probably because I have a tendency to add types wherever I feel like it and then use the move to separate file action later on. Thanks @Rekkonnect for the bug report & workaround!

@arkalyanms arkalyanms added the Bug label Apr 19, 2024
@arkalyanms arkalyanms removed the untriaged Issues and PRs which have not yet been triaged by a lead label Apr 19, 2024
@palenshus
Copy link

Wow, amazing job tracking down the repro mechanism for this!

@theolivenbaum
Copy link

Any updates on this? I hit this issue constantly on Visual Studio

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

No branches or pull requests

6 participants