microsoft / microsoft/node-api-dotnet

Report the full .NET exception stack trace in fatal errors

Open
#386 3 comments 0 reactions 1 assignee View on GitHub

@jasongin is already working on this.

Since Oct 10, 2024.

threading
Dominant language
C#
Stars
783
Forks
80
PR merge metrics
No merged PRs in 30d

Description

There are a couple places in JSThreadSafeFunction that call JSError.Fatal(ex.Message), where the exception message alone might not be enough information to diagnose the error.

As an example, a particular AOT trimming problem resulted in an error:

FATAL ERROR: DefaultCallJS at D:\a\1\s\src\NodeApi\Interop\JSThreadSafeFunction.cs:303
Constructor on type 'Microsoft.Extensions.Http.Resilience.Routing.Internal.RequestRoutingOptions' not found.

The full stack trace revealed that type instantiation was attempted by Activator.CreateInstance() which clearly indicates a trimming issue because the trimmer does not detect such dynamic instantiations.

Either the fatal error message should include the exception stack trace, or we should find a way to propagate the exception as a non-fatal JS error, where the .NET stack will be merged with the JS stack.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.