Error with net472 and v0.25 #397

Closed
opened 2026-01-29 22:11:16 +00:00 by claunia · 7 comments
Owner

Originally created by @zplan on GitHub (May 14, 2020).

I have a net472 wpf application which references my own netstandard2.0 library. This library uses sharpcompress.

After updating sharpcompress to 0.25 in my library, the application is crashing.
Was this the intention of v0.25 that there is no support anymore for net472 framwork?

Error trace:
Pre-bind state information:
LOG: DisplayName = System.Text.Encoding.CodePages, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase = file:///C:/MyProject/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : SharpCompress, Version=0.25.0.0, Culture=neutral, PublicKeyToken=afb0a02973931d96.
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\MyProject\bin\Debug\MyProject.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Text.Encoding.CodePages, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: Attempting download of new URL file:///C:/MyProject/bin/Debug/System.Text.Encoding.CodePages.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Minor Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

Originally created by @zplan on GitHub (May 14, 2020). I have a net472 wpf application which references my own netstandard2.0 library. This library uses sharpcompress. After updating sharpcompress to 0.25 in my library, the application is crashing. Was this the intention of v0.25 that there is no support anymore for net472 framwork? Error trace: Pre-bind state information: LOG: DisplayName = System.Text.Encoding.CodePages, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (Fully-specified) LOG: Appbase = file:///C:/MyProject/bin/Debug/ LOG: Initial PrivatePath = NULL Calling assembly : SharpCompress, Version=0.25.0.0, Culture=neutral, PublicKeyToken=afb0a02973931d96. LOG: This bind starts in default load context. LOG: Using application configuration file: C:\MyProject\bin\Debug\MyProject.exe.Config LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config. LOG: Post-policy reference: System.Text.Encoding.CodePages, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a LOG: Attempting download of new URL file:///C:/MyProject/bin/Debug/System.Text.Encoding.CodePages.DLL. WRN: Comparing the assembly name resulted in the mismatch: Minor Version ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
claunia added the bug label 2026-01-29 22:11:16 +00:00
Author
Owner

@adamhathcock commented on GitHub (May 14, 2020):

https://www.nuget.org/packages/SharpCompress/

Nuget clearly spells out what is supported and what the dependencies are. If your app is missing a file then I don’t know what to tell you.

@adamhathcock commented on GitHub (May 14, 2020): https://www.nuget.org/packages/SharpCompress/ Nuget clearly spells out what is supported and what the dependencies are. If your app is missing a file then I don’t know what to tell you.
Author
Owner

@zplan commented on GitHub (May 14, 2020):

Thanks for your fast response.
I forget to mention that System.Text.Encoding.CodePages.DLL is in the debug folder, but all versions I tried (4.7.1/4.7.0/4.6.1/4.5.0/4.0.1/4.0.0...) were not successful --> error still occurs
And there is no 4.0.2 version on nuget org.

Error from the logger:
System.TypeInitializationException: The type initializer for 'SharpCompress.Common.ArchiveEncoding' threw an exception. ---> System.IO.FileLoadException: Could not load file or assembly 'System.Text.Encoding.CodePages, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at SharpCompress.Common.ArchiveEncoding..cctor()

with:
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.1" />

@zplan commented on GitHub (May 14, 2020): Thanks for your fast response. I forget to mention that System.Text.Encoding.CodePages.DLL is in the debug folder, but all versions I tried (4.7.1/4.7.0/4.6.1/4.5.0/4.0.1/4.0.0...) were not successful --> error still occurs And there is no 4.0.2 version on nuget org. Error from the logger: System.TypeInitializationException: The type initializer for 'SharpCompress.Common.ArchiveEncoding' threw an exception. ---> System.IO.FileLoadException: Could not load file or assembly 'System.Text.Encoding.CodePages, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) at SharpCompress.Common.ArchiveEncoding..cctor() with: `<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.1" />`
Author
Owner

@adamhathcock commented on GitHub (May 14, 2020):

Seems like it's been built wrongly unless it's something silly like full framework is trying to use the netstandard20 reference when it should be using the net46 one.

Unfortunately, I don't have windows so I wont be able to help.

0.24 works fine for you?

@adamhathcock commented on GitHub (May 14, 2020): Seems like it's been built wrongly unless it's something silly like full framework is trying to use the netstandard20 reference when it should be using the net46 one. Unfortunately, I don't have windows so I wont be able to help. 0.24 works fine for you?
Author
Owner

@zplan commented on GitHub (May 14, 2020):

0.24 works fine for you?

Yes. error occured when I updated from 0.24 to 0.25

@zplan commented on GitHub (May 14, 2020): > 0.24 works fine for you? Yes. error occured when I updated from 0.24 to 0.25
Author
Owner

@adamhathcock commented on GitHub (May 14, 2020):

I think I need to exclude the CodePages DLL just like in 0.24: https://github.com/adamhathcock/sharpcompress/pull/512

@adamhathcock commented on GitHub (May 14, 2020): I think I need to exclude the CodePages DLL just like in 0.24: https://github.com/adamhathcock/sharpcompress/pull/512
Author
Owner

@adamhathcock commented on GitHub (May 22, 2020):

Released in https://www.nuget.org/packages/sharpcompress/0.25.1

@adamhathcock commented on GitHub (May 22, 2020): Released in https://www.nuget.org/packages/sharpcompress/0.25.1
Author
Owner

@zplan commented on GitHub (May 26, 2020):

Released in https://www.nuget.org/packages/sharpcompress/0.25.1

Thanks! --> It is working again.

@zplan commented on GitHub (May 26, 2020): > Released in https://www.nuget.org/packages/sharpcompress/0.25.1 Thanks! --> It is working again.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#397