none
Why does the cursor suddenly jump to an entirely different location in VS 2015???????

    Question

  • I really like Visual Studio 2015 with one major, nay HUGE exception. Very often, so often that it really slows down my development significantly, VS 2015 will jump the cursor from an entirely different location to God only knows where and why. Why does it do that???????????????????????????????????????????????????????????????

    I completely HATE THIS BEHAVIOR AND WANT IT TO STOP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    For example here's some code I just wrote:

    if (AddingNewRecord)
    {
    	return false;
    }
    I'll place the cursor on the closing bracket (}), because I now want to add code after this. Will VS 2015 let me?

    NO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    Instead for reasons I have no idea why, VS 2015 will the instant I start typing, move the cursor to the semicolon (;) after the keyword false. WHY DOES VS 2015 DO THAT??????????????????????????????????

    It always does that. Getting out of VS 2015 doesn't stop VS 2015 from doing that. Rebooting my PC doesn't stop VS 2015 from doing that. It always does this. It does it in any solution/project/project type. It always does this and I'm getting extremely sick of it because of the HOURS I've spent undoing code I began writing, since VS 2015 got it into its head that the code is supposed to someplace other than where I had the cursor.

    So is there some sort of setting I don't know about which insists that whenever I write a code block using brackets that I must never, ever leave that code block? If so, what is it please?


    Rod

    Monday, February 01, 2016 5:53 PM

Answers

  • Hi Rod at Work,

    Thanks for your response for your issue.

    We will stay on track your problem and the new discovery from the Microsoft Technical Support. Thanks for your sharing here again, it is benefit to other communities who has the same problem.

    Best Regards,
    Weiwei

    • Marked as answer by Rod at Work Friday, February 05, 2016 3:39 PM
    Friday, February 05, 2016 2:00 AM
    Moderator

All replies

  • Odd.

    I don't see that behaviour.

    I have vs2015 community on this machine and I would have thought any such setting on my install is the default.

    It's been recently re-installed.

    The two settings I always change are the code map in the slider and selecting edited classes in solution explorer.

    I haven't set anything else.

    Surely, this can't be a locale thing. ( I'm uk.)

    Reset your settings to default and check you have Update 1 installed. Although, I would have thought I'd have noticed something like that.


    Hope that helps.

    Technet articles: WPF: Layout Lab; All my Technet Articles

    Tuesday, February 02, 2016 5:49 AM
  • Thanks for Andy's reply.

    Hi Rod,

    Please try with Andy's suggestion to reset settings for your Visual Studio and install the Update 1 first.

    Then please run your Visual Studio 2015 in safe mode with "Devenv.exe /SafeMode" command to prevents all third-party VSPackages from loading when Visual Studio starts, thus ensuring stable execution.

    Besides, please close all third part software, such as antivirus, when running Visual Studio 2015. The third part software often cause some strange behaviour.

    If still has the same problem, please try repair your Visual Studio and then please check the ActiveLog.xml under the path of %AppData%\Microsoft\VisualStudio\14.0. This file will log all operations when you operate Visual Studio.

    Best Regards,
    Weiwei

    Tuesday, February 02, 2016 8:11 AM
    Moderator
  • Hi Weiwei,

    I've started VS 2015 using "Devenv.exe /SafeMode" per your instructions. Then I began a new WPF app, added a Window_Loaded event and put in the following code:

    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
    	bool testing = true;
    
    	if (testing)
    	{
    		string a = "this is a test";
    	}
    }
    

    it still behaved the way I described. the moment I placed the cursor on the closing brace of the if command and then hit the Enter key, the cursor immediately went to the end of the semicolon after "this is a test";

    I do have Update 1 installed.

    I cannot turn off my AV. That's controlled by my company's IT department through some AD GPO. There is no way they'll turn off Symantec Endpoint Protection.

    I've got a MSDN subscription through work. This issue is such a productivity killer, that I'm willing to call Microsoft technical support on it. What's the number that I call? (I'm in the US.)


    Rod

    Tuesday, February 02, 2016 4:12 PM
  • Hi Rod at Work,

    I also don't see this strange behavior in my side.

    If you want to call Microsoft technical support, please refer to following link which contains the Global Customer Service phone and the opening hours.

    United States            +1
            +1   
    (800) 642 7676
    (800) 892 5234 (TTY)

    https://support.microsoft.com/en-us/gp/customer-service-phone-numbers/en-gb?wa=wsignin1.0#u

    Since you will call the Microsoft technical support, I will close this thread later. Thanks for your understanding.

    Best Regards,
    Weiwei 


    Wednesday, February 03, 2016 2:56 AM
    Moderator
  • I've created an incident on this issue with Microsoft Technical Support. I got a call back from MS Tech Support. They connected to my PC and I demonstrated the problem. They were able to duplicate it. It might be a bug, or a "feature".

    What is involved is code snippets. Trust me, I use code snippets a lot. If you want to see for yourself what's happening, do the following:

    Create some new method in C#. Then within the body of the method type if like you're going to create a new if statement. Then when the cursor is at the end of "if", double tab so that the code snippet is invoked. You'll now have the following code:

    if (true)
    {
    	
    }

    Now within the code block body of the if statement, put in something. Doesn't matter, just something. I've done the following:

    int i = 0;

    So now I have the following:

    if (true)
    {
    	int i = 0;
    }

    Now place your cursor at the end of the closing brace.

    Next press the Enter key.

    You'll find that the cursor jumps back to the semi-colon after at the end of:

    int i = 0;

    Weird, huh?

    I'll let you know what they tell me when Microsoft tech support gets back to me.


    Rod



    • Edited by Rod at Work Thursday, February 04, 2016 6:25 PM corrections
    Thursday, February 04, 2016 6:23 PM
  • Hi Rod at Work,

    Thanks for your response for your issue.

    We will stay on track your problem and the new discovery from the Microsoft Technical Support. Thanks for your sharing here again, it is benefit to other communities who has the same problem.

    Best Regards,
    Weiwei

    • Marked as answer by Rod at Work Friday, February 05, 2016 3:39 PM
    Friday, February 05, 2016 2:00 AM
    Moderator
  • Thank you Weiwei, I like to give back to the community in whatever way I can. 

    Rod

    Friday, February 05, 2016 3:40 PM
  • I've heard back from Microsoft technical support. This is confirmed to be a bug in VS 2015 (I don't think it was a bug in VS 2013). Because of the nature of this bug it won't be fixed until either the next version of Visual Studio or some other critical issue requires an update to VS 2015.

    However there are a couple of workarounds which I want to pass along.

    First workaround is to press the Enter key immediately after activating the code snippet.

    The second workaround is once you're in the body of the if statement (in this case) and have typed your line of code, before you move on press the ESC key. That will also prevent the cursor from jumping back into the code block.

    I've learned that there's more information on this bug at the following GitHub URL:
    https://github.com/dotnet/roslyn/issues/5366


    Rod

    Friday, February 05, 2016 4:42 PM