Unity 4.3.3 Type.GetMembers(BindingFlags) crash

After upgrade to 4.3.3 Type.GetMethods(BindingFlags) and other abstract methods in Type class don’t work in windows phone. All builds fine, but on execution we get MissingMethodException. In Unity 4.3.2 all worked.

I attached test project that illustrates this problem.

1487185–82773–$Test.7z (2.88 KB)

Please, submit a bug report.

Run into the similar problem: “Exception: Method not found: ‘System.TypeCode System.Type.GetTypeCode(System.Type)’.”
http://goo.gl/DvQ8NH
Please notify me if there are some updates on this topic.

Upd. Script to reproduce:

sealed class IssueReproductionScript : UnityEngine.MonoBehaviour
{
	internal void OnGUI()
	{
		UnityEngine.GUILayout.Label(_label);
	}

	internal void Start()
	{
		try
		{
			var typeCode = System.Type.GetTypeCode(typeof(System.DateTime));
			_label = typeCode.ToString();
			UnityEngine.Debug.Log(_label);
		}
		catch (System.Exception ex)
		{
			_label = ex.ToString();
			UnityEngine.Debug.LogError(_label);
		}
	}

	private string _label = System.DateTime.Now.ToString("s");
}

I’ve been facing the same issue all day with 4.3.3. After reading the thread, I downgraded to 4.3.2 and the game now runs perfectly fine.

The missing methods were [List[ ] Type.GetProperties(BindingFlags)] and [System.TypeCode System.Type.GetTypeCode(System.Type)].

Alain-Daniel

I have been having same Missing Method exception problem with System.Type.GetMethod (and System.Type.GetFields ??).

I have been trying to write a workaround that calls through to the WP8 side, but this hits the problem that when I try to write a function inside my VS project that uses binding flags it tells me it has been defined twice. (once in WinRTLegacy.dll, once somewhere else that I think comes from windows… mscorelib perhaps?)

I can use an alias to reference the BindingFlags inside WinRTLegacy, but have not yet figured out how to reference the other version in order to try to call the original, correct functions from inside by WP8 visual studio project.

Sorry about fuzzy description. Since this apparently is a bug, I can give a proper bug report when I get back to work.

@bem13: I “solved” the problem by going back to version 4.3.2 of Unity. Unless there is something specific you need from 4.3.3, it shouldn’t cause trouble at all.

Hi,

we found the cause of this. It’s a regression that made its way with updated WinRTLegacy.dll. We added bunch of types unavailable to WP8/Windows Store Apps to it in 4.3.3, like System.IO.StreamReader and System.Reflection.BindingFlags. We didn’t notice that the latter is actually available on Windows Phone 8, so by adding it, we introduced the bug where type assembly and method assembly doesn’t match, thus the error.

There’s a workaround, though:

Install Unity 4.3.2 to a separate folder, and copy Editor\Data\PlaybackEngines\wp8support\Managed\WinRTLegacy.dll to the same place in Unity 4.3.3 installation folder. I know it’s not very nice, but that’s the best solution we can offer you at this moment.

NOTE: Always backup your project before trying something like this.

Tautvydas, thank you very much for response!

Are there any estimates when the next fixed version of Unity will be available?

I don’t think so. I wouldn’t count on it coming very soon, though, especially since there is a workaround.

Thanks guys for looking into this!

Just an FYI, I filed a bug report on this as well as it completely broke my JSON .NET Serializer running on the device for Windows Phone using Unity 4.3.3. This update has broken some very basic underlying functionality and I’m hoping it is fixed soon. I’m finding it a bit hard to believe that there is no plan to fix a bug that was just introduced simply because there’s a workaround for it. It’s one thing if it had broken something in the Unity API, but it broke some basic .NET functionality.

It’s really not at all a professional and responsible attitude for an Awesome company like Unity to create a bug and then let its customers to “work around” the bug.

Hi, I couldnt spot this in the issue tracker but I didn’t see mention of it being fixed in 4.3.4. (havent installed 4.3.4 yet because I dont know if the workaround is still robust)

Any updates? I would certainly vote this one up if it is in the tracker!

I submitted a bug on the 27th:

#587845

It’s still marked as “Open” and hasn’t made it into the issue tracker yet. I’m assuming the same workaround will work and it’s not fixed yet in 4.3.4 since that update only fixed an iOS issue. If it’s still not working on 4.3.4 you should submit another bug. By the sound of the developer’s comments above, this one will likely go largely ignored unless some folks push for it. I’ll update here if my bug ever gets put into the issue tracker so you can vote for it.

Hi,

when I wrote that we discovered what was wrong, that was the day we fixed it internally. Sorry for not making it clear. The fix will be included in the very next Unity release (not 4.3.x).

As for the workaround, it will work on 4.3.4 as well.

Thanks for the clarification. Glad you guys are fixing it. I realize it may not have been the highest priority because Windows Phone has a lower saturation and I think any level headed individual would understand that. I was just concerned because of this comment:

Which made it appear that you had completely deprioritized it.

I see. By that I meant that we aren’t pushing a hotfix for this issue.

Tautvydas: Will the missing GetTypeCode get fixed in the next update?
4.3.x won’t get the fixes?

That’s what he’s saying yes. It won’t be hotfixed but it will be included in the next release (probably 4.4.0 would be my guess). It’ll be in the next minor revision but not hot fixed into a 4.3.x release.

i did the workaround and copied the dll from 4.3.2 to my 4.3.3 folder.
no i’m getting the next error:
Error building Player: Exception: Failed to run assembly preprocessor with command line “Temp/StagingArea/Data/Managed\Boo.Lang.dll” -injectCtor -assemblyPath “Temp/StagingArea” -pdb.[Temp/StagingArea/Data/Managed\Boo.Lang.dll]
No symbols for Temp/StagingArea/Data/Managed\Boo.Lang.dll
Injecting ctor
Error while in assembly preprocessor Temp/StagingArea/Data/Managed\Boo.Lang.dll