Hi, I have an project that use a dll. What is the right way to export the project together with my custom dll? Here the error:

    Unhandled Exception:
    System.TypeInitializationException: The type initializer for 'Sys' threw an exception. ---> System.DllNotFoundException: System.Native assembly:<unknown assembly> type:<unknown type> member:(null)
      at (wrapper managed-to-native) Interop+Sys.LChflagsCanSetHiddenFlag()
      at Interop+Sys..cctor () [0x00000] in <2606d1e3191f45969af1cc6149da86d0>:0 
       --- End of inner exception stack trace ---
      at System.Number.DoubleToNumber (System.Double value, System.Int32 precision, System.Number+NumberBuffer& number) [0x000b2] in <2606d1e3191f45969af1cc6149da86d0>:0 
      at System.Number.FormatSingle (System.Text.ValueStringBuilder& sb, System.Single value, System.ReadOnlySpan`1[T] format, System.Globalization.NumberFormatInfo info) [0x000d1] in <2606d1e3191f45969af1cc6149da86d0>:0 
      at System.Number.FormatSingle (System.Single value, System.String format, System.Globalization.NumberFormatInfo info) [0x0001e] in <2606d1e3191f45969af1cc6149da86d0>:0 
      at System.Single.ToString () [0x00008] in <2606d1e3191f45969af1cc6149da86d0>:0 
      at Godot.Vector2.ToString () [0x00001] in <bde67218aec4446f97aac988b2b6561a>:0 
      at DesertEdge.BaseScreen._Process (System.Single delta) [0x00022] in <7b833db5d491428aac4de73f30768c79>:0 

EDIT: The point where the error seems show up is this section that is working in source project:

_mousePosition = GetViewport().GetMousePosition();
 ((Label)GetNode("MousePositionLabel")).Text = _mousePosition.ToString();
Label)GetNode("MousePositionLabel")).SetGlobalPosition(new Vector2(_mousePosition.x - 20, _mousePosition.y - 20));

this is my csproj

<Project Sdk="Godot.NET.Sdk/3.3.0">
  <PropertyGroup>
    <TargetFramework>net472</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    <Reference Include="GodotUtilities">
      <HintPath>..\Utils\Utils\bin\Debug\netstandard2.0\GodotUtilities.dll</HintPath>
    </Reference>
  </ItemGroup>
</Project>

GodotUtilities.dllis my custom dll

Thank you.

Is Utils a folder in your Godot project? If so, I think you can just use Utils\Utils\bin\Debug\etc to get the path, at least based on a project I've worked on that uses a custom .dll file.

I investigate a bit more and: I reach GodotUtils.dll already because I have in shell logs that are in dll:

    (base) vale@debianace:~/Desktop/DesertEdgeTest/test$ ./desert_edge_sharp.x86_64 
Godot Engine v3.4.beta4.mono.official.6a058cbf3 - https://godotengine.org
OpenGL ES 3.0 Renderer: Mesa DRI Intel(R) HD Graphics 4000 (IVB GT2)
OpenGL ES Batching: ON
 
ERROR: Mono: Core API hash mismatch.
   at: _init_godot_api_hashes (modules/mono/mono_gd/gd_mono.cpp:490)
Mono: Log file is: '/home/vale/.local/share/godot/app_userdata/Client/mono/mono_logs/2021-08-30_16.54.55_448458.log'
(448458) 16:54:55.980  :DEBUG	Setup[Void _Ready()] 
(448458) 16:54:55.996  :DEBUG	Main[Void _Ready()] 
(448458) 16:54:55.997  :DEBUG	LoginScreen[Void SetWindowSize()] 
(448458) 16:54:56.014  :DEBUG	LoginScreen[Void _Ready()] 
(448458) 16:54:56.030  :DEBUG	LoginScreen[Void OnConnectionSelected(System.String)] 
<snip>

for example: the (448458) 16:54:55.980 :DEBUG Setup[Void _Ready()] are format logs that are made in my dll

But I have other errors (like the one posted here) that I don't have when I run the original project in godot editor.

I think the error line in the stak I posted: at Godot.Vector2.ToString () [0x00001] in <bde67218aec4446f97aac988b2b6561a>:0

is referred to this conversion _mousePosition.ToString() that make no sense. Why Tostring() fail?

edit: the scene where the error came out is a scene that will be freed using queuefree.. Its something related? edit2: I commented the section in error and I have another error further on:

    (base) vale@debianace:~/Desktop/DesertEdgeTest/test$ ./desert_edge_sharp.x86_64 
    Godot Engine v3.4.beta4.mono.official.6a058cbf3 - https://godotengine.org
    OpenGL ES 3.0 Renderer: Mesa DRI Intel(R) HD Graphics 4000 (IVB GT2)
    OpenGL ES Batching: ON
     
    ERROR: Mono: Core API hash mismatch.
       at: _init_godot_api_hashes (modules/mono/mono_gd/gd_mono.cpp:490)
    Mono: Log file is: '/home/vale/.local/share/godot/app_userdata/Client/mono/mono_logs/2021-08-30_16.54.55_448458.log'
    (448458) 16:54:55.980  :DEBUG	Setup[Void _Ready()] 
    (448458) 16:54:55.996  :DEBUG	Main[Void _Ready()] 
    (448458) 16:54:55.997  :DEBUG	LoginScreen[Void SetWindowSize()] 
    (448458) 16:54:56.014  :DEBUG	LoginScreen[Void _Ready()] 
    (448458) 16:54:56.030  :DEBUG	LoginScreen[Void OnConnectionSelected(System.String)] 
  <SNIP>
    (448458) 16:55:04.969  :DEBUG	Main[Void OnNewPlayerServerUpdated()] 
    (448458) 16:55:04.972  :DEBUG	Mock[Void AcceptAgreement()] Mocking accept agreement
    (448458) 16:55:04.973  :DEBUG	Center[Void _on_AgreeButton_pressed()] 
    (448458) 16:55:04.973  :DEBUG	Main[Void OnLicenseAgreed()] 
    (448458) 16:55:04.977  :DEBUG	BaseScreen[Void _Ready()] 
    (448458) 16:55:04.978  :DEBUG	Mock[Void GoToBattle()] Mocking start battle
    (448458) 16:55:04.979  :DEBUG	Setup[Void OnPlayPressed()] 
    (448458) 16:55:04.980  :DEBUG	BaseScreen[Void SetWindowSize()] 
    (448458) 16:55:04.981  :DEBUG	BaseScreen[Void SetupBasescreen()] 
    (448458) 16:55:04.998  :DEBUG	Setup[Void PreStartLevel()] 
    
    Unhandled Exception:
    System.TypeInitializationException: The type initializer for 'Sys' threw an exception. ---> System.DllNotFoundException: System.Native assembly:<unknown assembly> type:<unknown type> member:(null)
      at (wrapper managed-to-native) Interop+Sys.LChflagsCanSetHiddenFlag()
      at Interop+Sys..cctor () [0x00000] in <2606d1e3191f45969af1cc6149da86d0>:0 
       --- End of inner exception stack trace ---
      at System.Number.DoubleToNumber (System.Double value, System.Int32 precision, System.Number+NumberBuffer& number) [0x000b2] in <2606d1e3191f45969af1cc6149da86d0>:0 
      at System.Number.FormatSingle (System.Text.ValueStringBuilder& sb, System.Single value, System.ReadOnlySpan`1[T] format, System.Globalization.NumberFormatInfo info) [0x000d1] in <2606d1e3191f45969af1cc6149da86d0>:0 
      at System.Number.FormatSingle (System.Single value, System.String format, System.Globalization.NumberFormatInfo info) [0x0001e] in <2606d1e3191f45969af1cc6149da86d0>:0 
      at System.Single.ToString () [0x00008] in <2606d1e3191f45969af1cc6149da86d0>:0 
      at Godot.Vector2.ToString () [0x00001] in <bde67218aec4446f97aac988b2b6561a>:0 
      at Godot.Rect2.ToString () [0x00001] in <bde67218aec4446f97aac988b2b6561a>:0 
      at Godot.GD+<>c.<GetPrintParams>b__5_0 (System.Object x) [0x00006] in <bde67218aec4446f97aac988b2b6561a>:0 
      at System.Array.ConvertAll[TInput,TOutput] (TInput[] array, System.Converter`2[TInput,TOutput] converter) [0x00029] in <2606d1e3191f45969af1cc6149da86d0>:0 
      at Godot.GD.GetPrintParams (System.Object[] parameters) [0x0001d] in <bde67218aec4446f97aac988b2b6561a>:0 
      at Godot.GD.Print (System.Object[] what) [0x00001] in <bde67218aec4446f97aac988b2b6561a>:0 
      at DesertEdge.Utils.Log.PrintMessage (System.String postfix, System.Object[] messages) [0x00079] in <10dcab3046b147588e626d3232b86983>:0 
      at DesertEdge.Utils.Log.Print (System.String level, System.Object[] messages) [0x00167] in <10dcab3046b147588e626d3232b86983>:0 
      at DesertEdge.Ground._Ready () [0x00014] in <ccf5b0215a6441cfb64e54c0693f139b>:0 
      at (wrapper managed-to-native) Godot.NativeCalls.godot_icall_2_438(intptr,intptr,intptr,bool)
      at Godot.Node.AddChild (Godot.Node node, System.Boolean legibleUniqueName) [0x00012] in <bde67218aec4446f97aac988b2b6561a>:0 
      at DesertEdge.Main.ShowBorderland () [0x0004e] in <ccf5b0215a6441cfb64e54c0693f139b>:0 
      at (wrapper managed-to-native) Godot.NativeCalls.godot_icall_2_537(intptr,intptr,string,object[])
      at Godot.Object.Call (System.String method, System.Object[] args) [0x0000c] in <bde67218aec4446f97aac988b2b6561a>:0 
      at DesertEdge.Singleton.Setup.PreStartLevel () [0x00020] in <ccf5b0215a6441cfb64e54c0693f139b>:0 



Seems same kind of error:

at Godot.Vector2.ToString () [0x00001] in <bde67218aec4446f97aac988b2b6561a>:0

this time the error is related to Log.Print(Log.DEBUG, GetUsedRect());

In effect in stack trace I have these two rows:

      at Godot.Vector2.ToString () [0x00001] in <bde67218aec4446f97aac988b2b6561a>:0 
      at Godot.Rect2.ToString () [0x00001] in <bde67218aec4446f97aac988b2b6561a>:0 

Update: I investigate more.... and... I had dll and project compiled using two different godot version. :astonished: Once I used the sabe version for both dll and project the

 Unhandled Exception:
 System.TypeInitializationException: The type initializer for 'Sys' threw an exception.

Disappeared.

Updated git issue too.

Thanks @TwistedTwigleg :)