Search Unity

System.NotSupportedException in unity 2019 only in Build mode

Discussion in 'Windows' started by PaulKamma, Sep 11, 2019.

  1. PaulKamma

    PaulKamma

    Joined:
    Apr 17, 2013
    Posts:
    2
    We use the AxSeriel COM Driver from https://www.activexperts.com/serial-port-component/ . It's a DLL that is placed in the Scripts folder and then used in c#.

    In the Editor everything works fine but when we create a build we get the NotSupportedException error thrown.
    The Whole construct worked with the 2018 Version of Unity, after the Update this problem appeared.

    Code (csharp):
    1. System.NotSupportedException: Specified method is not supported.
    2.   at (wrapper cominterop) AxSerial.ComPortClass..ctor()
    3.   at MyNamespace.Serial.SerialManager.initComponents () [0x0005d] in C:\Users\MYUSER\Documents\Unity\MYPROJECT\Assets\Scripts\Serial\SerialManager.cs:86
    4.  
    We've tried verious solutions that we found all over the internet loke creating a DLL folder in the Assets root and palce the dll there and alos copy itin the Unity/Editor folder etc. Nothing worked :/

    Maybe someone have a Hint/Solution for this problem.

    Thanks.
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    6,443
    Which platform are you building to? Did you try using IL2CPP scripting backend?

    What API Compatibility level are you using? Could you try using .NET 4.x?
     
    PaulKamma likes this.
  3. PaulKamma

    PaulKamma

    Joined:
    Apr 17, 2013
    Posts:
    2
    Ok it works with .NET 4.x. Didn't thought of that.
    Thank you.
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    6,443
    The reason this worked in the editor is because the editor always runs in .NET 4.x mode, regardless of the player setting.