runtime: [RC1] Could not load type 'System.Utf8String' from assembly 'System.Utf8String.Experimental
Problem
Unable to use Utf8String in 5.0 RC1 SDK (5.0.0-rc.1.20423.8), it works fine in 6.0 alpha (6.0.100-alpha.1.20428.8)
Unhandled exception. System.TypeLoadException: Could not load type 'System.Utf8String' from assembly 'System.Utf8String.Experimental, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
at repro.Program.Main()
Repro:
The following code fails when using 5.0.0-rc.1.20423.8 SDK:
using System;
namespace repro
{
class Program
{
static void Main() => Console.WriteLine(new Utf8String("Hello World!"));
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Utf8String.Experimental" Version="5.0.0-preview.8.20352.3" />
</ItemGroup>
</Project>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
<add key="dotnet5" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
</packageSources>
</configuration>
The problem is currently blocking performance repo from switching to release/5.0.1xx channel for downloading net5.0 SDK (so far we were using master channel but it’s time to switch to 5.0 as master contains now 6.0 bits): https://github.com/dotnet/performance/pull/1484
@GrabYourPitchforks @eerhardt is there any chance that someone could take a look at this?
/cc @ooooolivia
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18 (18 by maintainers)
You cannot. The plan for this is to move experiment like this to dotnet/runtimelab and allow you to publish self-contained apps if you want to play with experimental features like Utf8String.
I am installing a NuGet package, writing code that compiles perfectly fine, and then I am trying to run it. Once I get
TypeLoadExceptionmy first thought is that I am missing some dependency (a.dllfile) or there is a.dllversion mismatch. Since it worked just a few days ago, I am very confused.If the type has been removed from
net5.0I should get a compiler error that indicates that.This is perfectly fine, but please be clear about this. Give me an error that says it and I won’t be creating new issues and wondering whether SDK installer is broken or something was removed, but not 100% removed.
I’ve sent a PR to address that: https://github.com/dotnet/performance/pull/1491
I believe that is expected. We don’t want experimental types in release builds. They are experimental, not to be released.
I hit this too.
Also ran into issues with the deprecation of binary formatter, the suggested suppression via
SYSLIB0011did not work and the only way I could get things to build was to delete the files that had binary formatter tests.