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

Update tools to the latest version of System.Reflection.Metadata #101541

Closed
adamsitnik opened this issue Apr 25, 2024 · 0 comments · Fixed by #101910
Closed

Update tools to the latest version of System.Reflection.Metadata #101541

adamsitnik opened this issue Apr 25, 2024 · 0 comments · Fixed by #101910
Assignees
Labels
area-Tools-ILVerification Issues related to ilverify tool and IL verification in general
Milestone

Comments

@adamsitnik
Copy link
Member

When the SDK version is updated to latest, we are going to need to make some changes to the tools, so they stop referencing the new APIs via links and simply consume latest version of System.Reflection.Metadata package.

Here is the list of things that it will requires

  1. Remove links to files from ILVerification.projitems:
    <Compile Include="$(LibrariesProjectRoot)\Common\src\System\HexConverter.cs">
    <Link>Utilities\HexConverter.cs</Link>
    </Compile>
    <Compile Include="$(LibrariesProjectRoot)\Common\src\System\Reflection\AssemblyNameFormatter.cs">
    <Link>Utilities\AssemblyNameFormatter.cs</Link>
    </Compile>
    <Compile Include="$(LibrariesProjectRoot)\Common\src\System\Reflection\AssemblyNameParser.cs">
    <Link>Utilities\AssemblyNameParser.cs</Link>
    </Compile>
    <Compile Include="$(LibrariesProjectRoot)\Common\src\System\Reflection\Metadata\AssemblyNameInfo.cs">
    <Link>Utilities\Metadata\AssemblyNameInfo.cs</Link>
    </Compile>
    <Compile Include="$(LibrariesProjectRoot)\Common\src\System\Reflection\Metadata\TypeName.cs">
    <Link>Utilities\TypeName.cs</Link>
    </Compile>
    <Compile Include="$(LibrariesProjectRoot)\Common\src\System\Reflection\Metadata\TypeNameParserOptions.cs">
    <Link>Utilities\TypeNameParserOptions.cs</Link>
    </Compile>
    <Compile Include="$(LibrariesProjectRoot)\Common\src\System\Reflection\Metadata\TypeNameParser.cs">
    <Link>Utilities\TypeNameParser.cs</Link>
    </Compile>
    <Compile Include="$(LibrariesProjectRoot)\Common\src\System\Reflection\Metadata\TypeNameParserHelpers.cs">
    <Link>Utilities\TypeNameParserHelpers.cs</Link>
    </Compile>
    <Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\UnconditionalSuppressMessageAttribute.cs" Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
    <Link>System\Diagnostics\CodeAnalysis\UnconditionalSuppressMessageAttribute.cs</Link>
    </Compile>
    <Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\NullableAttributes.cs" Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
    <Link>System\Diagnostics\CodeAnalysis\NullableAttributes.cs</Link>
    </Compile>

    <Compile Include="$(LibrariesProjectRoot)\Common\src\System\Text\ValueStringBuilder.AppendSpanFormattable.cs" Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
    <Link>Utilities\ValueStringBuilder.AppendSpanFormattable.cs</Link>
    </Compile>
  2. And from ILCompiler.TypeSystem.csproj:
    <Compile Include="$(LibrariesProjectRoot)\Common\src\System\HexConverter.cs">
    <Link>Utilities\HexConverter.cs</Link>
    </Compile>
    <Compile Include="$(LibrariesProjectRoot)\Common\src\System\Reflection\AssemblyNameFormatter.cs">
    <Link>Utilities\AssemblyNameFormatter.cs</Link>
    </Compile>
    <Compile Include="$(LibrariesProjectRoot)\Common\src\System\Reflection\AssemblyNameParser.cs">
    <Link>Utilities\AssemblyNameParser.cs</Link>
    </Compile>
    <Compile Include="$(LibrariesProjectRoot)\Common\src\System\Reflection\Metadata\AssemblyNameInfo.cs">
    <Link>Utilities\AssemblyNameInfo.cs</Link>
    </Compile>
    <Compile Include="$(LibrariesProjectRoot)\Common\src\System\Reflection\Metadata\TypeName.cs">
    <Link>Utilities\TypeName.cs</Link>
    </Compile>
    <Compile Include="$(LibrariesProjectRoot)\Common\src\System\Reflection\Metadata\TypeNameParser.cs">
    <Link>Utilities\TypeNameParser.cs</Link>
    </Compile>
    <Compile Include="$(LibrariesProjectRoot)\Common\src\System\Reflection\Metadata\TypeNameParserHelpers.cs">
    <Link>Utilities\TypeNameParserHelpers.cs</Link>
    </Compile>
    <Compile Include="$(LibrariesProjectRoot)\Common\src\System\Reflection\Metadata\TypeNameParserOptions.cs">
    <Link>Utilities\TypeNameParserOptions.cs</Link>
    </Compile>

    <Compile Include="$(LibrariesProjectRoot)\Common\src\System\Text\ValueStringBuilder.AppendSpanFormattable.cs">
    <Link>Utilities\ValueStringBuilder.AppendSpanFormattable.cs</Link>
    </Compile>
  3. Move all the files from src/libraries/Common/src/System/Reflection/Metadata/*.cs to src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/
  4. Remove #nullable enable from following files:







  5. Change the #if to public for SYSTEM_REFLECTION_METADATA, otherwise internal (https://github.com/dotnet/runtime/pull/100094/files#r1577334880)
    #if SYSTEM_PRIVATE_CORELIB
    internal
    #else
    public
    #endif

    #if SYSTEM_PRIVATE_CORELIB
    internal
    #else
    public
    #endif

    #if SYSTEM_PRIVATE_CORELIB
    internal
    #else
    public
    #endif
  6. Remove #pragma warning disable RS003
    #pragma warning disable RS0030 // TypeSystem does not allow System.Linq, but we need to use System.Linq.ImmutableArrayExtensions.ToArray
  7. Simpify throw helpers by removing unused #if/else/elif blocks:
    #else // tools that reference this file as a link
    : throw new ArgumentException("The given assembly name was invalid.", nameof(assemblyName));
    #endif

    #else // tools that reference this file as a link
    new ArgumentException();
    #endif

    #else // tools that reference this file as a link
    new InvalidOperationException();
    #endif

    #else // tools that reference this file as a link
    new InvalidOperationException();
    #endif
  8. Update comments (remove the tools mentions):
    #else // corelib and tools that reference this file as a link

    #else // corelib and tools that reference this file as a link

    #else // corelib and tools that reference this file as a link

cc @jkotas

@adamsitnik adamsitnik added the area-Tools-ILVerification Issues related to ilverify tool and IL verification in general label Apr 25, 2024
@adamsitnik adamsitnik added this to the 9.0.0 milestone Apr 25, 2024
@adamsitnik adamsitnik self-assigned this Apr 25, 2024
jkotas added a commit to jkotas/runtime that referenced this issue Apr 28, 2024
jkotas added a commit to jkotas/runtime that referenced this issue Apr 28, 2024
jkotas added a commit to jkotas/runtime that referenced this issue Apr 28, 2024
…package

Contributes to dotnet#101541

Fixes dotnet#101628

Better unreachable code elimination in CoreLib
jkotas added a commit to jkotas/runtime that referenced this issue Apr 28, 2024
…package

Contributes to dotnet#101541

Fixes dotnet#101628

Better unreachable code elimination in CoreLib
jkotas added a commit to jkotas/runtime that referenced this issue Apr 29, 2024
…package

Contributes to dotnet#101541

Fixes dotnet#101628

Better unreachable code elimination in CoreLib
jkotas added a commit that referenced this issue Apr 29, 2024
matouskozak pushed a commit to matouskozak/runtime that referenced this issue Apr 30, 2024
michaelgsharp pushed a commit to michaelgsharp/runtime that referenced this issue May 9, 2024
Ruihan-Yin pushed a commit to Ruihan-Yin/runtime that referenced this issue May 30, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jun 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Tools-ILVerification Issues related to ilverify tool and IL verification in general
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant