Skip to content

[10.0 RC 2] The type or namespace name 'Loader' does not exist in the namespace 'System.Runtime' #51320

@maliming

Description

@maliming

Description

After installing the 10.0 RC 2 SDK, the project that references the System.Runtime.Loader package can't build.

Current workaround: Uninstall RC 2 and install RC 1, or remove netstandard2.1 from TargetFrameworks in RC 2, and everything works.

Reproduction Steps

Code to reproduce:

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <TargetFrameworks>netstandard2.0;netstandard2.1;net10.0</TargetFrameworks>
    </PropertyGroup>
    <ItemGroup>
        <PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
    </ItemGroup>
</Project>
using System.Runtime.Loader;

namespace ClassLibrary1
{
    public static class MyClass1
    {
        public static void Method1()
        {
            AssemblyLoadContext.Default.LoadFromAssemblyPath("");
        }
    }
}

Expected behavior

The dotnet build should be successful.

Actual behavior

> dotnet build
Restore complete (2.3s)
    info NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
  ClassLibrary1 netstandard2.0 succeeded (0.2s)  bin\Debug\netstandard2.0\ClassLibrary1.dll
  ClassLibrary1 netstandard2.1 failed with 1 error(s) (0.7s)
    ClassLibrary1\ClassLibrary1\Class1.cs(1,22): error CS0234: The type or namespace name 'Loader' does not exist in the namespace 'System.Runtime' (are you missing an assembly reference?)
  ClassLibrary1 net10.0 succeeded (1.7s)  bin\Debug\net10.0\ClassLibrary1.dll

Regression?

10.0 RC has no this problem.

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions