Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better message when ZipFile throws NotSupportedException #3128

Merged
merged 1 commit into from
Aug 2, 2020

Conversation

HebaruSan
Copy link
Member

Problem

See #3066 and #3123; if Mono users in a non-en_US locale don't install mono-complete, this exception can be thrown:

System.NotSupportedException: Encoding 852 data could not be found. Make sure you have correct international codeset assembly installed and enabled.
  at System.Text.Encoding.GetEncoding (System.Int32 codepage) [0x0024d] in <12b418a7818c4ca0893feeaaf67f1e7f>:0 
  at ICSharpCode.SharpZipLib.Zip.ZipConstants.ConvertToString (System.Byte[] data, System.Int32 count) [0x00017] in <29fa7683355b471a9cc202367184a830>:0 
  at ICSharpCode.SharpZipLib.Zip.ZipConstants.ConvertToStringExt (System.Int32 flags, System.Byte[] data, System.Int32 count) [0x00032] in <29fa7683355b471a9cc202367184a830>:0 
  at ICSharpCode.SharpZipLib.Zip.ZipFile.ReadEntries () [0x00312] in <29fa7683355b471a9cc202367184a830>:0 
  at ICSharpCode.SharpZipLib.Zip.ZipFile..ctor (System.String name) [0x0006b] in <29fa7683355b471a9cc202367184a830>:0 
  at CKAN.NetFileCache.ZipValid (System.String filename, System.String& invalidReason) [0x00003] in <29fa7683355b471a9cc202367184a830>:0 

Cause

SharpZipLib apparently uses some kind of locale-specific code in its ZIP validation logic, which does not like being called without the locale data installed.

Changes

Now we catch that exception on Mono and tell the user to install mono-complete. The mod installation will still fail, because we need to confirm the file is valid, and we can't do that if this is thrown.

@HebaruSan HebaruSan added Core (ckan.dll) Issues affecting the core part of CKAN Pull request Linux Issues specific for Linux Mono Issues specific for Mono labels Jul 27, 2020
@HebaruSan HebaruSan changed the title Better message when ZipFile.TestArchive throws NotSupportedException Better message when ZipFile throws NotSupportedException Jul 27, 2020
Copy link
Member

@DasSkelett DasSkelett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inserted throw new NotSupportedException() manually since I didn't wan't to uninstall mono-complete, and there it works. Good enough for me.

@HebaruSan HebaruSan merged commit a0858d6 into KSP-CKAN:master Aug 2, 2020
@HebaruSan HebaruSan deleted the fix/not-supported-exception branch November 7, 2020 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core (ckan.dll) Issues affecting the core part of CKAN Linux Issues specific for Linux Mono Issues specific for Mono
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants