App crashes on Big Sur but works on Monterey

Hello, I have an app, which runs fine on Monterey, but crashes on Big Sur. However, I am able to run it on Big Sur from XCode only.


System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x000004079c498ca0
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [3858]

VM Regions Near 0x4079c498ca0:
    mapped file                 11e4ff000-11e607000    [ 1056K] r--/rw- SM=COW  Object_id=6ea347b
--> 
    MALLOC_NANO              600000000000-600008000000 [128.0M] rw-/rwx SM=PRV  

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib                 0x00007fff2040f4af objc_release + 31
1   com.apple.UIFoundation          0x00007fff23c1aba8 -[UINibDecoder dealloc] + 119
2   com.apple.AppKit                0x00007fff22fef7ec -[NSNib dealloc] + 28
3   libobjc.A.dylib                 0x00007fff2042d20f AutoreleasePoolPage::releaseUntil(objc_object**) + 167
4   libobjc.A.dylib                 0x00007fff2040fe30 objc_autoreleasePoolPop + 161
5   com.apple.CoreFoundation        0x00007fff206284b6 _CFAutoreleasePoolPop + 22
6   com.apple.Foundation            0x00007fff213ca0bb -[NSAutoreleasePool drain] + 131
7   com.apple.Foundation            0x00007fff213cb198 _NSAppleEventManagerGenericHandler + 98
8   com.apple.AE                    0x00007fff264487f3 0x7fff2643c000 + 51187
9   com.apple.AE                    0x00007fff26447f0e 0x7fff2643c000 + 48910
10  com.apple.AE                    0x00007fff26440c23 aeProcessAppleEvent + 448
11  com.apple.HIToolbox             0x00007fff288bf8a2 AEProcessAppleEvent + 54
12  com.apple.AppKit                0x00007fff22e6e210 _DPSNextEvent + 2046
13  com.apple.AppKit                0x00007fff22e6c545 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1364
14  com.apple.AppKit                0x00007fff22e5e869 -[NSApplication run] + 586
15  com.apple.AppKit                0x00007fff22e32a6c NSApplicationMain + 816
16  com.MyCompany.MyApp.            0x000000010d699799 main + 9 (AppDelegate.swift:15)
17  libdyld.dylib                   0x00007fff2058af3d start + 1

There are some pictures(please open them in new tab) from Zombie instrument:

Regarding Zombie, it looks like some error happens in this code in

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate, Loggable 

is the method

fileprivate func handleFSE(event: NSAppleEventDescriptor?, replyEvent: NSAppleEventDescriptor?) {
    Defaults[.deepLinkData] = event?.paramDescriptor(forKeyword: keyDirectObject)?.stringValue
    Defaults[.isFromCUSLaunch] = true
    if let window = WindowControllerFrom(storyboard: .cus, withIdentifier: .cusWindow) {
      logIfCan(string: "Deeplink data: \(event?.paramDescriptor(forKeyword: keyDirectObject)?.stringValue ?? .empty)")
      let cusVC = CUSViewController(event?.paramDescriptor(forKeyword: keyDirectObject)?.stringValue ?? .empty)
      window.contentViewController = cusVC
      if let screen = NSScreen.main {
        window.window?.setFrame(screen.visibleFrame, display: true, animate: true)
      }
      window.window?.makeKeyAndOrderFront(nil)
    }
  }

WindowControllerFrom returns NSWindowController? and CUSViewController is a class which inherits from AbstractViewController.

I would appreciate any idea what can be wrong here, and why there is no problem on Monterey (both M1 and Intel), but crashes on Big Sur?