Open
Description
Description
When using AssemblyLoadContext.LoadFromStream
to load an assembly from a Stream that is returned by FileSystem.OpenAppPackageFileAsync
, I end up with a System.NotSupportedException
on Android. I started with a ticket in Xamarin.Android: dotnet/android#7763. However, in the end it was determined that there is no way to reliably get the Length of an Asset Stream in Android.
I believe that in this function, it might be possible to avoid depending on the Stream.Length.
Reproduction Steps
using (var resStream = FileSystem.OpenAppPackageFileAsync("MyModule.dll").Result)
{
var loadCtx = new AssemblyLoadContext("Module");
var assem = loadCtx.LoadFromStream(resStream);
}
Expected behavior
LoadFromStream
should not require knowing the Stream Length.
Actual behavior
LoadFromStream
causes an exception due to requiring to get the Stream Length.
Regression?
No response
Known Workarounds
Copy the stream into a MemoryStream first.
Configuration
No response
Other information
No response
Metadata
Metadata
Assignees
Type
Projects
Status
No status