You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to port my .NET IDE Continuous to macOS. Unfortunately, the latest F# compiler service is failing due to a type load exception with Microsoft.DotNet.DependencyManager.
It is importing the .NET Standard 2.0 version of "lib/netstandard2.0/FSharp.Compiler.Service.dll"
Ironically, this same package works fine on Xamarin.iOS with AOT.
My guess is this is a bug in the DependencyManager, but I would love to know if I can use the F# compiler without it. I swear I had this working on older versions. Is the DependencyManager new?
System.TypeLoadException: Could not load type of field 'Microsoft.DotNet.DependencyManager.AssemblyResolveHandlerCoreclr:handler' (1) due to: Could not resolve type with token 01000013 from typeref (expected class 'System.Runtime.Loader.AssemblyLoadContext' in assembly 'System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a') assembly:System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a type:System.Runtime.Loader.AssemblyLoadContext member:(null)
at Microsoft.DotNet.DependencyManager.DependencyProvider..ctor (Microsoft.DotNet.DependencyManager.AssemblyResolutionProbe assemblyProbingPaths, Microsoft.DotNet.DependencyManager.NativeResolutionProbe nativeProbingRoots) [0x00014] in /Users/chethusk/oss/FCS/src/fsharp/Microsoft.DotNet.DependencyManager/DependencyProvider.fs:266
at Microsoft.DotNet.DependencyManager.DependencyProvider..ctor (Microsoft.DotNet.DependencyManager.NativeResolutionProbe nativeProbingRoots) [0x00000] in /Users/chethusk/oss/FCS/src/fsharp/Microsoft.DotNet.DependencyManager/DependencyProvider.fs:325
at FSharp.Compiler.CompileOps+TcConfigBuilder.CreateNew (FSharp.Compiler.ReferenceResolver+Resolver legacyReferenceResolver, System.String defaultFSharpBinariesDir, FSharp.Compiler.AbstractIL.ILBinaryReader+ReduceMemoryFlag reduceMemoryUsage, System.String implicitIncludeDir, System.Boolean isInteractive, System.Boolean isInvalidationSupported, FSharp.Compiler.CompileOps+CopyFSharpCoreFlag defaultCopyFSharpCore, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] tryGetMetadataSnapshot) [0x002ce] in /Users/chethusk/oss/FCS/src/fsharp/CompileOps.fs:2489
at FSharp.Compiler.Driver.main1OfAst[a,b,c,d] (a ctok, FSharp.Compiler.ReferenceResolver+Resolver legacyReferenceResolver, FSharp.Compiler.AbstractIL.ILBinaryReader+ReduceMemoryFlag reduceMemoryUsage, System.String assemblyName, FSharp.Compiler.CompileOps+CompilerTarget target, b outfile, Microsoft.FSharp.Core.FSharpOption`1[T] pdbFile, Microsoft.FSharp.Collections.FSharpList`1[T] dllReferences, System.Boolean noframework, d exiter, FSharp.Compiler.Driver+ErrorLoggerProvider errorLoggerProvider, Microsoft.FSharp.Collections.FSharpList`1[T] inputs) [0x00000] in /Users/chethusk/oss/FCS/src/fsharp/fsc.fs:1954
...
Repro steps
Provide the steps required to reproduce the problem:
Crate a Xamarin.Mac application
Reference FCS 37
Use the Compile API
Expected behavior
Compile proceeds
Actual behavior
FSharp.Compiler.Driver.main1OfAst fails because Microsoft.DotNet.DependencyManager has a hard reference to a .NET Core assembly (I'm using .NET Standard).
System.TypeLoadException: Could not load type of field 'Microsoft.DotNet.DependencyManager.AssemblyResolveHandlerCoreclr:handler' (1) due to: Could not resolve type with token 01000013 from typeref (expected class 'System.Runtime.Loader.AssemblyLoadContext' in assembly 'System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a') assembly:System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a type:System.Runtime.Loader.AssemblyLoadContext member:(null)
at Microsoft.DotNet.DependencyManager.DependencyProvider..ctor (Microsoft.DotNet.DependencyManager.AssemblyResolutionProbe assemblyProbingPaths, Microsoft.DotNet.DependencyManager.NativeResolutionProbe nativeProbingRoots) [0x00014] in /Users/chethusk/oss/FCS/src/fsharp/Microsoft.DotNet.DependencyManager/DependencyProvider.fs:266
at Microsoft.DotNet.DependencyManager.DependencyProvider..ctor (Microsoft.DotNet.DependencyManager.NativeResolutionProbe nativeProbingRoots) [0x00000] in /Users/chethusk/oss/FCS/src/fsharp/Microsoft.DotNet.DependencyManager/DependencyProvider.fs:325
at FSharp.Compiler.CompileOps+TcConfigBuilder.CreateNew (FSharp.Compiler.ReferenceResolver+Resolver legacyReferenceResolver, System.String defaultFSharpBinariesDir, FSharp.Compiler.AbstractIL.ILBinaryReader+ReduceMemoryFlag reduceMemoryUsage, System.String implicitIncludeDir, System.Boolean isInteractive, System.Boolean isInvalidationSupported, FSharp.Compiler.CompileOps+CopyFSharpCoreFlag defaultCopyFSharpCore, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] tryGetMetadataSnapshot) [0x002ce] in /Users/chethusk/oss/FCS/src/fsharp/CompileOps.fs:2489
at FSharp.Compiler.Driver.main1OfAst[a,b,c,d] (a ctok, FSharp.Compiler.ReferenceResolver+Resolver legacyReferenceResolver, FSharp.Compiler.AbstractIL.ILBinaryReader+ReduceMemoryFlag reduceMemoryUsage, System.String assemblyName, FSharp.Compiler.CompileOps+CompilerTarget target, b outfile, Microsoft.FSharp.Core.FSharpOption`1[T] pdbFile, Microsoft.FSharp.Collections.FSharpList`1[T] dllReferences, System.Boolean noframework, d exiter, FSharp.Compiler.Driver+ErrorLoggerProvider errorLoggerProvider, Microsoft.FSharp.Collections.FSharpList`1[T] inputs) [0x00000] in /Users/chethusk/oss/FCS/src/fsharp/fsc.fs:1954
at FSharp.Compiler.Driver.compileOfAst (FSharp.Compiler.AbstractIL.Internal.Library+CompilationThreadToken ctok, FSharp.Compiler.ReferenceResolver+Resolver legacyReferenceResolver, FSharp.Compiler.AbstractIL.ILBinaryReader+ReduceMemoryFlag reduceMemoryUsage, System.String assemblyName, FSharp.Compiler.CompileOps+CompilerTarget target, System.String targetDll, Microsoft.FSharp.Core.FSharpOption`1[T] targetPdb, Microsoft.FSharp.Collections.FSharpList`1[T] dependencies, System.Boolean noframework, FSharp.Compiler.ErrorLogger+Exiter exiter, FSharp.Compiler.Driver+ErrorLoggerProvider loggerProvider, Microsoft.FSharp.Collections.FSharpList`1[T] inputs, Microsoft.FSharp.Core.FSharpOption`1[T] tcImportsCapture, Microsoft.FSharp.Core.FSharpOption`1[T] dynamicAssemblyCreator) [0x00000] in /Users/chethusk/oss/FCS/src/fsharp/fsc.fs:2222
at FSharp.Compiler.SourceCodeServices.CompileHelpers+result@181-11.Invoke (FSharp.Compiler.ErrorLogger+Exiter exiter) [0x00000] in /Users/chethusk/oss/FCS/src/fsharp/service/service.fs:182
at FSharp.Compiler.SourceCodeServices.CompileHelpers.tryCompile (FSharp.Compiler.ErrorLogger+ErrorLogger errorLogger, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] f) [0x0001f] in /Users/chethusk/oss/FCS/src/fsharp/service/service.fs:157
at FSharp.Compiler.ErrorLogger+ErrorLoggerExtensions.ReraiseIfWatsonable (System.Exception exn) [0x0003f] in /Users/chethusk/oss/FCS/src/fsharp/ErrorLogger.fs:369
at FSharp.Compiler.ErrorLogger+ErrorLoggerExtensions.ErrorLogger.ErrorRecovery (FSharp.Compiler.ErrorLogger+ErrorLogger x, System.Exception exn, FSharp.Compiler.Range+range m) [0x000d8] in /Users/chethusk/oss/FCS/src/fsharp/ErrorLogger.fs:417
at FSharp.Compiler.ErrorLogger+ErrorLoggerExtensions.ErrorLogger.StopProcessingRecovery (FSharp.Compiler.ErrorLogger+ErrorLogger x, System.Exception exn, FSharp.Compiler.Range+range m) [0x000b4] in /Users/chethusk/oss/FCS/src/fsharp/ErrorLogger.fs:430
at FSharp.Compiler.SourceCodeServices.CompileHelpers.tryCompile (FSharp.Compiler.ErrorLogger+ErrorLogger errorLogger, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] f) [0x00034] in /Users/chethusk/oss/FCS/src/fsharp/service/service.fs:160
at FSharp.Compiler.SourceCodeServices.CompileHelpers.compileFromAsts (FSharp.Compiler.AbstractIL.Internal.Library+CompilationThreadToken ctok, FSharp.Compiler.ReferenceResolver+Resolver legacyReferenceResolver, Microsoft.FSharp.Collections.FSharpList`1[T] asts, System.String assemblyName, System.String outFile, Microsoft.FSharp.Collections.FSharpList`1[T] dependencies, System.Boolean noframework, Microsoft.FSharp.Core.FSharpOption`1[T] pdbFile, Microsoft.FSharp.Core.FSharpOption`1[T] executable, Microsoft.FSharp.Core.FSharpOption`1[T] tcImportsCapture, Microsoft.FSharp.Core.FSharpOption`1[T] dynamicAssemblyCreator) [0x00039] in /Users/chethusk/oss/FCS/src/fsharp/service/service.fs:180
at <StartupCode$FSharp-Compiler-Service>.$Service+Compile@1059-3.Invoke (Microsoft.FSharp.Core.Unit unitVar) [0x0000d] in /Users/chethusk/oss/FCS/src/fsharp/service/service.fs:1060
at FSharp.Compiler.AbstractIL.Internal.Library+CancellableModule+delay@741[T].Invoke (System.Threading.CancellationToken ct) [0x00000] in /Users/chethusk/oss/FCS/src/absil/illib.fs:741
at <StartupCode$FSharp-Compiler-Service>.$Reactor+EnqueueAndAwaitOpAsync@185-2[T].Invoke (FSharp.Compiler.AbstractIL.Internal.Library+CompilationThreadToken ctok) [0x00007] in /Users/chethusk/oss/FCS/src/fsharp/service/Reactor.fs:188
Known workarounds
No know workarounds. :-( I would love to hear some options.
Related information
Operating system: macOS 10.15.6
.NET Runtime kind: Mono with Xamarin.Mac
Editing Tools: VS for Mac
The text was updated successfully, but these errors were encountered:
Oof, that's a rough one. The provider itself I believe is a required component now, but individual implementations of dependency providers (ie #r "nuget:") are optional. If the core component is crashing then we have a pretty serious problem.
If possible, can you test your app with the latest FCS dependency from the MS nightly feeds? FCS is published there on a nightly cadence now and it should quickly let us know if that's still a problem. The nuget feed source url is https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json and it should have FCS 38 prereleases in it.
If the problem is still there that tells us we need to report upstream to dotnet/fsharp and fix it at the source.
You can swap out #r handler implementations (or have none at all if you don't include any dlls that implement them), but from what I see in your stacktrace the problem is that the component that discovers/manages those implementations is blowing up.
The overall mechanism is just a hook for providing #load and #I statements, really :D
I am trying to port my .NET IDE Continuous to macOS. Unfortunately, the latest F# compiler service is failing due to a type load exception with
Microsoft.DotNet.DependencyManager
.It is importing the .NET Standard 2.0 version of "lib/netstandard2.0/FSharp.Compiler.Service.dll"
Ironically, this same package works fine on Xamarin.iOS with AOT.
My guess is this is a bug in the DependencyManager, but I would love to know if I can use the F# compiler without it. I swear I had this working on older versions. Is the DependencyManager new?
Repro steps
Provide the steps required to reproduce the problem:
Expected behavior
Compile proceeds
Actual behavior
FSharp.Compiler.Driver.main1OfAst
fails becauseMicrosoft.DotNet.DependencyManager
has a hard reference to a .NET Core assembly (I'm using .NET Standard).Known workarounds
No know workarounds. :-( I would love to hear some options.
Related information
The text was updated successfully, but these errors were encountered: