Bug 52881 - the app built with this version, run error and can not submit to Mac App Store
Summary: the app built with this version, run error and can not submit to Mac App Store
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) ()
Version: 3.6.0 (d15-3)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-02-28 03:41 UTC by xiaohong.sun
Modified: 2017-08-18 14:32 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

Run error (572.30 KB, image/png)
2017-08-16 05:04 UTC, xiaohong.sun
Build setting (270.23 KB, image/png)
2017-08-16 05:06 UTC, xiaohong.sun
Build Setting (526.03 KB, image/png)
2017-08-16 05:08 UTC, xiaohong.sun
NSTableView display Error 1 (344.89 KB, image/png)
2017-08-16 05:23 UTC, xiaohong.sun
NSTableView display Error 2 (323.39 KB, image/png)
2017-08-16 05:24 UTC, xiaohong.sun
NSTableView display well in valid area (361.97 KB, image/png)
2017-08-16 05:25 UTC, xiaohong.sun
NSTableView display Error 4 (282.25 KB, image/png)
2017-08-16 05:26 UTC, xiaohong.sun
NSTableView display Error 5 (102.72 KB, image/png)
2017-08-16 05:26 UTC, xiaohong.sun
LexisRed_CrashReport (202.14 KB, application/pdf)
2017-08-18 10:04 UTC, xiaohong.sun

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description xiaohong.sun 2017-02-28 03:41:22 UTC
# Steps to reproduce
1. Project Options->General->Target Framework->Unsupported Framework
2. Build and Run the project, Run error and throw a exception.
3. If I don't run the app, but only bulid the project, there's no error, and I Archive for publishing, then submit to Mac App Store with Application Loader app, Apple dev team gave me a report that is, 
We have discovered one or more issues with your recent delivery for "Lexis Red". To process your delivery, the following issues must be corrected:
Deprecated API Usage - Apple no longer accepts submissions of apps that use QuickTime or QTKit APIs.
Once these issues have been corrected, you can then redeliver the corrected binary.
The App Store team

Please provide stable development environment for Mac OS, 
Comment 1 Chris Hamons 2017-02-28 15:44:31 UTC
What exception does "2. Build and Run the project, Run error and throw a exception."


That does not throw on my end.
Comment 2 Manuel de la Peña [MSFT] 2017-04-05 10:06:39 UTC
Hello, can you please provide the information requested by Chris?
Comment 3 Timothy Risi 2017-05-08 19:38:13 UTC
 We have not received the requested information. If you are still 
 experiencing this issue please provide all the requested information 
 and re-open the bug report. Thanks!
Comment 4 xiaohong.sun 2017-08-16 03:50:46 UTC
Sorry for not giving the response for the bug, Because i have to release my app to Mac App Store, I rollback reinstall the SDK to Mono.framework(V 4.6.2) and Xamarin.Mac.framework(V and Xamarin Studio(V, My projection can work well and the app can submit to Mac App Store.
At the moment, I Update the SDK to Mono.framework(V 5.2.0) and Xamarin.Mac.framework(V and Xamarin Studio(V 6.3 (build 864)), the Project build no error, but run failed, 
1. Project Options->General->Target Framework->Unsupported Framework(Mono/.NET 4.5)
2. Build the project, there's no error.
3. Run the project, run fail and throw a exception.

below is the error information:

System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime' or one of its dependencies
  at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity) [0x0006f] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/corlib/System/AppDomain.cs:746
  at at (wrapper remoting-invoke-with-check) System.AppDomain:Load (System.Reflection.AssemblyName,System.Security.Policy.Evidence)
  at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/corlib/System/AppDomain.cs:714
  at at (wrapper remoting-invoke-with-check) System.AppDomain:Load (System.Reflection.AssemblyName)
  at System.Reflection.Assembly.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/corlib/System.Reflection/Assembly.cs:600
  at ObjCRuntime.Runtime.CollectReferencedAssemblies (System.Collections.Generic.List`1[T] assemblies, System.Reflection.Assembly assembly) [0x0006d] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/src/ObjCRuntime/Runtime.cs:464
  at ObjCRuntime.Runtime.CollectReferencedAssemblies (System.Collections.Generic.List`1[T] assemblies, System.Reflection.Assembly assembly) [0x0006d] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/src/ObjCRuntime/Runtime.cs:464
  at ObjCRuntime.Runtime.RegisterEntryAssembly (System.Reflection.Assembly entry_assembly) [0x00035] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/src/ObjCRuntime/Runtime.cs:425
  at ObjCRuntime.Runtime.RegisterAssemblies () [0x00006] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/src/ObjCRuntime/Runtime.cs:401
  at AppKit.NSApplication.Init () [0x00022] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/src/AppKit/NSApplication.cs:60
  at LexisNexis.Red.Mac.MainClass.Main (System.String[] args) [0x00029] in /Users/tracy/Red/LexisNexis.Red.Mac/Main.cs:18

By the way, my project need load some large data more than 4MB and display with NSTableView and WebKit, the NSTableView can't reload and refresh.
Please provide stable development environment for Mac OS, 
Comment 5 xiaohong.sun 2017-08-16 05:04:26 UTC
Created attachment 24214 [details]
Run error
Comment 6 xiaohong.sun 2017-08-16 05:06:29 UTC
Created attachment 24215 [details]
Build setting
Comment 7 xiaohong.sun 2017-08-16 05:08:41 UTC
Created attachment 24216 [details]
Build Setting
Comment 8 xiaohong.sun 2017-08-16 05:23:53 UTC
Created attachment 24217 [details]
NSTableView display Error 1
Comment 9 xiaohong.sun 2017-08-16 05:24:11 UTC
Created attachment 24218 [details]
NSTableView display Error 2
Comment 10 xiaohong.sun 2017-08-16 05:25:12 UTC
Created attachment 24219 [details]
NSTableView display well in valid area
Comment 11 xiaohong.sun 2017-08-16 05:26:32 UTC
Created attachment 24220 [details]
NSTableView display Error 4
Comment 12 xiaohong.sun 2017-08-16 05:26:52 UTC
Created attachment 24221 [details]
NSTableView display Error 5
Comment 13 Chris Hamons 2017-08-16 16:26:24 UTC
Before digging into the limited information provided, I want to directly point out:

Your application is using the "Unsupported System" target framework. 

This means it is a configuration that is not generally tested internally, and that we make at most a "best effort" at solving any issues. It is labeled unsupported for good reason.

I would strongly suggest that you move to a supported target framework.

Assembly load errors, such as the one you are running into, can be caused by a number of issues but often fall into one of two buckets:

- Attempting to load assembly X but X is not found at runtime
- Attempting to load assembly X, and it is on disk in the expected location, but it is not loadable or rejected for some reason.

I would suggest running your application with the appropriate mono debug flags:

MONO_LOG_LEVEL=debug MONO_LOG_MASK=asm Foo.app/Contents/MacOS/Foo

which should give you an indication of the problem.

Unfortunately, images of your application are not sufficient to debug NSTableView issues. You can look at a sample application here:


I would suggest logging responses from your NSTableViewDataSource and NSTableViewDelegate classes as a first step in tracking down the bug in your code. NSTableView, which is an AppKit component Apple provides, sometimes exhibits strange or even undefined behavior when your responses to Cocoa API calls are inconsistent. 

In the event that your debugging suggests a Xamarin.Mac bug, please feel free to open a new bug. The Xamarin.Mac forums are also available for discussion, and more appropriate than bugzilla bugs.
Comment 14 xiaohong.sun 2017-08-18 10:04:54 UTC
Created attachment 24297 [details]
Comment 15 xiaohong.sun 2017-08-18 10:11:02 UTC
Thanks for your response,
I have switched to Target Framework of Xamarin.Mac.NET 4.5 Framework,
But another issue existed. that is the application runs and crashed immediately.
Bellow is the error information.

Process:               Lexis Red [3073]
Path:                  /Users/USER/*/Lexis Red.app/Contents/MacOS/Lexis Red
Identifier:            au.com.lexisnexis.lexisred
Version:               3.4.0 (25)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Lexis Red [3073]
User ID:               502

Date/Time:             2017-08-18 17:47:04.039 +0800
OS Version:            Mac OS X 10.12.5 (16F73)
Report Version:        12
Anonymous UUID:        2DFEA41F-E712-6BED-BE1D-42162AAF8F50

Sleep/Wake UUID:       41AD7434-7186-4E20-A666-9EB15636200A

Time Awake Since Boot: 23000 seconds
Time Since Wake:       6800 seconds

System Integrity Protection: enabled

Crashed Thread:        20  Threadpool worker

Exception Type:        EXC_BAD_ACCESS (SIGABRT)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000004280b80
Exception Note:        EXC_CORPSE_NOTIFY

VM Regions Near 0x4280b80:
    __TEXT                 0000000105e18000-000000010626e000 [ 4440K] r-x/rwx SM=COW  /Users/USER/*/Lexis Red.app/Contents/MacOS/Lexis Red

Application Specific Information:
abort() called

Logical CPU:     0
Error Code:      0x02000148
Trap Number:     133

Can you help me to resolve it.
Comment 16 Chris Hamons 2017-08-18 14:32:10 UTC
As noted in the bug report, we are crashing on thread 20:

Crashed Thread: 20 Threadpool worker

Thread 20 Crashed:: Threadpool worker
0 libsystem_kernel.dylib 0x00007fffa277cd42 __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fffa286a457 pthread_kill + 90
2 libsystem_c.dylib 0x00007fffa26e2420 abort + 129
3 au.com.lexisnexis.lexisred 0x0000000105f2230b
mono_handle_native_crash + 603 (mini-exceptions.c:2548)
4 au.com.lexisnexis.lexisred 0x0000000105ea0ae6
altstack_handle_and_restore + 70 (exceptions-amd64.c:795)
5 com.apple.SkyLight 0x00007fff9ea24e9f SLDisplayBounds + 50
6 ??? 0x0000000113c0905c 0 + 4626354268
7 ??? 0x0000000113bf13cf 0 + 4626256847
8 au.com.lexisnexis.lexisred 0x0000000105f32be4
mono_jit_runtime_invoke + 1316 (mini-runtime.c:2549)
9 au.com.lexisnexis.lexisred 0x0000000105ffb148 do_runtime_invoke +
88 (object.c:2829)
10 au.com.lexisnexis.lexisred 0x0000000105ff7254
mono_runtime_class_init_full + 996 (object.c:472)
11 au.com.lexisnexis.lexisred 0x0000000105f40195
mono_jit_compile_method_inner + 2485 (mini.c:4365)
12 au.com.lexisnexis.lexisred 0x0000000105f2f384
mono_jit_compile_method_with_opt + 660 (mini-runtime.c:1889)
13 au.com.lexisnexis.lexisred 0x0000000105f35756
common_call_trampoline + 1174 (mini-trampolines.c:704)
14 au.com.lexisnexis.lexisred 0x0000000105f35289
mono_magic_trampoline + 73 (mini-trampolines.c:834)
15 ??? 0x0000000106b8f39e 0 + 4407751582
16 ??? 0x0000000113bed860 0 + 4626241632
17 ??? 0x000000011344e0e7 0 + 4618248423
18 ??? 0x0000000110c9a119 0 + 4576616729
19 ??? 0x0000000110a8832c 0 + 4574446380
20 ??? 0x0000000110c98273 0 + 4576608883
21 ??? 0x0000000110c7a392 0 + 4576486290
22 au.com.lexisnexis.lexisred 0x0000000105f32be4
mono_jit_runtime_invoke + 1316 (mini-runtime.c:2549)
23 au.com.lexisnexis.lexisred 0x0000000105ffb148 do_runtime_invoke +
88 (object.c:2829)
24 au.com.lexisnexis.lexisred 0x000000010603d380 worker_callback +
928 (threadpool.c:360)
25 au.com.lexisnexis.lexisred 0x000000010603ae91 worker_thread + 353
26 au.com.lexisnexis.lexisred 0x00000001060451a3 start_wrapper + 675
27 libsystem_pthread.dylib 0x00007fffa286793b _pthread_body + 180
28 libsystem_pthread.dylib 0x00007fffa2867887 _pthread_start + 286
29 libsystem_pthread.dylib 0x00007fffa286708d thread_start + 13

which appears to be calling com.apple.SkyLight inside some of your code and crashing.

Bugzilla bugs are _not_ a location for diagnosing issues, they are for reporting bugs and regressions.

I would suggest:

- AOT'ing your application by passing --aot:all in your mmp arguments (in project settings -> mac build) to see if you get better idea where you are crashing
- Bisecting your application, in particular looking for code being called on secondary threads, until you figure out what's crashing things
- If you need further assistance, contact any Microsoft support contact you have or possibly ask the community for assistance on the forums (https://forums.xamarin.com/categories/mac).

Please do not re-open this bug, as it does not fit the criteria for a bug.

If you believe you've found a regression or bug in Xamarin.Mac, feel free to open a new one at bugzilla.xamarin.com/index.cgi