Search Issue Tracker

Duplicate

Votes

0

Found in

2017.3.0b9

Issue ID

968644

Regression

No

Value does not fall within the expected range Exception on creating script in the same folder where Assembly Definition file is

Scripting

-

Steps to reproduce:
1. Open any Unity project/create new
2. Create a new Assembly Definition file (or use existing)
3. Create a new Script in the same folder
4. Double click to open the Script from #3

Note: Visual Studio should be set as the External Script Editor

Tested on: 2017.3.0a1, 2017.3.0b9, 2018.1.0a4
Not tested on pre 2017.3 because the feature was not available

Expected result: no exceptions are thrown
Actual result: the following exception is thrown

ArgumentException: Value does not fall within the expected range.
SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit.LanguageOf (SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit unit)
SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit.CompilationUnits (System.String method)
SyntaxTree.VisualStudio.Unity.Bridge.CompilationUnit.CompilationUnits ()
SyntaxTree.VisualStudio.Unity.Bridge.ProjectSystem.UnitySolutionBuilder..ctor ()
SyntaxTree.VisualStudio.Unity.Bridge.ProjectSystem.UnitySolutionBuilder.CreateSolutionFromAssetDatabase ()
SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilesGenerator.GenerateProject ()
SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilePostprocessor.OnPreGeneratingCSProjectFiles ()
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.AssetPostprocessingInternal.OnPreGeneratingCSProjectFiles () (at C:/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:61)
UnityEditor.VisualStudioIntegration.SolutionSynchronizer.Sync () (at C:/buildslave/unity/build/Editor/Mono/VisualStudioIntegration/SolutionSynchronizer.cs:186)
UnityEditor.SyncVS.SyncIfFirstFileOpenSinceDomainLoad () (at C:/buildslave/unity/build/Editor/Mono/SyncProject.cs:201)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Comments (7)

  1. GenericToast

    Oct 07, 2018 05:50

    Following koonim's solution worked for me, thanks koonim!

  2. osamaAhmed

    Aug 30, 2018 08:04

    i have fixed that ....
    1 - just change the external code editor to Visual Studio Code
    2- open any script file then you will have a SLN in your directory project folder
    3- change the external code editor back to Visual Studio Community and Done !

  3. sisocano

    Aug 05, 2018 16:28

    [ problem solved for me ]

    1- Upgrade Visual Studio 2015 to the last version Version v3.7.0.1

    Last updated 10/05/2018 à 01:27:4

    2- Restart Unity and VS
    3- open visual studio and go to tools-->NuGet Package Manger --->Package Manager Console

    Install-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform

    thats work .

    you can t tracked visual studio erros on .log file to know what was te problem.

    4- inser this :

  4. loki1224

    Jul 15, 2018 06:07

    you are a F**king legend KOONM i swear lol i almost was at the point of just going and buying another pc to see if that would fix my problem

  5. ugly_uck

    Jul 09, 2018 17:53

    Koonm fixed that issue. Now 3 more with Unity 2018 and then I can finally check out the new Unity 2018.

  6. einWikinger

    Apr 20, 2018 18:31

    I'm running into this issue in 2017.3.1p4 when I try to invoke UnityEditor.SyncVS.SyncSolution() (by using reflection). I require the VS SLN to exist so that I can run analysis tools on the visual studio projects.
    Also I'd expect this should work without any VS tools available, otherwise it's make my use-case completely obsolete.. sigh.

  7. paulsohops

    Mar 26, 2018 00:29

    I had the same issue (running the 2018.1.0b11 beta version) as well as Visual Studio 2017 community edition. I had initially clicked an option to install unity tools when installing VS 2017, but reinstalling the tools as suggested by koonm fixed the issue for me too.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.