Skip to content

ApiCompat: errors when using 'in' modifier #2102

@steveharter

Description

@steveharter

I am modifying System.Text.Json to expose public APIs using the in modifier to support feature https://github.com/dotnet/corefx/issues/34372

APICompat is failing with several errors like this:

error : ParameterModifiersCannotChange : Custom modifiers on parameter 'reader' on method 'System.Text.Json.Serialization.JsonTypeSerializer<TType>.OnDeserialized(TType, System.Text.Json.Serialization.JsonClassInfo<TType>, System.Text.Json.Utf8JsonReader, System.Text.Json.Serialization.JsonSerializerOptions, System.Collections.Generic.IDictionary<System.String, System.Object>)' are 'System.Runtime.InteropServices.InAttribute' in the implementation but 'System.Runtime.InteropServices.InAttribute' in the contract. [D:\git\corefx2\src\System.Text.Json\src\System.Text.Json.csproj]

From looking at the IL, the ref's in modifier attribute looks like this:
[System.Runtime]System.Runtime.InteropServices.InAttribute
while the implementation IL looks likes this:
[System.Private.CoreLib]System.Runtime.InteropServices.InAttribute

Which is causing ApiCompat to fail here

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Infrastructure-librariesArea maintained by .NET libraries team: APICompat, AsmDiff, GenAPI, GenFacades, PkgProj, etc

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions