HELP Please : When sandbox activated, macOS app immediately crash

I am developing a Mac app. When code is signed with sandbox entitlement disabled, all went well.

Now I am preparing for submitting to Mac App Store so sandbox must be enabled.

Now the app crashes immediately with following message:

(Running on M1 Mac air. Built with dotnet for Mac.)

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               LayerMixer [11703]
Path:                  /Users/USER/*/LayerMixer.app/Contents/MacOS/LayerMixer
Identifier:            cn.shanglianyi.layermixer
Version:               1.0.3 (1.0.3)
Code Type:             X86-64 (Translated)
Parent Process:        launchd [1]
User ID:               502

Date/Time:             2022-12-23 14:57:19.2559 +0800
OS Version:            macOS 13.1 (22C65)
Report Version:        12
Anonymous UUID:        905BE678-C6B0-EAC0-5EB7-83FB26EB8BB9


Time Awake Since Boot: 21000 seconds

System Integrity Protection: enabled

Crashed Thread:        0

Exception Type:        EXC_BAD_ACCESS (SIGKILL (Code Signature Invalid))
Exception Codes:       UNKNOWN_0x32 at 0x000000010b10f000
Exception Codes:       0x0000000000000032, 0x000000010b10f000

Termination Reason:    Namespace CODESIGNING, Code 2 Invalid Page

VM Region Info: 0x10b10f000 is in 0x10b10f000-0x10b132000;  bytes after start: 0  bytes before end: 143359
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      Rosetta Generic             10b10e000-10b10f000    [    4K] rw-/rwx SM=PRV  
--->  mapped file                 10b10f000-10b132000    [  140K] r--/rwx SM=COW  ...t_id=fffb1eb3
      GAP OF 0xf77e7000 BYTES
      __TEXT                      202919000-2029b1000    [  608K] r-x/r-x SM=COW  /usr/lib/dyld

Thread 0 Crashed:
0   <translation info unavailable>	       0x102bd6874 ???
1   <translation info unavailable>	       0x102bd5f0c ???
2   dyld                          	       0x20293b600 invocation function for block in dyld4::JustInTimeLoader::makeJustInTimeLoaderDisk(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, bool, unsigned int, mach_o::Layout const*) + 85

Entitlement file is as:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
          "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.cs.allow-jit</key>
    <true/>
    <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
    <true/>
    <key>com.apple.security.cs.disable-library-validation</key>
    <true/>
    <key>com.apple.security.cs.disable-executable-page-protection</key>
    <true/>
    <key>com.apple.security.app-sandbox</key>
    <true/>
</dict>
</plist>

Please help. I have been stuck at there for a couple of days.

Thanks

HELP Please : When sandbox activated, macOS app immediately crash
 
 
Q