简体   繁体   中英

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. I am currently working on 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)

I believe my permissions are correctly setup, I checked them in the application settings.

I tried with a Windows application, it works.

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.

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

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. Try using one of the other two settings.

If you are unfamiliar, you can find these settings in your project build settings.

Xamarin Android项目链接器设置

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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