Skip to content

Microsoft.XmlSerializer.Generator not working with any .NET Standard 2.0 library #83765

@topsterde

Description

@topsterde

Description

Microsoft.XmlSerializer.Generator does not find the Span<> type when .NET Standard 2.0 is used.

Reproduction Steps

Just compile the attached example:
XmlSerializerAppWithGenerator.zip

Expected behavior

*.XmlSerializer.dll is generated

Actual behavior

CS0234: The type or namespace "Span<>"
warning : SGEN: Failed to generate the serializer for XmlSerializerLibWithGenerator.dll

Regression?

No response

Known Workarounds

Change <TargetFramework>netstandard2.0</TargetFramework> to <TargetFramework>netstandard2.1</TargetFramework>

Configuration

.NET SDK:
Version: 7.0.202
Commit: 6c74320bc3

OS Name: Windows
OS Version: 10.0.19042
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\7.0.202\

Host:
Version: 7.0.4
Architecture: x64
Commit: 0a396ac

.NET SDKs installed:
6.0.405 [C:\Program Files\dotnet\sdk]
7.0.202 [C:\Program Files\dotnet\sdk]

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions