runtime: System.MissingMethodException when using 4.5.0-preview2-* (and newer) library with master SDK
Valid repro: DirectoryRepro.zip
Execute repro with dotnet run -c Release.
Unhandled Exception: System.MissingMethodException: Method not found: 'System.ReadOnlySpan`1<Char> System.MemoryExtensions.AsSpan(System.String)'.
at System.IO.Enumeration.FileSystemEnumerableFactory.NormalizeInputs(String& directory, String& expression, EnumerationOptions options)
at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
at DirectoryRepro.Program.Main() in /tmp/test4/Program.cs:line 9
I reproduced it on Windows as well as Linux. This issue did not happen previously with using 4.5.0-preview1-* library also on latest master SDK. I suspect some API incompatibility (probably not in the library being pulled, but one of its dependencies). If this is intended then how we’re expected to use this library with latest master SDK?
Thank you in advance.
.NET Core SDK (reflecting any global.json):
Version: 2.1.300-preview3-008443
Commit: 1e2e8138b9
Runtime Environment:
OS Name: debian
OS Version:
OS Platform: Linux
RID: debian-x64
Base Path: /opt/dotnet/sdk/2.1.300-preview3-008443/
Host (useful for support):
Version: 2.1.0-preview3-26404-01
Commit: 1b1a652c15
.NET Core SDKs installed:
2.1.300-preview3-008443 [/opt/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.0-preview2-30431 [/opt/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.0-preview2-30431 [/opt/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.0-preview3-26404-01 [/opt/dotnet/shared/Microsoft.NETCore.App]
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 18 (18 by maintainers)
That PR went in and core-setup should now generate the version metadata for Microsoft.NETCore.App.deps.json deps in the next 2.1 build.
@weshaggard can we trigger a 2.1 release build to make this available asap?
I can confirm that I’m no longer seeing this issue with above release.
Thanks!
I have verified that we no longer see any error using the latest RTM dotnet cli/sdk: 2.1.300-rtm-008833, with Microsoft.NETCore.App version
2.1.0-rtm-26510-03(regardless what library version your project is referencing:4.5.0-preview2-26406-04or4.5.0-rc1).This issue is no longer blocking release.
.NET Core 2.2. dotnet/cli master (
2.2.100-preview1-008854) has an out-dated .NET Core runtime (Microsoft.NETCore.App2.1.0-rtm-26505-04), and hence still has the issue. We should update the cli master to point to the latest available shared runtime.Also, we need to update the versions repo, which still lists
rtm-008823as latest (rather thanrtm-008833): https://github.com/dotnet/versions/blob/476bf6db689722a99f15fce3cfb00cb993b29f2f/build-info/dotnet/cli/master/Latest.txt#L1cc @livarcocc, the last update was 3 days ago.
The fix will require an SDK update (a package update isn’t required).
The latest RTM build of the dotnet cli does not have the fix yet. https://github.com/dotnet/versions/tree/master/build-info/dotnet/product/cli/release/2.1#built-repositories
I don’t see the assembly and file versions in the Microsoft.NETCore.App.deps.json deps file (within
dotnetcli\shared\Microsoft.NETCore.App\2.1.0-rtm-26508-02)There is investigation on going here: https://github.com/dotnet/core-setup/issues/4082#issuecomment-386738404
The FileLoadException is occurring now because the assembly in the app is lower than what’s expected by the shared framework. This is expected until the deps file is updated.
Yes, this repro uses libraries that are publicly available on official nuget, only SDK is master but NOT the (project) libraries themselves. Thanks!
See previous issue for more context: https://github.com/dotnet/corefx/issues/28274
On first glance, this looks like a duplicate of that one. However, it does look like the latest shipped preview2 packages are being used here (along with latest CLI from master). I will investigate further. Thanks for reporting it!
The workaround is likely to keep the versions in sync (rather than mixing and matching preview2/preview3).