Free Support Forum -

Mime Import problem

Needed files (879 Bytes)

When trying to load the attached MIME message, it works correctly on all machines I tried except one.

I use this code (Aspose.Email version 17.8):

MailMessage.Load(new MemoryStream(EmlBytes))

On that machine, I get the following error:

System.TypeInitializationException: The type initializer for ‘#=qsWMdio9nBims3kCKVYZNfsUypvlBwhHABNBr$e73e2arUShRn1pkdk4Ixn8sL7YW’ threw an exception. —> System.NullReferenceException: Object reference not set to an instance of an object.
at #=qsWMdio9nBims3kCKVYZNfsUypvlBwhHABNBr$e73e2arUShRn1pkdk4Ixn8sL7YW…ctor(#=qZQsGIPMhcympir1qUMPCTocv_t2sRD2xk29iUqZMerScmSb3MZybgM1Clz7bLy11 #=qyKHoo$TVPpl8UqscSKkdcw==)
at #=qsWMdio9nBims3kCKVYZNfsUypvlBwhHABNBr$e73e2arUShRn1pkdk4Ixn8sL7YW…cctor()
— End of inner exception stack trace —
at #=qsWMdio9nBims3kCKVYZNfsUypvlBwhHABNBr$e73e2arUShRn1pkdk4Ixn8sL7YW.#=q8q2ONoY3AsKW5ow_DHLRmj4k5_37auRAOhR619u9_70=()
at #=qTXBj9OBRHzs21VWvjk53m8CLFQsb2$tv4nx$c1BpZe2XpvvSIzlM8SvjVYY4S_Ra52s2PGw6HgPUtbPz7pHCUA==…ctor(String #=qj8lhyAaO2rqOYM_iNBvbMA==, #=q7$8K_kn8zWOOcviVytmXCVzZdsL93biblkGyrvXIsZZmBwza2CAfY4TAyIruTiKwLeDyF2R7AGEVjnZKzHWO7A== #=qWUiDtl4_80tn6nXsyKTEQw==)
at #=qPDBihoLgVByuo6Gvg9AdumpGGyT9faIX9gU0W6YW0XggAaSZrV7Y0SpwPpQQU$xaSIw8BMvZjwoMsKKkAdmFVQ==…ctor(#=q7$8K_kn8zWOOcviVytmXCVzZdsL93biblkGyrvXIsZZmBwza2CAfY4TAyIruTiKwLeDyF2R7AGEVjnZKzHWO7A== #=q$1dmxjKLc9KUOhDppikkwQ==, String #=quaZBZDRuwiF5t1ZHq2x7mw==)
at #=qMl0cPxOoUbAGpCOn$IQtBuJ_JdiSGxjnQ$k1gweoRVu1s0W9dBDxe6U_Z28fa7AEJJsj4ihzgHxIDHfT7rLkDA==.#=qhdMM00riOl5LFkj0ZP83yg==.#=qkdqZ4GTUUM2ajZATGPByKQ==(String #=qj8lhyAaO2rqOYM_iNBvbMA==, #=q7$8K_kn8zWOOcviVytmXCVzZdsL93biblkGyrvXIsZZmBwza2CAfY4TAyIruTiKwLeDyF2R7AGEVjnZKzHWO7A== #=qWUiDtl4_80tn6nXsyKTEQw==, String #=qIhwoSnHs05oP4dkWwe5Oiw==)
at #=qMl0cPxOoUbAGpCOn$IQtBuJ_JdiSGxjnQ$k1gweoRVu1s0W9dBDxe6U_Z28fa7AEJJsj4ihzgHxIDHfT7rLkDA==.#=qkdqZ4GTUUM2ajZATGPByKQ==(String #=qj8lhyAaO2rqOYM_iNBvbMA==, #=q7$8K_kn8zWOOcviVytmXCVzZdsL93biblkGyrvXIsZZmBwza2CAfY4TAyIruTiKwLeDyF2R7AGEVjnZKzHWO7A== #=qWUiDtl4_80tn6nXsyKTEQw==, String #=q9zqEadktmS9cTJsIWfjMng==)
at #=q_B0KkXCPKWftrhW6OnAx52k3prEMz35Koh0$r4V9Ll23mzQDCzLu$1bLPBWIGk98NydCZXrI8Wnml5wc5$GUSg==.#=qcpVd_AIrzG6$RFMZWy$3Gg==(List`1 #=q7_IQJpjyxwqCqg9DjvjBpQ==)
at #=qCgQIe2wX06w30fDa61HPXFnRjOxhx73WtqJjdEz0C5GWJvCQIjNFL48fkeapZ$oU.#=qZTBjqRxuEdUh52HYiqeo3wz6VdIThiZ6ixq90mg6uNs=(Stream #=qp08373Lw4tf2AeNHDivFYA==, Boolean #=qeEA0uOguTJGCEeNiiJxbCg==)
at #=qCgQIe2wX06w30fDa61HPXFnRjOxhx73WtqJjdEz0C5GWJvCQIjNFL48fkeapZ$oU.#=q$hFJ0FR2cT_KvY2ABr1ZIA==(Stream #=qp08373Lw4tf2AeNHDivFYA==, Boolean #=qeEA0uOguTJGCEeNiiJxbCg==)
at Aspose.Email.MailMessage.#=qt2MBPaYPe3CtyXzVddSwXKZLUUZBw2JVSArOmNarqqw=()
at Aspose.Email.MailMessage.#=qV6tROuMzr3EdrXvDIKWMCQ==(#=qKJlQUlR45bbLLscJi6OnAmihuBTo2cP74voH1vWa7dSiqsF5xduKWkiPtYB4OX0h #=quvH4oIa2RvkNG48y8d38zA==)
at Aspose.Email.MailMessage.#=qmI6TMknlstIYUJbwRPRo08_1aSK3CPZPJ8z457wDyVM=(#=qoACXPzd6D1mQSY0zZ0MME_6ZQXS8gMscTbVS9CuKUic= #=quvH4oIa2RvkNG48y8d38zA==)
at Aspose.Email.MailMessage.#=qu5YDTLL$orWJWKbiQMMD4Yl4lSR5hQ_Vd24sdSnT0KM=(#=qoACXPzd6D1mQSY0zZ0MME_6ZQXS8gMscTbVS9CuKUic= #=quvH4oIa2RvkNG48y8d38zA==, Boolean #=qOzp_lhsAYRyeWAZKPRtPBg==)
at Aspose.Email.MailMessage…ctor(#=qoACXPzd6D1mQSY0zZ0MME_6ZQXS8gMscTbVS9CuKUic= #=quvH4oIa2RvkNG48y8d38zA==, Boolean #=q$cYD$MzASE0XCSuOD$yL3A==, Boolean #=qOzp_lhsAYRyeWAZKPRtPBg==, Boolean #=qDG4KBmKqOhO5ILo__avZbuIO7SfbTanCUhUraBeEWvw=)
at Aspose.Email.MailMessage.#=qwdFW6fxgFDwlXHZQIXxGmg==(Stream #=qp08373Lw4tf2AeNHDivFYA==, EmlLoadOptions #=qH4y6pd7FSTXicaBizHVcqA==)
at Aspose.Email.MailMessage.#=qFzvOhnh4ezRI0SbB4Kpwb0CpBqakAm51hvc$P6TuJmc=(Stream #=qp08373Lw4tf2AeNHDivFYA==, LoadOptions #=qH4y6pd7FSTXicaBizHVcqA==)
at Aspose.Email.MailMessage.Load(Stream stream)
at ConsoleApp15.Program.Main(String[] args) in C:\Users\Administrator\documents\visual studio 2017\Projects\ConsoleApp15\ConsoleApp15\Program.cs:line 25


We have evaluated the shared EML file. We are able to successfully load and read the EML message on different machines. Please share more details about the machine on which it is creating issue like which OS it has? and any additional information that can help us to reproduce the issue.

Dear Ikram,

Actually we face the same problem when we try to reproduce, which is that we cannot reproduce on identical machines. That is why we attached the stack trace hoping that you can at least give us what might cause this issue to appear. Anyway, I am attaching the environment details, and if you can figure, one or more reasons from the stacktrace that might cause this exception to appear, please let us know.


env1.png (8.7 KB)
env2.png (33.8 KB)
env3.png (34.1 KB)


The issue doesn’t occur even on another machine at our end. Please spare us little time so that we can discuss the stack trace with our Product team for any helpful information in this regard. We’ll write back here once there is some information available in this regard.


Could you please share more details about the culture used in your environment? Also, please share your timezone information on this particular machine where the issue is raised.


In addition, could you please try loading the attached EML files using MailMessage on the problematic PC? This will give us an idea which one raises exception and we’ll be able to investigate the issue further at our end. (2.5 KB)

The three messages attached failed with the same error.

As for the previous request, I attached what you need.

culture.jpg (52.2 KB)
timezone.jpg (46.0 KB)
region_language.jpg (56.1 KB)


Thank you for sharing these results. We’ll get back to you once we have further information available in this regard.

This issue appeared again and reproducible at another machine. I have attached the pst file with 4 messages and sample code.

So basically, we have a pst file that has 4 messages, we read the messages as MapiMessage and when trying to convert them to MailMessage using mapiMessage.ToMailMessage it throws TypeInitializationException exception. (160 Bytes) (386 Bytes)


Thank you for providing sample files. It seems that you have sent us wrong zip file as it contains 0 byte PST file. Could you please share the correct PST file for our analysis here? It will help us to observe the issue and provide assistance accordingly.

Attached (142.9 KB)


Thank you for sharing the sample file. I am afraid that this issue is not reproduced on any of the available machines. You may please try the latest version and share the feedback. I am afraid that without re-producing the issue here, it is not possible for us to provide assistance. You may please provide steps to re-produce the issue here for our analysis.

we have successfully we able to reproduce this issue in all machines, the trick is to change the machine time zone to UTC+2:00 Gaza, Hebron. this is the only time zone that cause this issue to happen. This is a problem for us because we have customers in this time zone getting this issue. Please re-try to reproduce and tell us the results.


We changed our system timezone to UTC+2 and executed the following code, but are still not able to reproduce the problem with the latest version of Aspose.Email for .NET 18.2. Can you please share a sample console application with your code that we can run at our end for reproducing the issue? This will help us investigate the problem further in detail.

Sample Code

PersonalStorage pst = PersonalStorage.FromFile("161307\\Failed-Messages.pst");

var folderInfo = pst.RootFolder.GetSubFolder("Inbox");
var msgsCollection = folderInfo.GetContents();// pst.GetPredefinedFolder(StandardIpmFolder.Inbox).GetContents();

foreach (var msgInfo in msgsCollection)
    pst.ExtractMessage(msgInfo).ToMailMessage(new MailConversionOptions());


@kashif.iqbal, here is the download link for a console application that show the problem still exists with Aspose 18.2.
The issue only happens if the time zone is UTC+2 Gaza, Hebron, other UTC+2 time zones work fine, only the Gaza,Hebron timezone is the one not working


Thank you for sharing the steps that helped reproduce the issue at our end. It has been logged as EMAILNET-38940 for further investigation at our end. We’ll update you here once there is some update or a fix version available in this regard

Can you share technical details on how your team are going to fix that, because our technical team find this issue very strange and we don’t want the solution to effect other things. We find it very strange why this specific time zone makes the issue appear.


The issue has been logged too recently and no further details are available as of now about it. The issue shouldn’t have occurred with the time zone. We’ll share technical details of the problem as it is sorted out and appreciate your patience until then.

when should be expect a fix for this issue?


The issue is currently under investigation but no definite timeline is available for its resolution. We’ll update you here once some information is available about its fix version.