Tom*_*Tom 6 c# macos mono zip xamarin
为了在不需要用户安装单声道框架的情况下分发我们的应用程序,我们使用MonoKickstart在运行时动态链接Mono库.我们正在使用Ionic.Zip库在应用程序启动时提取存档.默认情况下,此库使用IBM437编码.但是,它无法加载此编码,如以下异常所示:
System.NotSupportedException: No data is available for encoding 437.
at System.Text.Encoding.GetEncoding (Int32 codepage) <0x10a0d9970 + 0x0076e> in <filename unknown>:0
Run Code Online (Sandbox Code Playgroud)
此默认编码是静态初始化的,因此即使我们指定了不同的编码,仍会发生异常.
如果我们将I18N.dll和I18N.West.dll库包含到动态加载的库中,则会发生以下异常:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidProgramException: Invalid IL code in I18N.Common.Manager:get_PrimaryManager (): IL_0000: ret
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) <0x11b3340e0 + 0x000bb> in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) <0x11b3340e0 + 0x00139> in <filename unknown>:0
at System.RuntimeType.InvokeMember (System.String name, BindingFlags bindingFlags, System.Reflection.Binder binder, System.Object target, System.Object[] providedArgs, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, System.String[] namedParams) <0x11b332300 + 0x011b7> in <filename unknown>:0
at System.Text.EncodingHelper.InvokeI18N (System.String name, System.Object[] args) <0x11b32fa10 + 0x00317> in <filename unknown>:0
at System.Text.Encoding.GetEncoding (Int32 codepage) <0x111378970 + 0x00671> in <filename unknown>:0
Run Code Online (Sandbox Code Playgroud)
我们也无法自己创建编码,所以这肯定是个问题.
有没有办法通过添加正确的库来修复编码的加载,或者我们可以以某种方式阻止编码完全初始化(无需为自己重新编译库).
我们当前动态加载的dll列表是:
Ionic.Zip.Reduced.dll
Mono.Posix.dll
Mono.Security.dll
mscorlib.dll
System.Configuration.dll
System.Core.dll
System.Data.dll
System.dll
System.Drawing.dll
System.Net.dll
System.Numerics.dll
System.Runtime.Serialization.dll
System.Security.dll
System.Xml.dll
System.Xml.Linq.dll
WindowsBase.dll
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2441 次 |
| 最近记录: |