dotnet / ILMerge

ILMerge is a static linker for .NET Assemblies.
MIT License
1.23k stars 170 forks source link

Support types with embedded references? #99

Open tobinchan opened 3 years ago

tobinchan commented 3 years ago

I use ILMerge with System.Memory.dll, and inside it the type Span<T> was merged out to be marked with Obsolete:

    [DebuggerDisplay("{ToString(),raw}")]
    [DebuggerDisplay("{ToString(),raw}")]
    [DebuggerTypeProxy(typeof(System.SpanDebugView<>))]
    [DebuggerTypeProxy(typeof(System.SpanDebugView<>))]
    [DefaultMember("Item")]
    [Obsolete("Types with embedded references are not supported in this version of your compiler.", true)]
    [System.Memory.IsByRefLikeAttribute]
    [System.Memory.IsReadOnlyAttribute]
    public struct Span<T> { ... }

Origin type is:

    [DebuggerDisplay("{ToString(),raw}")]
    [DebuggerDisplay("{ToString(),raw}")]
    [DebuggerTypeProxy(typeof(System.SpanDebugView<>))]
    [DebuggerTypeProxy(typeof(System.SpanDebugView<>))]
    [DefaultMember("Item")]
    public readonly ref struct Span<T> { ... }

Build error:

error CS0619: 'Span<T>' is obsolete: 'Types with embedded references are not supported in this version of your compiler.'

Can you help me work around this problem?