The type initializer for '\u0006?' threw an exception

Hello,


I’m trying to load an msg file via the ASpose.Email product.

I’m running this code:
var message = MailMessage.Load(pathToFile);

and I immediately receive exception:

System.TypeInitializationException was unhandled by user code
HResult=-2146233036
Message=The type initializer for ’ ’ threw an exception.
Source=Aspose.Email
TypeName=
StackTrace:
at . (String , & )
at . (String , Encoding& )
at . (String )
at Aspose.Email.Mail.MailAddress…ctor(String , String , UInt32 )
at . (String , Int32& , Boolean )
at Aspose.Email.Mail.MailAddressCollection. (String , Boolean )
at Aspose.Email.Mail.MailAddressCollection. (String , Boolean )
at . ( , Encoding )
at Aspose.Email.Mime.HeaderCollection. ( , Encoding )
at . ()
at . (List`1 , Byte[] )
at . ()
at Aspose.Email.Mail.MailMessage. (Stream )
at Aspose.Email.Outlook.MailMessageInterpretor.LoadMessageHeader(MailMessage mailmessage, MapiMessage mapiMessage)
at Aspose.Email.Outlook.MailMessageInterpretor.Interpret(MapiMessage mapiMessage)
at Aspose.Email.Mail.MailMessage. (Stream , MsgLoadOptions )
at Aspose.Email.Mail.MailMessage. (Stream , LoadOptions )
at Aspose.Email.Mail.MailMessage.Load(Stream stream)
at Aspose.Email.Mail.MailMessage.Load(String fileName)
at PDF.js.Controllers.HomeController.GetFile(String file) in C:\Users\5lukwas\Documents\Visual Studio 2015\Projects\PDF.js\src\PDF.js\Controllers\HomeController.cs:line 46
InnerException:
HResult=-2146233036
Message=The type initializer for ’ ’ threw an exception.
Source=Aspose.Email
TypeName=
StackTrace:
at . (String )
at …cctor()
InnerException:
FileName=zx_9a1fe16f546a416facc09411015ccf75, PublicKeyToken=716fcc553a201e56
FusionLog=""
HResult=-2147024809
Message=Could not load file or assembly ‘zx_9a1fe16f546a416facc09411015ccf75, PublicKeyToken=716fcc553a201e56’ or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
Source=mscorlib
StackTrace:
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at ​ . . ()
at ​ . (Object , ResolveEventArgs )
at System.AppDomain.OnResourceResolveEvent(RuntimeAssembly assembly, String resourceName)
at System.Reflection.RuntimeAssembly.GetResource(RuntimeAssembly assembly, String resourceName, UInt64& length, StackCrawlMarkHandle stackMark, Boolean skipSecurityCheck)
at System.Reflection.RuntimeAssembly.GetManifestResourceStream(String name, StackCrawlMark& stackMark, Boolean skipSecurityCheck)
at System.Reflection.RuntimeAssembly.GetManifestResourceStream(String name)
at ​ . (Assembly , Type , String )
at . (String )
at . (String )
at …cctor()
InnerException:
HResult=-2147024809
Message=The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
Source=mscorlib
StackTrace:
at System.AppDomain.nApplyPolicy(AssemblyName an)
at System.AppDomain.ApplyPolicy(String assemblyName)
at Microsoft.Dnx.Runtime.Loader.LoadContext.ResolveAssembly(Object sender, ResolveEventArgs args)
at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
InnerException:

I suppose it because there is a unicode sign \u0006 ? This happens with every email I save from my outlook 2016. I’ve added a sample msg file as an attachment.

Can you help me with this?

Regards,
Lukasz

Hi Łukasz,

Thank you for contacting Aspose Support team.

Please try it with the latest version of Aspose.Email for .NET 6.2.0 as I was not able to face any problem while testing with this version and the following code sample.

Sample Code:

MailMessage msg = MailMessage.Load(“693868\sample.msg”, new MsgLoadOptions());

Hello Kashif,


I have the new Aspose Total downloaded. I tried to make a small console app for this and it worked. For the solution I seek I’m using the ASP.NET 5 MVC 6 project (vNEXT). Is the Aspose.Email compatible with this technology? While converting in the controller I get this error.

Regards,
Lukasz

Hi Lukasz,


Thank you for contacting Aspose support team.

Aspose.Email works fine with ASP.NET and MVC. I have checked the scenario in a ASP .NET MVC 5 project and observed no issue. Message is loaded successfully from the disc. Could you please give a try to the attached project and let us know the feedback? If this project works fine, please send us your sample project for testing here.

Hello Kashif,


The sample you provided work, But have my application in the newest version of the framework.

My same is in ASP.NET 5 MVC 6, now renamed to .NET Core 1.
Its still a release candidate and I’m using the 1.0.0-rc1-update1 DNX.

I’ve provided a sample that reproduces my issue.

Is your product compatible with this version? If not are there any dates when it will compatible?

Regards,
Lukasz

Hi Lukasz,

Thank you for sharing the sample project that we could use to reproduce the problem at our end. It seems the issue is with MailMessage API only as the same MSG file can be loaded fine with MapiMessage API of Aspose.Email. We have logged this as EMAILNET-35134 in our bug tracking system for further investigation by our Product team and will update you here once there is some information available in this regard.

I am also having the same issue. Please let me know when this bug has been fix.

Thanks.

Hi Gabriel

Support for .NET Core is not available for now and the issue is still pending. We’ll update you here once there is further information available in this regard.

Is there an update for EMAILNET-35134?

Hi Michael,


This issue is still pending due to some complexities involved in the resolution. Product team is considering this issue and we will notify on forum immediately when any update is received in this regard.