Problem with Aspose.Pdf.SetLicense

Hi,

I’m getting the following exception when I try to set the Aspose.Pdf license file:

System.IO.FileLoadException: The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase,Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at ..?(Object , ResolveEventArgs )
at System.AppDomain.OnResourceResolveEvent(String resourceName)
at System.Reflection.Assembly._GetResource(String resourceName, UInt64& length, StackCrawlMark& stackMark, Boolean skipSecurityCheck)
at System.Reflection.Assembly.GetManifestResourceStream(String name, StackCrawlMark& stackMark, Boolean skipSecurityCheck)
at System.Reflection.Assembly.GetManifestResourceStream(String name)
at ♣☻.♦☻.?(Assembly , String )
at ♣☻.♦☻.?()
at ♣☻.♦☻.?(Stream )
at ♣☻.♦☻.?(String , Assembly )
at Aspose.Pdf.License.SetLicense(String licenseName)
at WorkflowScriptbd39e5ec5aae4512aa140209d3116e43.Run(Int32 ExecutionId, Int32 ExecutionDetailsId, Context ctx, Action action, String inlink)

The Aspose.Pdf.dll file is being referenced from the GAC, and I can successfully load the Email license from the same script.

I’m able to successfully load the license file from a quick command-line test application on the same machine. The problem comes when I need to load the library from a C# “script” inside a workflow engine. This script is dynamically compiled by the engine when it runs. I know the workflow engine keeps a cache of the DLLs it loads, and I suspect that the engine does a lot of its own tricks involving assembly loading for its plugins and scripts. (I noticed that there’s an OnResourceResolveEvent handler, so it might be a conflict between these two bits of code.)

If I run the .NET SDK Fusion Log, the messages show that the Aspose.Pdf dll is being loaded by the ShadowTempDefault AppDomain, rather than the main WFEngine.exe appdomain. There is also a message in the Fusion logs about Aspose.Pdf trying to load an assembly called {35a28b1e-d8ea-4f68-ada1-53b4c978f1a1}.dll which doesn’t exist. I can attach these logs if necessary.

I believe that this is a similar issue to

https://forum.aspose.com/t/104313

in that we're both trying to use the Aspose.PDF library in a "hosted" program.

Thanks,

Andrew

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";}

<![endif]–>

Hi Andrew,


Thanks for using our products.

We are working over this query and will get back to you soon. We are sorry for this inconvenience.

Hi Andrew,

Sorry for the inconvenience faced. Could you please confirm Aspose.Pdf version you are using and your working environment? It would help us to investigate the issue at our end.

Best Regards,

We are using Aspose.Pdf 7.6.0.0. We are using Server 2008 R2, and I believe our third-party workflow engine uses .NET 3.5. I believe that the workflow engine is using the “Shadow Copying” feature of .NET:

http://msdn.microsoft.com/en-us/library/ms404279.aspx

Thanks,

Andrew

Hi Andrew,


Thanks for providing additional Information. We are checking the scenario and will get back to you with the results.

Best Regards,

Hi,

I just wanted to check in and see if there was an update on this issue.

Thanks,

Andrew

Hi Andrew,


Please accept my apologies for the delayed response. While referencing Aspose.Pdf for .Net 7.7.0 from GAC on Windows server 2008, I’m unable to reproduce the issue. Could you please download and try latest release Aspose.Pdf for .Net 7.7.0?

If issue persist then can you please share the C# script using for setting license and information about your workflow to replicate the issue at our end?

Thanks for your patience and cooperation.

Best Regards,

Hi,

I think the key issue is the workflow engine is using shadow caching of assemblies - were you able to test in a similar environment?

I’ll try the new version and see if that fixes the problem.

Thanks,

Andrew

Hi,

I appear to have been using Aspose.Pdf 7.3, not 7.6, when I encountered the original issue. 7.3 doesn’t work, but if I switch to 7.6 or 7.7 it seems to work correctly. Thanks for your help.

-Andrew

Hi Andrew,


Thanks for your feedback and it’s good to know that you have managed to resolve the issue.

Please feel free to contact us for any further assistance.

Best Regards,