We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

COMException on running MSTest V2 unit tests

Dear Aspose team,

We are having a very weird issue with Aspose.Pdf for .NET which is giving us a severe headache.
Our Unit Tests on CI build are failing arbitrarily with the following exception:

Failed System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize —> System.Runtime.InteropServices.COMException: An internal error occurred. (Exception from HRESULT: 0x8007054F)
at System.Security.Policy.PEFileEvidenceFactory.GetPublisherCertificate(SafePEFileHandle peFile, ObjectHandleOnStack retCertificate)
at System.Security.Policy.PEFileEvidenceFactory.GeneratePublisherEvidence()
at System.Security.Policy.PEFileEvidenceFactory.GenerateEvidence(Type evidenceType)
at System.Security.Policy.AssemblyEvidenceFactory.GenerateEvidence(Type evidenceType)
at System.Security.Policy.Evidence.GenerateHostEvidence(Type type, Boolean hostCanGenerate)
at System.Security.Policy.Evidence.GetHostEvidenceNoLock(Type type)
at System.Security.Policy.Evidence.GetHostEvidence(Type type, Boolean markDelayEvaluatedEvidenceUsed)
at System.Security.Policy.Evidence.GetHostEvidence(Type type)
at System.Security.Policy.AppDomainEvidenceFactory.GenerateEvidence(Type evidenceType)
at System.Security.Policy.Evidence.GenerateHostEvidence(Type type, Boolean hostCanGenerate)
at System.Security.Policy.Evidence.GetHostEvidenceNoLock(Type type)
at System.Security.Policy.Evidence.OnSerializing(StreamingContext context)

at System.AppDomain.get_Evidence()
at System.AppDomain.get_EvidenceNoDemand()
at System.AppDomain.get_Evidence()
at System.Configuration.ClientConfigPaths.GetEvidenceInfo(AppDomain appDomain, String exePath, String& typeName)
at System.Configuration.ClientConfigPaths.GetTypeAndHashSuffix(AppDomain appDomain, String exePath)
at System.Configuration.ClientConfigPaths…ctor(String exePath, Boolean includeUserConfig)
at System.Configuration.ClientConfigPaths.GetPaths(String exePath, Boolean includeUserConfig)
at System.Configuration.ClientConfigurationHost.get_ConfigPaths()
at System.Configuration.ClientConfigurationHost.RequireCompleteInit(IInternalConfigRecord record)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey, Boolean getLkg, Boolean checkPermission)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Xml.XmlConfiguration.XsltConfigSection.get_s_ProhibitDefaultUrlResolver()
at System.Xml.XmlConfiguration.XsltConfigSection.CreateDefaultResolver()
at System.Xml.Xsl.XslCompiledTransform.Load(XmlReader stylesheet)
at Aspose.Pdf.Document.BindXml(Stream xmlStream, Stream xslStream, XmlReaderSettings settings)
at Aspose.Pdf.Document.BindXml(Stream xmlStream, Stream xslStream)

Sometimes they pass, but most of the time not.
The biggest problem is that we are not able to reproduce the issue on our development machines.

Our current Aspose.Pdf production version: 8.8.1
We have also tried the latest one - 17.7.0 and are having the same issue.
We are using:

  • TFS 2017 Build Agent for our CI builds;
  • [vstest.console.exe] from Visual Studio 2017;
  • MSTest V2;
  • Windows Server 2012 R2 Standard;

One other thing to mention, everything was working fine on our old TFS 2013.

Could you please help us to sort this out?
Thank you
Best regards,

@dumitru.stirbu,
Thank you for contacting support. From the error details, it appears as it is an Operating System specific problem and may be caused by the critical system files fails to respond or starts missing. Please note, it is quite difficult for us to fix a defect/bug without replicating in our environment. Kindly share the complete details of the use case, including code snippet, source file, and list down the steps which you performed to see this error. We will investigate further and share our findings with you.

Best Regards,
Imran Rafique

@dumitru.stirbu,
Thank you for contacting support. Your application works fine in our environment. We can compile and run your project successfully. Please refer to a helping thread having the solution of similar error: Could not load file or assembly AdsDotNet or one of its dependencies The parameter is incorrect Exception

Best Regards,
Imran Rafique

@dumitru.stirbu,
We have tested your unit test project in our environment, and it is working fine. Please upgrade the version of Aspose.Pdf for .NET DLL to the latest version 17.7, and then let us know how that goes on your side. You are using quite an old version.

Best Regards,
Imran Rafique