mstum/Simplexcel

TypeInitializationException with v3.0.0

tipa opened this issue · 2 comments

tipa commented

With Simplexcel v3.0.0 I am running into exceptions when building my app in Release-Mode.

Xamarin.Android:

System.TypeInitializationException: The type initializer for 'Simplexcel.SimplexcelVersion' threw an exception. ---> System.IO.FileNotFoundException: Simplexcel.dll
at System.Diagnostics.FileVersionInfo.GetVersionInfo (System.String fileName) <0x6f73086bc8 + 0x000fc> in <e0002483da9347d790cb4bc782ce44a7>:0 
at Simplexcel.SimplexcelVersion..cctor () <0x6f71793d20 + 0x0005b> in <c2d8b95c35a1425e971032ecb3ce33cb>:0 
--- End of inner exception stack trace ---
at Simplexcel.SimplexcelVersion.get_Version () <0x6f71793cbc + 0x00040> in <c2d8b95c35a1425e971032ecb3ce33cb>:0 
at Simplexcel.XlsxInternal.XlsxPackage.WriteInfoXmlFile (Simplexcel.XlsxInternal.ZipPackage pkg) <0x6f71799220 + 0x0019f> in <c2d8b95c35a1425e971032ecb3ce33cb>:0 
at Simplexcel.XlsxInternal.XlsxPackage.SaveToStream (System.IO.Stream outputStream, System.Boolean compress) [0x00026] in <c2d8b95c35a1425e971032ecb3ce33cb>:0 
at Simplexcel.XlsxInternal.XlsxWriter+XlsxWriterInternal.Save (Simplexcel.Workbook workbook, System.IO.Stream outputStream, System.Boolean compress) <0x6f71799c70 + 0x002f7> in <c2d8b95c35a1425e971032ecb3ce33cb>:0 
at Simplexcel.Workbook.Save (System.IO.Stream stream, System.Boolean compress) <0x6f71793ff8 + 0x000a3> in <c2d8b95c35a1425e971032ecb3ce33cb>:0 

UWP:

System.TypeInitializationException: A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property. ---> System.ArgumentException: The path is empty.
Parameter name: path
   at System.IO.Path.GetFullPath(String) + 0xf4
   at System.Diagnostics.FileVersionInfo.GetVersionInfo(String) + 0x1b
   at Simplexcel.SimplexcelVersion..cctor() + 0x3a
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0xf1

   --- End of inner exception stack trace ---
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x1ad
   at System.Runtime.CompilerServices.ClassConstructorRunner.CheckStaticClassConstruction(Void*, StaticClassConstructionContext*) + 0xf
   at Simplexcel.XlsxInternal.XlsxPackage.WriteInfoXmlFile(ZipPackage) + 0x18c
   at Simplexcel.XlsxInternal.XlsxPackage.SaveToStream(Stream, Boolean) + 0x78
   at Simplexcel.XlsxInternal.XlsxWriter.XlsxWriterInternal.Save(Workbook, Stream, Boolean) + 0x4af
   at Simplexcel.XlsxInternal.XlsxWriter.Save(Workbook, Stream, Boolean) + 0x13
   at Simplexcel.Workbook.Save(Stream, Boolean) + 0x9a
mstum commented

I've committed a fix to master, and a Pre-Release/Dev Nuget package is available here (you can download the package.nupkg): https://github.com/mstum/Simplexcel/packages/48179?version=3.0.1.183-master

I'll try it out in a Xamarin.Android app and publish it to Nuget.org in a bit.

mstum commented

Version 3.0.1.184 published to nuget.org: https://www.nuget.org/packages/simplexcel/