8000 How to use the System.IO.Compression namespace ? · Issue #5496 · dotnet/corert · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.
This repository was archived by the owner on Nov 1, 2020. It is now read-only.
How to use the System.IO.Compression namespace ? #5496
@brunomlopes

Description

@brunomlopes

Say I've got the following core on a .net core console app:

        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            using(var stream = File.OpenRead(args[0]))
            using (var compressed = new ZipArchive(stream, ZipArchiveMode.Read))
            {
                foreach (var zipArchiveEntry in compressed.Entries)
                {
                    using (var fileStream = zipArchiveEntry.Open())
                    using (var outputStream = new MemoryStream())
                    {
                        fileStream.CopyTo(outputStream);
                    }

                    Console.WriteLine($"Wrote {zipArchiveEntry.FullName}");
                }
            }
        }

If I compile it with dotnet publish -c Release -r win-x64, and try to run it with CoreRt.TestCompression.exe ..\sample-zip.zip, it fails with

Unhandled Exception: System.IO.Compression.ZLibException: The underlying compression routine could not be loaded correctly. ---> System.DllNotFoundException: Unable to load DLL 'clrcompression.dll': The specified module could not be found.
   at CoreRt.TestCompresssion!<BaseAddress>+0x11d293
   at CoreRt.TestCompresssion!<BaseAddress>+0x11d1b0
   at Interop.zlib.inflateInit2_(Byte*, Int32, Byte*, Int32) + 0x42
   at Interop.zlib.InflateInit2_(ZLibNative.ZStream&, Int32) + 0x49
   at System.IO.Compression.ZLibNative.ZLibStreamHandle.InflateInit2_(Int32) + 0x29
   at System.IO.Compression.Inflater.InflateInit(Int32) + 0x40

From a quick search, this looks like clrcompression.dll is native code that doesn't get pulled in?
Is there anything I can do to work past this?

569A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0