✅ ImmutableArray<T>.Contains(T, IEqualityComparer<T>) exists in one thread, but not another
this is a very confusing problem and i have not had any luck producing a minimal working example; i'm happy to provide any kind of info.
i'm making a mod for a game (Celeste) that involves compiling and loading C# source at runtime; i'm using
Microsoft.CodeAnalysis.CSharp
for this.
i already have a standalone prototype of that process and am trying to convert it into a mod.
for some reason, only in the mod version, when i call CSharpCompilation.Emit
, an error is thrown in the worker thread:
6 Replies
i then noticed that when i attach a debugger and test this method in the main thread it exists:
but, pausing on that exception in the worker thread, the same method no longer exists:
i have verified that these
ImmutableArray
types are both from the same System.Collections.Immutable.dll
path, so i don't understand how the debugger / runtime can find the method in one thread and not another.
i believe the Contains call throwing the exception is this one, though i'm not familiar enough with roslyn's structure to be surewhat is
AssemblyLoadContext.All.Count()
I cannot explain your threading thing, but if you're seeing that exception in general, you've mixed your versions of roslyn and its dependencies
In particular, I believe that API was added in System.Collections.Immutable 8.0.0, which means that you're using a very old version of SCI, with presumably a modern version of roslyn
thanks very much, downgrading roslyn to a version compatible with the System.Collections.Immutable i'm using worked! i guess the threading thing threw me off the more mundane cause haha
is there some way to mark this thread resolved?
$close
If you have no further questions, please use /close to mark the forum thread as answered