Opening Excel Template Crashes in Release Build

I have several *.xlsx files that I have included with my iOS project using Xamarin.  The following code is used to load the report.

FlexCelReport myReport = new FlexCelReport(true);
XlsFile xls = new XlsFile();
myReport.AddTable([ANY TABLE NECESSARY FOR REPORTS]);
xls.Open("Reports/xxxx.xlsx");
myReport.Run(xls);

When running this in debug build mode on real devices iPhone & iPad, everything works as expected and produces the report perfectly.

In Release Build, the following line crashes the app:
xls.Open("Reports/xxxx.xlsx");

I have tried this on iOS 7 and iOS 6.1 and it acts the same in all cases.

Any help?

Thanks,

Bo

UPDATE:

I continued to research the issue and the original line of code mentioned above is not what acutally caused the crash.  I kept commenting out blocks of code until I finally got things working in the Release build and then start adding back until it failed again.

Here is what is really happening:

xls.Save (reportXlsName);
FlexCelPdfExport pdf = new FlexCelPdfExport(xls,true);
pdf.Export(reportPDFName);
pdf.Dispose();
xls = null;



The 3 lines of code above dealing with the FlexCelPdfExport are the trouble spots. If I comment out those 3 lines, it works in release mode.

So, I am thinking there is something going on with PDF export in Release builds.

Bo


Hi,

What is the value of "reportPDFName"?  Might it be that it is trying to save to a place where you don't have permissions to write?

Just to check, if you change that code by:

using (MemoryStream ms = new MemoryStream())
{
   pdf.Export(ms);
}
pdf.Dispose()

Does it still show the exception?
Also  if you look in the logs in XCode (Open XCode, menu->Window->Organizer) do you see any extra information that might be relevant?

Using the MemoryStream crashes in Release build but works in Debug build.  It does the same thing.
To answer your question about the reportPDFName it gets set based on the data record.  I will give you the lines of code that lead up to it below.  I can see that when in Debug mode, the pdf file does in fact get written out to the correct spot so I think that is working but it is below.


static
 string docsPath = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
static string libPath = Path.Combine (docsPath, "..", "Library");
static string picRootPath = Path.Combine (libPath, "BTSPictures");



picPath
 = Path.Combine (picRootPath, iSalvageId.ToString ());
if (!Directory.Exists (picPath)) {
   Directory.CreateDirectory (picPath);
} 



reportPDFName = Path.Combine (picPath, sBaseFileName + ".pdf");



I do have a few varialbe running around like iSalvageId and sBaseFileName but those are just string values for overall path.

What is weird is that it works in debug mode so I assume all the paths are correct.  And, I see zip files, jpg files and the xlsx file in there as well.

As for the XCode exception, I can post that below.  I also use Test Flight and the crash report over on Test Flight said:
monotouch_unhandled_exception_handler in monotouch-glue.m on Line 1436

Xcode says:

Incident Identifier: EB9E0710-1A30-4993-8AB5-6B7B6D2A36EB
CrashReporter Key:   41619ac50e67fa1431456cbb67aba3a84c7165d0
Hardware Model:      iPad3,4
Process:         BTSMobileiOS [6538]
Path:            /var/mobile/Applications/2E19F88B-0688-4547-9AF5-1B550BA4380A/BTSMobileiOS.app/BTSMobileiOS
Identifier:      BTSMobileiOS
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2014-01-24 16:09:54.508 -0500
OS Version:      iOS 6.1.3 (10B329)
Report Version:  104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib            0x3a0f9350 __pthread_kill + 8
1   libsystem_c.dylib                 0x3a06ffb2 pthread_kill + 54
2   libsystem_c.dylib                 0x3a0ac366 abort + 90
3   BTSMobileiOS                      0x00d612f4 mono_handle_native_sigsegv (mini-exceptions.c:2413)
4   BTSMobileiOS                      0x00d6653e sigabrt_signal_handler (mini-posix.c:206)
5   BTSMobileiOS                      0x000e0184 ___lldb_unnamed_function417$$BTSMobileiOS + 832
6   libsystem_c.dylib                 0x3a079d38 _sigtramp + 40
7   libsystem_c.dylib                 0x3a06ffb2 pthread_kill + 54
8   libsystem_c.dylib                 0x3a0ac366 abort + 90
9   BTSMobileiOS                      0x00e116cc monotouch_unhandled_exception_handler (monotouch-glue.m:1436)
10  BTSMobileiOS                      0x00d616b4 mono_invoke_unhandled_exception_hook (mini-exceptions.c:2749)
11  BTSMobileiOS                      0x00d6e732 mono_thread_abort_dummy (mini.c:2768)
12  BTSMobileiOS                      0x00d60ebc mono_handle_exception_internal (mini-exceptions.c:1710)
13  BTSMobileiOS                      0x00d6063e mono_handle_exception (mini-exceptions.c:2003)
14  BTSMobileiOS                      0x00d5a13c mono_arm_throw_exception (exceptions-arm.c:161)
15  BTSMobileiOS                      0x003afdc4 ___lldb_unnamed_function19139$$BTSMobileiOS + 64
16  BTSMobileiOS                      0x00db589a mono_runtime_class_init (object.c:261)
17  BTSMobileiOS                      0x00d6ac86 mono_resolve_patch_target (mini.c:3373)
18  BTSMobileiOS                      0x00d412ac load_method (aot-runtime.c:3373)
19  BTSMobileiOS                      0x00d40b80 mono_aot_get_method (aot-runtime.c:3769)
20  BTSMobileiOS                      0x00d6b5c6 mono_jit_compile_method_with_opt (mini.c:5701)
21  BTSMobileiOS                      0x00d6b44c mono_jit_compile_method (mini.c:6138)
22  BTSMobileiOS                      0x00db6bf8 mono_compile_method (object.c:587)
23  BTSMobileiOS                      0x00d66e80 common_call_trampoline (mini-trampolines.c:577)
24  BTSMobileiOS                      0x00d66bea mono_magic_trampoline (mini-trampolines.c:699)
25  BTSMobileiOS                      0x003af4c4 ___lldb_unnamed_function19123$$BTSMobileiOS + 116
26  BTSMobileiOS                      0x00aa6cf8 ___lldb_unnamed_function61259$$BTSMobileiOS + 424
27  BTSMobileiOS                      0x00aa6b40 ___lldb_unnamed_function61258$$BTSMobileiOS + 56
28  BTSMobileiOS                      0x00aa6af8 ___lldb_unnamed_function61257$$BTSMobileiOS + 32
29  BTSMobileiOS                      0x00aa6308 ___lldb_unnamed_function61249$$BTSMobileiOS + 40
30  BTSMobileiOS                      0x00144058 BTSMobile.iOS.SalvageDetailExportViewController:<ViewDidLoad>m__67 + 3432
31  BTSMobileiOS                      0x001968f8 ___lldb_unnamed_function6346$$BTSMobileiOS + 40
32  BTSMobileiOS                      0x00383d6c ___lldb_unnamed_function18253$$BTSMobileiOS + 196
33  BTSMobileiOS                      0x00d6ddd6 mono_jit_runtime_invoke (mini.c:6504)
34  BTSMobileiOS                      0x00db57b2 mono_runtime_invoke (object.c:2827)
35  BTSMobileiOS                      0x00cba4dc native_to_managed_trampoline_MonoTouch_Foundation_NSActionDispatcher_Apply (registrar.m:153)
36  Foundation                        0x3269349c __NSThreadPerformPerform + 456
37  CoreFoundation                    0x31d508f4 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 12
38  CoreFoundation                    0x31d50158 __CFRunLoopDoSources0 + 208
39  CoreFoundation                    0x31d4ef2a __CFRunLoopRun + 642
40  CoreFoundation                    0x31cc2238 CFRunLoopRunSpecific + 352
41  CoreFoundation                    0x31cc20c4 CFRunLoopRunInMode + 100
42  GraphicsServices                  0x3587d336 GSEventRunModal + 70
43  UIKit                             0x33bde2b4 UIApplicationMain + 1116
44  BTSMobileiOS                      0x001ddaf0 ___lldb_unnamed_function8372$$BTSMobileiOS + 268
45  BTSMobileiOS                      0x001a71d0 ___lldb_unnamed_function6818$$BTSMobileiOS + 296
46  BTSMobileiOS                      0x000ecfec BTSMobile.iOS.Application:Main + 44
47  BTSMobileiOS                      0x00383d6c ___lldb_unnamed_function18253$$BTSMobileiOS + 196
48  BTSMobileiOS                      0x00d6ddd6 mono_jit_runtime_invoke (mini.c:6504)
49  BTSMobileiOS                      0x00db57b2 mono_runtime_invoke (object.c:2827)
50  BTSMobileiOS                      0x00db9540 mono_runtime_exec_main (object.c:4054)
51  BTSMobileiOS                      0x00db9380 mono_runtime_run_main (object.c:3678)
52  BTSMobileiOS                      0x00d5816c mono_jit_exec (driver.g.c:962)
53  BTSMobileiOS                      0x00dff850 main (main.m:486)
54  libdyld.dylib                     0x3a032b1c start + 0

Thread 1 name:  Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0   libsystem_kernel.dylib            0x3a0e95d0 kevent64 + 24
1   libdispatch.dylib                 0x3a024d22 _dispatch_mgr_invoke + 806
2   libdispatch.dylib                 0x3a020374 _dispatch_mgr_thread + 32

Thread 2 name:  WebThread
Thread 2:
0   libsystem_kernel.dylib            0x3a0e8e30 mach_msg_trap + 20
1   libsystem_kernel.dylib            0x3a0e8fd0 mach_msg + 48
2   CoreFoundation                    0x31d502b6 __CFRunLoopServiceMachPort + 126
3   CoreFoundation                    0x31d4f02c __CFRunLoopRun + 900
4   CoreFoundation                    0x31cc2238 CFRunLoopRunSpecific + 352
5   CoreFoundation                    0x31cc20c4 CFRunLoopRunInMode + 100
6   WebCore                           0x37ca6390 RunWebThread(void*) + 440
7   libsystem_c.dylib                 0x3a0520de _pthread_start + 306
8   libsystem_c.dylib                 0x3a051fa4 thread_start + 4

Thread 3:
0   libsystem_kernel.dylib            0x3a0e8e30 mach_msg_trap + 20
1   libsystem_kernel.dylib            0x3a0e8fd0 mach_msg + 48
2   CoreFoundation                    0x31d502b6 __CFRunLoopServiceMachPort + 126
3   CoreFoundation                    0x31d4f02c __CFRunLoopRun + 900
4   CoreFoundation                    0x31cc2238 CFRunLoopRunSpecific + 352
5   CoreFoundation                    0x31cc20c4 CFRunLoopRunInMode + 100
6   Foundation                        0x325e65be -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 250
7   Foundation                        0x32689c40 -[NSRunLoop(NSRunLoop) run] + 76
8   BTSMobileiOS                      0x000e3880 ___lldb_unnamed_function514$$BTSMobileiOS + 208
9   Foundation                        0x3269322c NSThread__main + 968
10  libsystem_c.dylib                 0x3a0520de _pthread_start + 306
11  libsystem_c.dylib                 0x3a051fa4 thread_start + 4

Thread 4 name:  com.apple.NSURLConnectionLoader
Thread 4:
0   libsystem_kernel.dylib            0x3a0e8e30 mach_msg_trap + 20
1   libsystem_kernel.dylib            0x3a0e8fd0 mach_msg + 48
2   CoreFoundation                    0x31d502b6 __CFRunLoopServiceMachPort + 126
3   CoreFoundation                    0x31d4f02c __CFRunLoopRun + 900
4   CoreFoundation                    0x31cc2238 CFRunLoopRunSpecific + 352
5   CoreFoundation                    0x31cc20c4 CFRunLoopRunInMode + 100
6   Foundation                        0x3260f888 +[NSURLConnection(Loader) _resourceLoadLoop:] + 304
7   Foundation                        0x3269322c NSThread__main + 968
8   libsystem_c.dylib                 0x3a0520de _pthread_start + 306
9   libsystem_c.dylib                 0x3a051fa4 thread_start + 4

Thread 5:
0   libsystem_kernel.dylib            0x3a0f9d98 __workq_kernreturn + 8
1   libsystem_c.dylib                 0x3a047ad6 _pthread_workq_return + 14
2   libsystem_c.dylib                 0x3a0477f2 _pthread_wqthread + 362
3   libsystem_c.dylib                 0x3a047680 start_wqthread + 4

Thread 6 name:  com.apple.CFSocket.private
Thread 6:
0   libsystem_kernel.dylib            0x3a0f9594 select$DARWIN_EXTSN + 20
1   CoreFoundation                    0x31d54474 __CFSocketManager + 676
2   libsystem_c.dylib                 0x3a0520de _pthread_start + 306
3   libsystem_c.dylib                 0x3a051fa4 thread_start + 4

Thread 7:
0   libsystem_kernel.dylib            0x3a0e8e80 semaphore_wait_trap + 8
1   BTSMobileiOS                      0x00de6dca mono_sem_wait (mono-semaphore.c:118)
2   BTSMobileiOS                      0x00d915e4 finalizer_thread (gc.c:1073)
3   BTSMobileiOS                      0x00dc934a start_wrapper (threads.c:608)
4   BTSMobileiOS                      0x00ddf138 thread_start_routine (wthreads.c:294)
5   BTSMobileiOS                      0x00de7226 inner_start_thread (mono-threads-posix.c:49)
6   BTSMobileiOS                      0x00dfc4c8 GC_start_routine (pthread_support.c:1526)
7   libsystem_c.dylib                 0x3a0520de _pthread_start + 306
8   libsystem_c.dylib                 0x3a051fa4 thread_start + 4

Thread 8:
0   libsystem_kernel.dylib            0x3a0f9d98 __workq_kernreturn + 8
1   libsystem_c.dylib                 0x3a047ad6 _pthread_workq_return + 14
2   libsystem_c.dylib                 0x3a0477f2 _pthread_wqthread + 362
3   libsystem_c.dylib                 0x3a047680 start_wqthread + 4

Thread 9 name:  Dispatch queue: com.apple.uikit._UIRemoteViewControllerCreationRequest com.apple.MailCompositionService ComposeServiceRemoteViewController 0x3a61f2cc
Thread 9:
0   libsystem_kernel.dylib            0x3a0e8e80 semaphore_wait_trap + 8
1   libdispatch.dylib                 0x3a023e90 _dispatch_thread_semaphore_wait + 8
2   libdispatch.dylib                 0x3a022680 _dispatch_barrier_sync_f_slow + 100
3   UIKit                             0x33f81fd6 __99+[_UIRemoteViewController requestViewController:fromServiceWithBundleIdentifier:connectionHandler:]_block_invoke_0 + 266
4   UIKit                             0x33f7fa28 __block_global_0 + 236
5   libdispatch.dylib                 0x3a020586 dispatch_once_f + 42
6   UIKit                             0x33f7f930 __150+[_UIRemoteViewControllerConnectionRequest requestViewController:fromServiceWithBundleIdentifier:propagateAppearanceCustomizations:connectionHandler:]_block_invoke_0 + 256
7   UIKit                             0x33f81b62 -[_UIRemoteViewControllerConnectionRequest _didFinishEstablishingConnection] + 322
8   UIKit                             0x33f81980 __block_global_9 + 220
9   libdispatch.dylib                 0x3a02280a _dispatch_barrier_sync_f_invoke + 22
10  UIKit                             0x33f8189a __75-[_UIRemoteViewControllerConnectionRequest _connectToServiceViewController]_block_invoke_0 + 90
11  UIKit                             0x33f89d26 __block_global_0 + 30
12  libdispatch.dylib                 0x3a020586 dispatch_once_f + 42
13  UIKit                             0x33f89cfe __73-[_UIViewServiceSessionEndpoint connectToDeputyOfType:connectionHandler:]_block_invoke_0 + 86
14  libdispatch.dylib                 0x3a01f790 _dispatch_call_block_and_release + 8
15  libdispatch.dylib                 0x3a022b36 _dispatch_queue_drain + 138
16  libdispatch.dylib                 0x3a020678 _dispatch_queue_invoke + 40
17  libdispatch.dylib                 0x3a023610 _dispatch_root_queue_drain + 208
18  libdispatch.dylib                 0x3a0237d4 _dispatch_worker_thread2 + 88
19  libsystem_c.dylib                 0x3a0477ee _pthread_wqthread + 358
20  libsystem_c.dylib                 0x3a047680 start_wqthread + 4

Thread 10:
0   libsystem_kernel.dylib            0x3a0f96a4 __semwait_signal + 24
1   libsystem_c.dylib                 0x3a0571be nanosleep + 138
2   BTSMobileiOS                      0x00ddf78c SleepEx (wthreads.c:842)
3   BTSMobileiOS                      0x00dc871a monitor_thread (threadpool.c:779)
4   BTSMobileiOS                      0x00dc934a start_wrapper (threads.c:608)
5   BTSMobileiOS                      0x00ddf138 thread_start_routine (wthreads.c:294)
6   BTSMobileiOS                      0x00de7226 inner_start_thread (mono-threads-posix.c:49)
7   BTSMobileiOS                      0x00dfc4c8 GC_start_routine (pthread_support.c:1526)
8   libsystem_c.dylib                 0x3a0520de _pthread_start + 306
9   libsystem_c.dylib                 0x3a051fa4 thread_start + 4

Thread 11:
0   libsystem_kernel.dylib            0x3a0f908c __psynch_cvwait + 24
1   libsystem_c.dylib                 0x3a04aafc _pthread_cond_wait + 644
2   libsystem_c.dylib                 0x3a054cf8 pthread_cond_wait + 36
3   Foundation                        0x3260f98a -[NSCondition wait] + 190
4   Foundation                        0x325e6bae -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] + 650
5   Foundation                        0x325e66bc -[NSObject(NSThreadPerformAdditions) performSelectorOnMainThread:withObject:waitUntilDone:] + 132
6   BTSMobileiOS                      0x001d6930 ___lldb_unnamed_function8227$$BTSMobileiOS + 148
7   BTSMobileiOS                      0x00197980 ___lldb_unnamed_function6379$$BTSMobileiOS + 144
8   BTSMobileiOS                      0x00143230 BTSMobile.iOS.SalvageDetailExportViewController:<ViewDidLoad>m__65 + 104
9   BTSMobileiOS                      0x002bd33c ___lldb_unnamed_function13520$$BTSMobileiOS + 56
10  BTSMobileiOS                      0x002bc5f4 ___lldb_unnamed_function13496$$BTSMobileiOS + 96
11  BTSMobileiOS                      0x002bbfe0 ___lldb_unnamed_function13492$$BTSMobileiOS + 568
12  BTSMobileiOS                      0x002bc344 ___lldb_unnamed_function13493$$BTSMobileiOS + 24
13  BTSMobileiOS                      0x002be9d8 ___lldb_unnamed_function13575$$BTSMobileiOS + 88
14  BTSMobileiOS                      0x00383d6c ___lldb_unnamed_function18253$$BTSMobileiOS + 196
15  BTSMobileiOS                      0x00d6ddd6 mono_jit_runtime_invoke (mini.c:6504)
16  BTSMobileiOS                      0x00db57b2 mono_runtime_invoke (object.c:2827)
17  BTSMobileiOS                      0x00db9036 mono_runtime_delegate_invoke (object.c:3538)
18  BTSMobileiOS                      0x00dc70fc async_invoke_thread (threadpool.c:621)
19  BTSMobileiOS                      0x00dc934a start_wrapper (threads.c:608)
20  BTSMobileiOS                      0x00ddf138 thread_start_routine (wthreads.c:294)
21  BTSMobileiOS                      0x00de7226 inner_start_thread (mono-threads-posix.c:49)
22  BTSMobileiOS                      0x00dfc4c8 GC_start_routine (pthread_support.c:1526)
23  libsystem_c.dylib                 0x3a0520de _pthread_start + 306
24  libsystem_c.dylib                 0x3a051fa4 thread_start + 4

Thread 12:
0   libsystem_kernel.dylib            0x3a0f9d98 __workq_kernreturn + 8
1   libsystem_c.dylib                 0x3a047ad6 _pthread_workq_return + 14
2   libsystem_c.dylib                 0x3a0477f2 _pthread_wqthread + 362
3   libsystem_c.dylib                 0x3a047680 start_wqthread + 4

Thread 13:
0   libsystem_kernel.dylib            0x3a0f9d98 __workq_kernreturn + 8
1   libsystem_c.dylib                 0x3a047ad6 _pthread_workq_return + 14
2   libsystem_c.dylib                 0x3a0477f2 _pthread_wqthread + 362
3   libsystem_c.dylib                 0x3a047680 start_wqthread + 4

Thread 14:
0   libsystem_kernel.dylib            0x3a0f9d98 __workq_kernreturn + 8
1   libsystem_c.dylib                 0x3a047ad6 _pthread_workq_return + 14
2   libsystem_c.dylib                 0x3a0477f2 _pthread_wqthread + 362
3   libsystem_c.dylib                 0x3a047680 start_wqthread + 4

Thread 0 crashed with ARM Thread State (32-bit):
    r0: 0x00000000    r1: 0x00000000      r2: 0x00000000      r3: 0x3bbe6524
    r4: 0x00000006    r5: 0x3bbe6b78      r6: 0x00e23bb0      r7: 0x2fd3623c
    r8: 0x00e15dfc    r9: 0x00000000     r10: 0x1da5c000     r11: 0x00e23af9
    ip: 0x00000148    sp: 0x2fd36230      lr: 0x3a06ffb7      pc: 0x3a0f9350
  cpsr: 0x00000010


A little more info:

I ran this on Android as I am create both apps android and iOS.  Same thing happens on Android.  It works in Debug mode but not in Release mode. 

I was able to capture some application output for Android when it fails.  Below is the output.  It acts like it doesn't know the filename but I also ran the MemoryStream version and got the same error output.

MonoDroid] UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for FlexCel.Pdf.FormInput ---> System.NotSupportedException: CodePage 1252 not supported
[MonoDroid]   at System.Text.Encoding.GetEncoding (Int32 codepage) [0x00000] in <filename unknown>:0
[MonoDroid]   at FlexCel.Pdf.FormInput..cctor () [0x00000] in <filename unknown>:0
[MonoDroid]   --- End of inner exception stack trace ---
[MonoDroid]   at FlexCel.Pdf.PdfWriter.BeginDoc (System.IO.Stream aDataStream) [0x00000] in <filename unknown>:0
[MonoDroid]   at FlexCel.Render.FlexCelPdfExport.ExportSheet (Int32 startPageToDisplay, Int32 totalPagesToDisplay, Int32 startPageToExport, Int32 totalPagesToExport) [0x00000] in <filename unknown>:0
[MonoDroid]   at FlexCel.Render.FlexCelPdfExport.ExportSheet (Int32 startPageToDisplay, Int32 totalPagesToDisplay) [0x00000] in <filename unknown>:0
[MonoDroid]   at FlexCel.Render.FlexCelPdfExport.ExportSheet () [0x00000] in <filename unknown>:0
[MonoDroid]   at FlexCel.Render.FlexCelPdfExport.Export (System.IO.Stream pdfStream) [0x00000] in <filename unknown>:0
[MonoDroid]   at FlexCel.Render.FlexCelPdfExport.Export (System.String fileName) [0x00000] in <filename unknown>:0
[mono]
[mono] Unhandled Exception:
[mono] System.TypeInitializationException: An exception was thrown by the type initializer for FlexCel.Pdf.FormInput ---> System.NotSupportedException: CodePage 1252 not supported
[mono]   at System.Text.Encoding.GetEncoding (Int32 codepage) [0x00000] in <filename unknown>:0
[mono]   at FlexCel.Pdf.FormInput..cctor () [0x00000] in <filename unknown>:0
[mono]   --- End of inner exception stack trace ---
[mono]   at FlexCel.Pdf.PdfWriter.BeginDoc (System.IO.Stream aDataStream) [0x00000] in <filename unknown>:0
[mono]   at FlexCel.Render.FlexCelPdfExport.ExportSheet (Int32 startPageToDisplay, Int32 totalPagesToDisplay, Int32 startPageToExport, Int32 totalPagesToExport) [0x00000] in <filename unknown>:0
[mono]   at FlexCel.Render.FlexCelPdfExport.ExportSheet (Int32 startPageToDisplay, Int32 totalPagesToDisplay) [0x00000] in <filename unknown>:0
[mono]   at FlexCel.Render.FlexCelPdfExport.ExportSheet () [0x00000] in <filename unknown>:0
[mono]   at FlexCel.Render.FlexCelPdfExport.Export (System.IO.Stream pdfStream) [0x00000] in <filename unknown>:
[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for FlexCel.Pdf.FormInput ---> System.NotSupportedException: CodePage 1252 not supported
[mono-rt]   at System.Text.Encoding.GetEncoding (Int32 codepage) [0x00000] in <filename unknown>:0
[mono-rt]   at FlexCel.Pdf.FormInput..cctor () [0x00000] in <filename unknown>:0
[mono-rt]   --- End of inner exception stack trace ---
[mono-rt]   at FlexCel.Pdf.PdfWriter.BeginDoc (System.IO.Stream aDataStream) [0x00000] in <filename unknown>:0
[mono-rt]   at FlexCel.Render.FlexCelPdfExport.ExportSheet (Int32 startPageToDisplay, Int32 totalPagesToDisplay, Int32 startPageToExport, Int32 totalPagesToExport) [0x00000] in <filename unknown>:0
[mono-rt]   at FlexCel.Render.FlexCelPdfExport.ExportSheet (Int32 startPageToDisplay, Int32 totalPagesToDisplay) [0x00000] in <filename unknown>:0
[mono-rt]   at FlexCel.Render.FlexCelPdfExport.ExportSheet () [0x00000] in <filename unknown>:0
[mono-rt]   at FlexCel.Render.FlexCelPdfExport.Export (System.IO.Stream pdfStream) [0x00000] in <filen

HI,

the issues in Android / iOS look like they might be different (even if not 100% sure).

In android, the problem seems clear:
CodePage 1252 not supported

While I am not 100% sure on how it is happening (FlexCel should detect the codepage doesn't exists), the simplest way to fix it would be to add that codepage support to your app. Go to the "Linker->Internationalization" settings, and make sure "west" is selected:



Also make sure you select "Release" in the box above so the settings are for release. This doesn't explain why it is working in Debug but not in Release, but it might give us a hint on what is happening.

After that, please try the same in iOS, the options are in "iOS Build->Advanced".

Note that there used to be a bug where Mono wouldn't catch the missing encoding, maybe somehow it came back:
https://bugzilla.xamarin.com/show_bug.cgi?id=13442

I'll take a look at it.

If the codepage doesn't fix it, the other thing to try would be the linker. In the iOS side, the exception looks like it is when trying to get an aot, method, and it might be that it was  removed form the linker.

And as in Debug the linker is set to "Don't link", this might be making a difference. Please try it without linker in the "iOS/Android" options (the "General" tab).

Thank you so much.  That fixed it in both Android & iOS.  I don't think I would have figured that one out.  By selecting "west" in the "Release" options worked.

Cheers!

Bo

Thanks for letting me know. I'll investigate further, I might need to reopen the bug with Xamarin, since it shouldn't crash when "west" isn't selected.


But yes, "west" is needed in order to create pdfs.