开发者

Need ILMerge hint

开发者 https://www.devze.com 2023-02-03 02:26 出处:网络
I\'m trying to merge vintasoft barcode sdk with my data access dll and it\'s not working after ilmerge. Any ideas are welcome

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 exc开发者_运维问答eption.]
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


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.


You are trying to merge an obfuscated assembly. Chances are good, it wont work at all.

0

精彩评论

暂无评论...
验证码 换一张
取 消