Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

.NET dependencies resolving not working as expected #435

Open
Labels
@KirillBorunov

Description

@KirillBorunov

Hi, seems there is a problem with dependency resolving when the application is run by SampSharp vs when is run directly.
The test case is with the nuget packageSystem.Text.Json.
If I try to use it running the server then I get an exception (details below), but if I run the program as console application then it works ok.

Exception:

System.IO.FileLoadException: 'Could not load file or assembly 'System.Text.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)'

Seems to be related to the library with the same name included in the .NET Core but it happens only with SampSharp.
I tested only on Windows.

NuGet package:System.Text.Json 7.0.3

Test code:

publicstaticvoidMain(string[]args){System.Text.Json.JsonSerializer.Deserialize("{}",typeof(object));newGameModeBuilder().Use<GameMode>().Run();}

• If I run as server without NuGet package: loaded correct version fromSERVER_FOLDER\dotnet\shared\Microsoft.NETCore.App\6.0.7\System.Text.Json.dll
• If I run as console app without NuGet package: loaded correct version fromC:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\6.0.24\System.Text.Json.dll
• If I run as console app with NuGet package: loaded correct version fromSERVER_FOLDER\gamemode\Debug\net6.0\System.Text.Json.dll
• If I run as server with NuGet package:EXCEPTION!

What I tried:
copySystem.Text.Json.dll toSERVER_FOLDER:EXCEPTION!
copySystem.Text.Json.dll toSERVER_FOLDER\dotnet\shared\Microsoft.NETCore.App\6.0.7:WORKED!

Tried another package with no name conflictNewtonsoft.Json 13.0.3 and it works ok in all cases.

Seems when running SampSharp, it is trying to resolve the assemblies in wrong order paths, it seems that is checking the .NET libraries folders first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp