LP5: Reference assemblies should not be loaded for execution
I have a dll written in .net 4.7.2 that reads the contents of a zip file using the System.IO.Compression namespace with the additional functionality included in System.IO.Compression.FileSystem. This dll works in VS, and it works from a console application that references it. And until today, it worked within LinqPad 5.
But today, I started getting this message when i try to use it:
Could not load file or assembly 'System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)
The exception is being thrown within my dll, but only if called from LinqPad.
The last change made was this Windows Update:
2020-08 Cumulative Update for Windows 10 Version 1607 for x64-based Systems (KB4571694) installed on 8/15/2020.
Any suggestions?
Comments
It sounds like a reference assembly is somehow ending up in your project's output folder. Can you verify that System.IO.Compression.* is not present in your output folder?
Thanks, Joe.
You're right, that's exactly what happened. I removed System.IO.Compression and System.IO.Compression.FileSystem, and re-started LinqPad, and it started working again.