Skip to content

resx source generator emits invalid C# for namespace when .resx file is an absolute path #81991

@AArnott

Description

@AArnott

Version Used: Microsoft.CodeAnalysis.ResxSourceGenerator 5.0.0-1.25277.114

Steps to Reproduce:

Add an EmbeddedResource item like this:

<EmbeddedResource Include="$(PlatformPath)\Utilities\Impl\DpiAwarenessResources.resx" />

Where $(PlatformPath) is set to an absolute path.

Expected Behavior:

A valid code-behind is source generated.

Actual Behavior:

The emitted file has an invalid namespace:

namespace Microsoft.VisualStudio.Utilities.E:.VS.src.Platform.Utilities.Impl

Notice how this has E: as one of the segments of the namespace.

And due to #81973 I cannot workaround this bug by simply setting the ClassName metadata.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions