Unity VS: InvalidOperationException: Operation is not valid due to the current state of the object

Hi I’m getting a new error with 4.6 and Unity VS 2012. I can’t generate a project file!

Any thoughts?

InvalidOperationException: Operation is not valid due to the current state of the object
System.Linq.Enumerable.First[CompilationUnit] (IEnumerable1 source, System.Func2 predicate, Fallback fallback)
System.Linq.Enumerable.First[CompilationUnit] (IEnumerable1 source, System.Func2 predicate)
SyntaxTree.VisualStudio.Unity.Bridge.ProjectSystem.UnitySolutionBuilder.ProjectFor (Language language, ProjectType type, IEnumerable`1 assets)
SyntaxTree.VisualStudio.Unity.Bridge.ProjectSystem.UnitySolutionBuilder.CreateSolution ()
SyntaxTree.VisualStudio.Unity.Bridge.ProjectSystem.UnitySolutionBuilder.CreateSolutionFromAssetDatabase ()
SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilesGenerator.OpenInVisualStudio ()
SyntaxTree.VisualStudio.Unity.Bridge.UnityMenu.OpenInVisualStudio ()

Any Ideas on this? I’m totally blocked as Mono develop wont support default params and Unity VS wont build a project file. I have no idea whats going on with this or what could cause this.

Any chance someone from Unity can give me a hint where to look? Still having this issue. I’ve reinstalled everything but it happens on all computers with the project. No clue what could even cause this.

Have you tried removing/re-adding the UnityVS package from your Unity project?

I’m getting the same exact error. Did you manage to fix it?

Not an official answer - just a quick thought …

Have you guys tried moving aside some of the generated files and have them be regenerated? (e.g. All of the Unity VS project files. Then before trying to open, explicitly press the “generate” menu item?)

If no help, is there anything more useful in the console log if you open it in an external editor?

Otherwise, while you’re waiting for someone actually useful to answer :wink: you can get MonoDevelop to allow compilation of default parameters by switching target platform to 4 (for each assembly that uses them).

HTH

Same error here, did someone fix it?

Solved!! At least for me…

Turns out UnityVS does not work well with the Plugins folder, I deleted the folder and put all the plugins on \Assets and worked like a charm, once the solution was properly built and tested all the functionality I created the Plugins folder again and… everything worked!! :smile:

1 Like

Nice one Mangus!!! That is exactly the problem