Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

2018.1.0b10: guide for net core 2.0 dll integration

Discussion in 'Experimental Scripting Previews' started by fredczj, Mar 15, 2018.

  1. fredczj

    fredczj

    Joined:
    Apr 4, 2017
    Posts:
    7
    Hello!

    I am developing a game Framework based on .NETCore 2.0. I then followed Unity 2018 beta with interest.
    I have a Cloud Platform running ASPNetCore.SignalR Server side. It provides a .dll including a APSNETCore.SignalR client class (let's call it client.dll).
    Using .NET 4.6 Console application, I am able to reference this client.dll, instantiate a SignalRClient and communicates with my server.

    When moving to Unity3D 2018.1.0b10, I am able to run my application with framework4.6 without signalRClient connection.
    Now it comes to integrate SignalRClient. The project in Visual Studio of my Unity3D project accepts to reference the client.dll. When I insert the dll in Asset/Plugins/ for Unity3D to consider it, I have the following error:
    "Unloading broken assembly Assets/Plugins/Client.Common.dll, this assembly can cause crashes in the runtime".
    If I run the program anyway, I collect:
    "TypeLoadException: Could not find method due to a type load error".

    I have googled this for some time now, and even if they are few references on this, I cannot see a clear description on how to workaround this.
    My understanding is that the dotnet client.dll doesn't use types that can be used by Unity3D. But I cannot find a guide on how to make client.dll be portable to Unity.

    Have you already seen how to solve this?

    Fred
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,775
    If possible, you should compile your client.dll assembly against .NET Standard 2.0. In general, Unity will not support assemblies compiled against .NET Core.
     
  3. gamepower7

    gamepower7

    Joined:
    May 16, 2017
    Posts:
    27
    I've tested on 2018.1.6 , I've added a .Net Core Dll and access it from unity , it worked , but when testing SignalR Core Client got a "Unloading broken assembly"
     
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,775
    I guess that a .NET Core assembly might work in some cases, although Unity doesn't support assemblies compiled against .NET Core. So if one works, it is just by chance.
     
  5. thrmotta

    thrmotta

    Joined:
    May 27, 2014
    Posts:
    32
    @fredczj were you ever able to make AspNetCore.SignalR work with Unity?