-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Closed
Copy link
Labels
Area-CompilersInteractive-EnCuntriagedIssues and PRs which have not yet been triaged by a leadIssues and PRs which have not yet been triaged by a lead
Description
Version Used: net 9.0 / Microsoft.CodeAnalysis 4.14.0
Steps to Reproduce:
- Start the repro project RoslynOutOfRange.zip with debugger attached
- In the file
MainPage.g.cscomment the line 11private object _component_0_Holder { get; set; } = new(); - Invoke HR
- Observe error
error ENC1002: Cannot apply changes -- unexpected error: 'Index was outside the bounds of the array.'
Diagnostic Id: ENC1002
Expected Behavior:
Able to apply changes using hot-reload.
Actual Behavior:
error ENC1002: Cannot apply changes -- unexpected error: 'Index was outside the bounds of the array.'
Note: This happens only if we have a call like MyStaticClass.Configure(something => { }); in the "main" class/file. If this line is commented out, the error will not happen.
Note 2: The partial class has to be in a different file from the "main", having them both in the same file will also avoid the error.
Workaround:
Initialize the property in the constructor instead of using an initializer.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-CompilersInteractive-EnCuntriagedIssues and PRs which have not yet been triaged by a leadIssues and PRs which have not yet been triaged by a lead