0

I'm working with Unity 4.6, in case that's relevant.

The full error (runtime error, not compile-time):

VerificationException: Error verifying UtilityExtensions:DeserializeFromEditorPrefs<T> (T,string): Could not merge stack at depth 1, types not compatible: T ([boxed] Complex) X T ([boxed] Complex) at 0x01ca

Definition of DFEP:

public static T DeserializeFromEditorPrefs<T>(this T o, string prefix) where T : class {

This is the line that causes the exception (it doesn't matter what type I use; all types cause the exception; the function has no problem working with bad input data, the error is actually in the invocation):

UtilityExtensions.DeserializeFromEditorPrefs(new AbilityInfuse(),"");

I can't figure out what's going on. I use this function in other projects, so maybe it's a project setting, but I haven't been able to find any information on what could be causing this error. There are some variants of this function as well, none of which seem to work. Other generic extensions from the same file are working with no problem, it is only this one set of functions that won't run.

AbilityInfuse is marked Serializable, and even with a serializable empty class the problem persists.

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Loius
  • 13
  • 2
  • 1
    Do you have any post-compile weaver tools? (commonly used by aspect-oriented programming, among other cases) – Ben Voigt Apr 04 '15 at 20:20
  • http://forum.unity3d.com/threads/windows-8-phone-failed-to-run-serialization-weaver.236660/ It appears that Unity does have a weaver built in. I have never heard the term 'weaver' before now so I guess I have some research ahead of me. – Loius Apr 04 '15 at 21:18
  • Are you running on Mono or Microsoft .NET CLR? Mono had a related bug https://bugzilla.xamarin.com/show_bug.cgi?id=10441 although that was fixed several versions ago – Ben Voigt Apr 04 '15 at 22:21
  • I believe my Unity version (4.6) uses Mono and .NET 2.0 / 2.0 subset (I don't really know too much about these things; just reading off the specs at this point). What I really find baffling is that this same code works in another project in the same Unity version. It's part of a library, but it isn't in its own DLL, it's compiled into each project. – Loius Apr 05 '15 at 01:09
  • Well if you showed the MSIL of that method after weaving (for example, use ildasm), we could see whether the verifier is correct. – Ben Voigt Apr 05 '15 at 01:10

1 Answers1

0

Unity uses high security settings when building to Web Player. I don't know exactly what any of the settings are, but switching to PC build removed whatever security setting it was that was preventing the function from being "verified".

Loius
  • 13
  • 2