-
Notifications
You must be signed in to change notification settings - Fork 789
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
Error using System.Drawing.Common with FSI #12023
Comments
Issue moved from dotnet/runtime#57922
From @msftbot[bot] on Monday, August 23, 2021 8:01:09 AM Tagging subscribers to this area: @safern, @tarekgh Issue DetailsWhen calling System.Drawing.Common within FSharp Interactive, the assembly cannot be loaded
Repro fsx script for the error:
FSI version details:
|
Issue moved from dotnet/runtime#57922
From @tarekgh on Monday, August 23, 2021 4:20:20 PM @ericstj any thoughts what can cause that? |
Issue moved from dotnet/runtime#57922
From @ericstj on Monday, August 23, 2021 4:42:10 PM I'm guessing it's an issue with FSI's loader for nuget packages. The package works fine when consumed from an application. |
Issue moved from dotnet/runtime#57922
From @am11 on Monday, August 23, 2021 4:46:31 PM Yup, file: // Generated from #r "nuget:Package References"
// ============================================
//
// DOTNET_HOST_PATH:(C:\Program Files\dotnet\dotnet.exe)
// MSBuildSDKsPath:(C:\Program Files\dotnet\sdk\3.1.200-preview-014883\Sdks)
// MSBuildExtensionsPath:(C:\Program Files\dotnet\sdk\3.1.200-preview-014883\)
//
// References
//
#r @"/Users/am11/.nuget/packages/microsoft.win32.systemevents/5.0.0/lib/netstandard2.0/Microsoft.Win32.SystemEvents.dll"
#r @"/Users/am11/.nuget/packages/system.drawing.common/5.0.2/runtimes/unix/lib/netcoreapp3.0/System.Drawing.Common.dll" (note the netcoreapp3.0 reference). $ dotnet fsi
> #r "/Users/am11/.nuget/packages/system.drawing.common//5.0.2/lib/netstandard2.0/System.Drawing.Common.dll"
- open System.IO
- open System.Drawing
-
- let getBitmapWidth =
- use stream = new FileStream("image.jpg",FileMode.Open,FileAccess.Read)
- use bm = new Bitmap(stream)
- bm.Width;;
--> Referenced '/Users/am11/.nuget/packages/system.drawing.common//5.0.2/lib/netstandard2.0/System.Drawing.Common.dll' (file may be locked by F# Interactive process)
... |
Issue moved from dotnet/runtime#57922
From @ericstj on Tuesday, August 24, 2021 12:36:40 AM
So choosing That doesn't really explain why fsi couldn't load it though. Your workaround of using ns2.0 is probably just treating the symptom. Something in the runtime loader for fsi isn't consistent with how it's compiling. This issue should be transferred to https://github.com/dotnet/fsharp. @KevinRansom @TIHan @cartermp can you help with that? |
Bump |
I'm still getting this on .NET 6
|
I will take a look shortly. Pretty sure it's not a setup issue. |
System.Drawing.Common is not a standard: Microsoft.NETCore.App assembly. We don't probe there and fsi is not compiled: Microsoft.WindowsDesktop.App. So the runtime doesn't know to probe there either. I'm not sure what to do about this. We haven't really considered the impact of Microsoft.WindowsDesktop.App or Microsoft.AspNetCore.App on fsi or fsc for that matter. I imagine that we can probably do some stuff within #r "nuget: to allow the specification of these" framework extensions. |
Here is another example: #13473 |
Okay, I think we may be able to do it using #r nuget: ... it's going to take some work though. Nuget has packages with binaries, which look like they may work ... If we do it right, I might be able to eliminate the preloading hack we do today although maybe not because of namespaces. Prioritization remains to be seen. |
Issue moved from dotnet/runtime#57922
From @auslavs on Monday, August 23, 2021 8:01:05 AM
When calling System.Drawing.Common within FSharp Interactive, the assembly cannot be loaded
Repro fsx script for the error:
FSI version details:
The text was updated successfully, but these errors were encountered: