Skip to content

Fix SherpaOnnx finalizer crash with DllNotFoundException#745

Open
williamwwm wants to merge 1 commit into
openclaw:mainfrom
williamwwm:main
Open

Fix SherpaOnnx finalizer crash with DllNotFoundException#745
williamwwm wants to merge 1 commit into
openclaw:mainfrom
williamwwm:main

Conversation

@williamwwm

Copy link
Copy Markdown

Suppress fatal crashes caused by SherpaOnnx.OfflineTts finalizer calling SherpaOnnxDestroyOfflineTts when native DLL is unavailable.

Changes:

  • PiperTextToSpeechClient: gracefully handle DllNotFoundException in constructor (TTS disabled gracefully), add GC.SuppressFinalize after dispose to prevent finalizer from calling native code during GC
  • App.xaml.cs: improved OnDomainUnhandledException logging for SherpaOnnx native DLL errors
  • Crash prevention relies on exe.config legacyUnhandledExceptionPolicy and GC.SuppressFinalize (IsTerminating is readonly in .NET 10)

Fixes repeated crashes: System.DllNotFoundException: Unable to load DLL 'sherpa-onnx-c-api' at SherpaOnnx.OfflineTts.Finalize()

Suppress fatal crashes caused by SherpaOnnx.OfflineTts finalizer
calling SherpaOnnxDestroyOfflineTts when native DLL is unavailable.

Changes:
- PiperTextToSpeechClient: gracefully handle DllNotFoundException
  in constructor (TTS disabled gracefully), add GC.SuppressFinalize
  after dispose to prevent finalizer from calling native code during GC
- App.xaml.cs: improved OnDomainUnhandledException logging for
  SherpaOnnx native DLL errors
- Crash prevention relies on exe.config legacyUnhandledExceptionPolicy
  and GC.SuppressFinalize (IsTerminating is readonly in .NET 10)

Fixes repeated crashes: System.DllNotFoundException: Unable to load
DLL 'sherpa-onnx-c-api' at SherpaOnnx.OfflineTts.Finalize()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants