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

IL2CPP error in assembly System.Data.Linq.dll... key... not present in the dictionary

Discussion in 'iOS and tvOS' started by larcah, Jan 6, 2020.

  1. larcah

    larcah

    Joined:
    Apr 6, 2018
    Posts:
    4
    I'm trying to build a game as iOS on Mac for the first time and receiving this error:

    Code (CSharp):
    1. IL2CPP error for type 'System.Data.Linq.Table`1' in assembly '/Users/larcah/Desktop/r/UsefulPoetry/Cyborg/PrismaticMaze/Temp/StagingArea/Data/Managed/System.Data.Linq.dll'
    2. Additional information: The given key 'System.Collections.Generic.IEnumerator`1<!0> System.Collections.Generic.IEnumerable`1<TEntity>::GetEnumerator()' was not present in the dictionary.
    It looks like it's having trouble converting a .NET 4.5 library to c++. I'm not sure what to do to work around this or even if it's a by-design limitation that I need to redesign some of my code to avoid dependencies...

    I am using my own c# libraries, some of which depend on those core windows libraries. I think those libraries are implemented on Mac as part of Mono but honestly I'm not totally sure about that.

    Anyone encounter this, know how to fix/get-past it or able to provide some additional context into the error?

    PS: I get the same error trying to build the same project as iOS in Unity on a windows machine. I was able to build a new hello-world project on iOS, was able to build it in xcode & deploy it to test iPhone successfully. Unity 2019.3.0f1.
     
    Last edited: Jan 7, 2020
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,789
    Unity does not support any assemblies built against .NET Core. If possible, please build this assemblies against .NET Standard 2.0 or .NET Framework.
     
  3. larcah

    larcah

    Joined:
    Apr 6, 2018
    Posts:
    4
    Sorry, I should have been more specific - these are libraries built against .NET Framework using .NET 4.5.
    Also, I am able to build and run the same game project as a PC or Mac game without error.
     
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,789
    Oh, I see you wrote "core dotnet", but I ready "dotnet core"! Sorry about that!

    Can you submit a bug report with this project? This is something we should investigate.
     
  5. larcah

    larcah

    Joined:
    Apr 6, 2018
    Posts:
    4
    Thanks for the help - working on isolating the cause of the error. Will update w/ more info or log bug once it's narrowed down.
     
  6. larcah

    larcah

    Joined:
    Apr 6, 2018
    Posts:
    4
    Ok, narrowed the repro down to be super simple:
    Code (CSharp):
    1. DataContext context = new DataContext("test");
    2. context.GetTable<TestScript>().AsEnumerable();
    Only caveat is you need to make the unity project refer to System.Data.Linq.dll via csc.rsp file b/c Unity doesn't reference this by default.

    Build that in Unity 2019.03.0f1 (haven't tested other versions) to iOS w/ .net 4.x and it'll throw error:
    Code (CSharp):
    1. IL2CPP error for type 'System.Data.Linq.Table`1' in assembly 'C:\r\UsefulPoetry.Experimental\Repros\TestProject3\Temp\StagingArea\Data\Managed\System.Data.Linq.dll'
    2. Additional information: The given key was not present in the dictionary.
    Repro project attached. I will work on logging this as a bug.

    PS: noticed the reference to 'TestScript' in the second line of the repro above... don't think the class used there matters, just used the name of the class that code was in.

    PPS: link to bug: http://fogbugz.unity3d.com/default.asp?1210714_qs56kv1cjbmevcof
     

    Attached Files:

    Last edited: Jan 10, 2020
  7. bhansalideepika

    bhansalideepika

    Joined:
    Dec 11, 2013
    Posts:
    3

    Attached Files:

  8. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,789
    Thanks for the details. Note that we have corrected the original issue, and a fix should be availble in a 2019.3 release soon.