Troubles with IEnumerable

Started by Wexit, September 23, 2019, 09:51:42 PM

Previous topic - Next topic

Wexit

So I keep getting TypeLoadExceptions any time I use IEnumerable objects. When trying to use 'yield return instruction' in a Harmony transpiler, of even just using a regular old enumerable like so:

IEnumerable<Pawn> pawns = pawn.Map.mapPawns.SpawnedPawnsInFaction(pawn.Faction).Where(x => x != pawn);

Once this code is executed, the below exception occurs. Best I can tell is that it is a dependency or reference error.
System.TypeLoadException: Could not load type 'System.Func`2' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

Using
Harmony 1.2.0.1
HugsLib 6.1.3
.net 4.7.2

I've seen examples where other mods are doing the exact same thing (especially transpilers) code-wise, so I doubt that that's an issue. Any ideas what I've screwed up?

Red192

sorry for the stupid question but we are not suppose to use only .net 3.5?

Wexit

#2
So I have read that as well (in a post from 2016) but when I try to compile with 3.5, my ide warns me that harmony and hugslib were compiled with 4.7.2 and the build fails. Is it still supposed to be 3.5?
Scratch that, I somehow got ahold of the 4.7.2 build of Harmony instead of 3.5.

Red192

I don't use hugs lib at the moment but harmony work fine with 3.5, in any case I don't know what are the differences between the two version