问题
I'm trying to merge vintasoft barcode sdk with my data access dll and it's not working after ilmerge. Any ideas are welcome
here is the error:
IndexOutOfRangeException: Index was outside the bounds of the array.] 2.┌.©(Byte[] param0) in :0 2.┌..cctor() in :0 [TypeInitializationException: The type initializer for '2.┌' threw an exception.] 2.┌.¥Σ() in :0 Vintasoft.Barcode.WriterSettings..cctor() in :0 [TypeInitializationException: The type initializer for 'Vintasoft.Barcode.WriterSettings' threw an exception.] Vintasoft.Barcode.WriterSettings..ctor() in :0 Vintasoft.Barcode.BarcodeWriter..ctor() in :0 _Default.buttonGenerateBarcode_Click(Object sender, EventArgs e) in E:\ILMergeSample\WebBarcodeWriterDemo\QRBarcode.aspx.vb:27 System.EventHandler.Invoke(Object sender, EventArgs e) +0 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
Thanks in advance
回答1:
You are trying to merge an obfuscated assembly. Chances are good, it wont work at all.
回答2:
Like leppie said, merging obfuscated assemblies usually leads to problems.
One alternative is to stick the offending dll into an embedded resource, and load it from there using
byte [] bytes = Resources.SomeAssemblyDll;
Assembly.Load(bytes);
We do it on demand in our AppDomain's assembly resolver:
AppDomain.CurrentDomain.AssemblyResolve += new
ResolveEventHandler(CurrentDomain_AssemblyResolve);
where we test what assembly the framework is looking for, and if needed load it from the embedded resource.
来源:https://stackoverflow.com/questions/4601357/need-ilmerge-hint