Windows 10 and .NET Framework 3.5

Hello !

I switched from Windows 8 to Windows 10 recently and when i have opened my current project, i have noticed that coroutines doesn’t work anymore : in MonoDevelop “IEnumerator” is not recognized.

I think this is due to the version of .NET Framework : the 3.5 version is not activated. But when i enable it i get an error message : “the function attempted to use a name that is reserved to use by another transaction”.

So, can i dispense this version of .NET to use IEnumerator ? Or do you know a solution to enable .NET Framework 3.5 on windows 10 ?

Thanks !

I’m on Win10, but I usually use Visual Studio. Let me check MonoDevelop.

:: opens MonoDevelop, types IEnumerator ::

works for me.

Are you sure the code file has the ‘System.Collections’ namespace imported?

using UnityEngine;
using System.Collections;

public class MyClass : MonoBehaviour
{

//......

I say, because IEnumerator has not been removed from .Net. And the version of windows you’re on doestn’t effect what is available… it’s the version of .Net you’re using that changes what’s available. And with that said, Microsoft seldom removes things from the framework, only really adding things (there’s some exceptions of course). That way the frameworks remain backwards compatible.

Thank you for responding.

Yes System.Collections namespace is imported.
I see that the lists are not recognized either.

On this topic IEnumerator seems not to be recognized by the editor - Unity Engine - Unity Discussions someone say : "You’ve probably solved this by now, but if not, I have had that problem before. I was using the latest .net framework and I went to Programs and Features within control panel (if you’re using Windows) and selected the box to also run .net framework 3.5 I think it was.
I then shut down my project after saving, restarted my machine and it worked fine."

Did you try that?

Yes i did ! And get the error message “the function attempted to use a name that is reserved to use by another transaction”.

It appears you don’t have .net 3.5 installed at all, like it’s nowhere on your system.

You can try installing it.
https://www.microsoft.com/en-us/download/details.aspx?id=22

Or better, and what I’d do because I don’t like MonoDevelop. Is install Visual Studio.

It’s free:

It should install .net 3.5 when you install it. And srsly, it’s a lot better than MonoDevelop.

I honestly don’t know why MonoDevelop is complaining like this… 1) newer versions of .net have IEnumerator as well… and 2) doesn’t MonoDevelop use Mono? I don’t use MonoDevelop, so… :: shrugs ::

I have tried to install it yet. And i have Visual studio since i use Unity 5, so i tried also.

Visual studio ask me if i want dowload and install 3.5 or if i want switch to 4.5. If i chose the first option, i get the same problem. If i chose the second, it seem to switch to 4.5 but coroutines doesn’t work again and when i restart Unity and restart VS, Visual Studio ask me again…

I’ll search more about switching to 4.5.

The solution switch automaticly to 3.5 when i start Unity … Are you sure your projects are not set up on 3.5 ? Maybe Unity have an option for .NET version …

Ok, i have tried again and succeeded to install 3.5 … I think i have downloaded the wrong .NET Framework (the 8+ thinking that mean windows 8 and up), so if you have the same problem on windows 10, take this version : https://www.microsoft.com/en-us/download/confirmation.aspx?id=22

Thank you for your help lordofduct !

How are you opening your project?

If you’re opening the project through Unity, it should not be asking you to switch the project to 4.5. Unity targets a much older version of mono, you can’t use the features in 4.5.

edit:

aww, see you fixed it. Nevermind this.