Repository: godot
Issue: Godot C# game (with nuget package Newtonsoft.Json) will crash after export
Labels: bug,needs testing,topic:dotnet,crash,topic:export

### Godot version

3.4.3.stable.mono.official

### System information

macOS 12.2.1, Intel, dotnet 3.1.416

### Issue description

Setup a c# script that using  Newtonsoft.Json to Serialize a Object. 
Works fine in Editor, but crash the game after export.

### Steps to reproduce

Step 1

Add Package Newtonsoft.Json Reference

```xml
<Project Sdk="Godot.NET.Sdk/3.3.0">
  <PropertyGroup>
    <TargetFramework>net472</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
  </ItemGroup>
</Project>
```

Step 2
Add c# Script to Node and calls the function

```c#
using Godot;
using Newtonsoft.Json;
using System;

public class DemoClass
{
  public String FirstName;
  public String LastName;
}
public class Board : Node2D
{
  // Declare member variables here. Examples:
  // private int a = 2;
  // private string b = "text";

  // Called when the node enters the scene tree for the first time.
  public override void _Ready()
  {
    var demoData = new DemoClass
    {
      FirstName = "John",
      LastName = "Doe"
    };

    var text = JsonConvert.SerializeObject(demoData);
    GD.Print(text);
  }
}
```

Step 3
Export game to macOS runnable, launch the app
Error log will show

```
Unhandled Exception:
System.TypeInitializationException: The type initializer for 'System.ComponentModel.TypeDescriptor' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Sys' threw an exception. ---> System.DllNotFoundException: /Users/zhoukaiwen/Downloads/godot_demo_macos/godot_sqlite_demo.app/Contents/MacOS/../Resources/GodotSharp/Mono/lib/../lib/libmono-native.dylib assembly:<unknown assembly> type:<unknown type> member:(null)
  at (wrapper managed-to-native) Interop+Sys.LChflagsCanSetHiddenFlag()
  at Interop+Sys..cctor () [0x00000] in <6a7c203f6f7a4f07b7fa766077730d49>:0 
   --- End of inner exception stack trace ---
  at Interop.GetRandomBytes (System.Byte* buffer, System.Int32 length) [0x00000] in <6a7c203f6f7a4f07b7fa766077730d49>:0 
  at System.Guid.NewGuid () [0x00000] in <6a7c203f6f7a4f07b7fa766077730d49>:0 
  at System.ComponentModel.TypeDescriptor..cctor () [0x00034] in <214c1648d17644e0bb16ed1332c9e163>:0 
   --- End of inner exception stack trace ---
  at Newtonsoft.Json.Serialization.JsonTypeReflector.CanTypeDescriptorConvertString (System.Type type, System.ComponentModel.TypeConverter& typeConverter) [0x00000] in <f74995119334484fb6db6825be2eac0d>:0 
  at Newtonsoft.Json.Serialization.DefaultContractResolver.CanConvertToString (System.Type type) [0x00000] in <f74995119334484fb6db6825be2eac0d>:0 
  at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract (System.Type objectType) [0x000ab] in <f74995119334484fb6db6825be2eac0d>:0 
  at System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue].GetOrAdd (TKey key, System.Func`2[T,TResult] valueFactory) [0x00034] in <6a7c203f6f7a4f07b7fa766077730d49>:0 
  at Newtonsoft.Json.Utilities.ThreadSafeStore`2[TKey,TValue].Get (TKey key) [0x00000] in <f74995119334484fb6db6825be2eac0d>:0 
  at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract (System.Type type) [0x0000b] in <f74995119334484fb6db6825be2eac0d>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.GetContract (System.Object value) [0x00011] in <f74995119334484fb6db6825be2eac0d>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.GetContractSafe (System.Object value) [0x00005] in <f74995119334484fb6db6825be2eac0d>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) [0x00028] in <f74995119334484fb6db6825be2eac0d>:0 
  at Newtonsoft.Json.JsonSerializer.SerializeInternal (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) [0x0023a] in <f74995119334484fb6db6825be2eac0d>:0 
  at Newtonsoft.Json.JsonSerializer.Serialize (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) [0x00000] in <f74995119334484fb6db6825be2eac0d>:0 
  at Newtonsoft.Json.JsonConvert.SerializeObjectInternal (System.Object value, System.Type type, Newtonsoft.Json.JsonSerializer jsonSerializer) [0x00028] in <f74995119334484fb6db6825be2eac0d>:0 
  at Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) [0x00007] in <f74995119334484fb6db6825be2eac0d>:0 
  at Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value) [0x00000] in <f74995119334484fb6db6825be2eac0d>:0 
  at Board._Ready () [0x0001d] in <012f315af41248adb781cad9d564780d>:0 
```

### Minimal reproduction project

Here is the demo project
[demo.zip](https://github.com/godotengine/godot/files/8193242/demo.zip)