简体   繁体   English

NPOI在打开文件时引发异常,但仅在发布模式下

[英]Exception thrown in NPOI while opening a file, but only in release mode

I just made a class that can translate an Excel file into a list of C# objects. 我刚刚制作了一个可以将Excel文件转换为C#对象列表的类。 I am currently working on Xamarin.Android. 我目前正在使用Xamarin.Android。 All worked fine in debug mode, the file was opening correctly. 在调试模式下一切正常,文件已正确打开。 But when I changed to release mode, it just crashes without any exception message, but only the stacktrace (that I don't understand :s) 但是,当我更改为发布模式时,它崩溃了,没有任何异常消息,而只有stacktrace(我不理解:s)

I believe my permissions are correctly setup, I checked them in the application settings. 我相信我的权限设置正确,我在应用程序设置中检查了它们。

I tried with a Windows application, it works. 我尝试使用Windows应用程序,它可以工作。

I tried to change the file's location, but nothing changed. 我试图更改文件的位置,但没有任何更改。

try
{
     book = new XSSFWorkbook(filePath.GetStream());
}
catch (Exception e) // Exception without message
{
    onResult(new SyncProductsSummary(false, 0, 0, e));
    return;
}

filePath.GetStream works just fine, I get the actual file size, and I also tried NOT using this, but by giving the filePath as string, nothing changed. filePath.GetStream工作得很好,我得到了实际的文件大小,并且我也尝试不使用它,但是通过将filePath设置为字符串,没有任何改变。

Here's the stacktrace I get: 这是我得到的堆栈跟踪: 堆栈跟踪

If the image doesn't work (I'm not sure how to use this): https://pasteboard.co/IgbV96W.jpg 如果图像不起作用(我不确定如何使用): https : //pasteboard.co/IgbV96W.jpg

If it is working in the debug configuration, but not the release configuration, it is likely due to the linker settings. 如果它在调试配置中工作,而不在发布配置中工作,则可能是由于链接器设置引起的。 Like Jason mentioned, your release configuration may be trying to "Link All" which would require linker configuration for use. 就像Jason提到的那样,您的发布配置可能正在尝试“全部链接”,这需要使用链接程序配置才能使用。 Try using one of the other two settings. 尝试使用其他两个设置之一。

If you are unfamiliar, you can find these settings in your project build settings. 如果您不熟悉,可以在项目构建设置中找到这些设置。

Xamarin Android项目链接器设置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM