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
{{ message }}
Repository navigation
Assembly.GetFile should throw an explicit exception for memory-loaded assemblies #40154
Assembly.GetFile and Assembly.GetFiles currently calls Module.FullyQualifiedName and then returns a FileStream over that path. For assemblies loaded from memory (or any other assembly not loaded directly from a file) this will try to load a file like "C:\currentdirectory\<Unknown>" because Module.FullyQualifiedName returns constant <Unknown> for memory-loaded assemblies. Opening such file will typically fail with IOException.
It would be much cleaner to explicitly handle this case in Assembly.GetFile/Assembly.GetFiles and throw some more specific exception. In theory it's possible that the file <Unknown> will actually exist in which case the API would return basically a random stream of data.
Activity
Change Assembly.GetFile(s) to throw when in-memory
Change Assembly.GetFile(s) to throw when in-memory (#40593)