No announcement yet.

SortedSet<T> exists in both System and Bridge

  • Filter
  • Time
  • Show
Clear All
new posts

    SortedSet<T> exists in both System and Bridge

    I have a Bridge project that seems to be OK until I try to use the type System.Collections.Generic.SortedSet<T>, at which point I get the error:
    Error CS0433 The type 'SortedSet<T>' exists in both 'System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'Bridge, Version=, Culture=neutral, PublicKeyToken=null'
    Having searched for similar issues in the forums, I found this post which reports a similar problem using HashSet<T>. However, when I tried to use HashSet<T> in my own code, it compiled without complaint - so the problem I'm experiencing seems to be specific to the use of SortedSet<T>. We've used SortedSet<T> extensively in well-established C# code that I'm attempting to cross-compile to JavaScript, so replacing it with an alternative approach is not an easy choice. Any idea what can be done to resolve this?
    Last edited by geoffrey.mcgill; 2019-04-09 @ 06:35 PM.

    Hello @ggreig!

    You get this problem only and only when you reference System.Collections.Generic.SortedSet in your code? I couldn't reproduce this if I drew a simple application either in Deck, or run it in a local Bridge project.

    This error message is common in Bridge if you create a new project in non-standard ways, and end up not including the required files; more specificly the <NoStdLib>True</NoStdLib> to the project definition.

    But if that's the case, this would trigger for whatever (from System.* namespace) you reference in your project. Only if for some reason you have installed a Native NuGet package implementing that namespace that then will conflict, even though you didn't include the std lib (mscorlib, System.*) in the project.

    Hope this helps!


      I didn't succeed in tracking down the cause of the issue (it wasn't the NoStdLib property, which was already in place), but I ultimately resolved it by recreating the project afresh and everything worked OK. Thanks for your advice!