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

EnC fails when replacing generated regex attribute string #72331

Open
jjonescz opened this issue Feb 29, 2024 · 1 comment
Open

EnC fails when replacing generated regex attribute string #72331

jjonescz opened this issue Feb 29, 2024 · 1 comment

Comments

@jjonescz
Copy link
Member

Version Used: SDK 8.0.201, VS Version 17.10.0 Preview 2.0 [34626.289.main]

Steps to Reproduce:

using System.Text.RegularExpressions;

public static partial class Program
{
    public static void Main()
    {
        Console.ReadLine();
    }

    [GeneratedRegex(@".*", RegexOptions.Compiled)]
    public static partial Regex TestRegex();
}

Start debugging, change the @".*" string to something else and click Hot reload.

Expected Behavior: Works or at least doesn't show "unexpected error".

Actual Behavior:

[Error] C:\Users\janjones\Code\issues\roslyn\EnC-ReplaceRegex\ClassLibrary1\ClassLibrary1.sln (line 1): error ENC1002: Cannot apply changes -- unexpected error: 'Unexpected value 'System.Text.RegularExpressions.Generated.Utilities' of type 'Microsoft.CodeAnalysis.CSharp.Symbols.SourceNamedTypeSymbol''
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Feb 29, 2024
@arunchndr arunchndr added the Bug label Apr 19, 2024
@arunchndr arunchndr removed the untriaged Issues and PRs which have not yet been triaged by a lead label Apr 19, 2024
@tmat
Copy link
Member

tmat commented Oct 1, 2024

The issue is due to #51998.

The IDE uses relative path for the source generated file, while the compiler is using absolute path.
Generated file class ends up having two different path hashes in metadata name.

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

3 participants