Visual Studio Not Capturing Entire Line - visual-studio-2010

I am asking the question in MVC as that is the framework I am using for this issue, but it could be a Visual Studio issue as well.
We are using Visual Studio 2010 / MVC 4.0 for our application and all of this is while running in DEBUG mode to test the code and get it working.
I needed to add a new AccordionPanel to a section of our website. We have about 10 total Accordion Panels on this page and all of this worked with no issue. Between the third and fourth panel, I needed to add a new panel, so I added the below code:
#using (Html.BeginAccordionPanel("Cancelled Reason", "pnlCancelledReason"))
{
#Html.Partial("~/Views/Project_View/TrackingInformation/_CancelledReason.cshtml", Model)
}
What is happening is that this new section does not appear on the page. What I found odd is that if I add some HTML on the end such as:
#using (Html.BeginAccordionPanel("Cancelled Reason", "pnlCancelledReason"))
{
#Html.Partial("~/Views/Project_View/TrackingInformation/_CancelledReason.cshtml", Model) <b></b>
}
and refresh the page, this new section appears until I stop debugging and restart, then it no longer appears.
What is very odd about this is: when I step through the code and Visual Studio hits the "#Html.Partial" line, the yellow box that highlights your current row, only captures about 75% of the line above (stopping around the dR in the file name). If I readd some HTML to that line and refresh, the yellow highlighted box for current line now captures the entire line up to the area between , but since it captured all of the relevant code, the panel appears until I stop debugging.
I can't seem to figure out what causes this? If I copy any other panel section and paste it in the same location, the same issue occurs, so it doesn't seem to be the code, but something within Visual Studio causing this.
Any help is appreciated.

After spending two days on this and not sure why, but it seems if I remove the “.generated.cs” file from Visual Studio this issue goes away. I didn’t find any articles for this, just figured ‘why the heck not’.
Sorry to have bothered you.

Related

Visual Studio Editor : Always Add new line of code at Ending of existing lines

I am struggling with visual studio editor, I've one WinForm (Visual Studio 2015 Comm) App that I am maintaining from last couple of years, after all the improvements and bug fixes the code behind reached to around 2000 lines.
Issue is If I am adding any new code inside that it places the code anywhere in middle of any other events like If I've added a radio button and want to have click event then if I generate it it places it on 1560th line. (Just an Example).
So Is there any setting for editor that if any new code is getting generated it should always put that on the ending of the existing code like on line 2001?
I am not aware of any such settings but suggestions are needed
Thanks.

Creation of a Visio Add-in with Visual Studio 2010 and C# : loosing reference to buttons

I am facing something strange in my Visio Add-in:
I have a CommandBar, with CommandButtons on it and I just launch my debug mode.
The first page is OK (the start page of Visio) but if I open a file or create a new file, I can click all I want on my buttons, nothing is working !
It worked perfectly on the start page but not on my new visio file...
I tried to comment parts of my code, but the issue seems to come from nowhere... I really do not understand.
If someone already faced this kind of behaviour, please help, I just do not know what to do...
You could try setting ".Tag" property for your button to some unique value.
More info here:
http://msdn.microsoft.com/en-us/library/aa201791.aspx,
"Maintaining references to command bar controls when contexts change"

Microsoft visual studio screen problem

I am having a problem thats not about the code, it's about the screen in Microsoft visual studio 2008.
Actually problem is i created one utility from couple of weeks i didn't opened that utility today i opened (in Microsoft visual studio the screen appearing blank no controls are visible in that.But all the controls properties are there. I tried a lot but i didn't get solution. Last when the same thing happened i created the controls again. Now i don't want to go to create all the controls again. If any one have the solution please help me.
Before screen is like this:
Now its blank (like new page)
From your description I'm not sure if this is a application/code build issue or an IDE issue, what you could try is to reset the settings in visual studio and see if this helps.
You can do this by going to Tools -> Import/Export settings and then following the wizard to reset the settings, you may also want to perform a backup before resetting them (this is also part of the wizard) then they can be restored if this causes you further issues.
I don't have a copy of 2008 available at the moment so some menu entries may be slightly named different.
Hope this helps!
EDIT:
Now there is more information, this looks like there may be a problem with the code in the
InitializeComponent
method of the form.designer file (e.g. if you are using c# this would be something like Form1.Designer.cs and can be found by expanding the corresponding form in the solution explorer), if you remove/comment the lines that say
this.Controls.Add(this.NameOfControl)
(NameOfControl is where you would see your declared controls name)
then you get the behaviour that you are seeing, the controls do not render as they are never added to the forms controls collection but as they are declared you will still see them in the properties drop down and wont be able to add another control with the same name.

Visual web developer 2010 express autocomplete not working

I'm working with Visual Web Developer 2010 Express. I tend to bump at very strange problem.
Somehow, the autocomplete function gets disabled out of nowhere in the editor, and i have no idea how to bring it back on again. There are no errors, no warnings (a javascript file).
It seems that it turns off whenever i get close to a code fragment which has a link in it (ex. var sLink = "http://www.google.com/"). This link is sure highlighted in blue and underlined.
I don't understand what is going on. Whats wrong with it. When i reload the Visual developer, i CAN use the autocomplete functionality, but only ONCE, in the function containing the link.
After that, nothing is done, i start writing the name of variable and no box is popin up with a list. I can go to another function which has no links in it, and it works!
I am really confused. Help would be appreciated. It's really hard to work without autocomplete.
Autocomplete works based on it's ability to parse the entire javascript file (or relevant parts of it). If there is some javascript error or invalid syntax in that function, then it will fail to autocomplete there.
Try creating a shell function, and then add the lines from the problematic function by one until you find the individual line that causes the problem. Then temporarily comment out that line while you complete the function.

How to stop Visual Studio from moving and/or resizing controls when opening a project?

I have a certain project that's been problematic in visual studio. The main form has a TabControl with four tab pages, and during initial development, the entire contents of the third tab page would shift down each time the project was opened. (It got really bad if you didn't look at that page for a few days, and the next time you ran the program, you had to scroll down past all the blank space that had built up before getting to any content.) That was relatively easy to work around by selecting everything and dragging it back up to the top.
Since the project has gone into maintenance/enhancement mode, the third tab page hasn't had any problems, but several controls on the fourth tab page are being re-sized (a small increase in width) or shifted left (a large decrease in X-position). Again, these same controls are affected each time the project is opened, so if you don't fix them each time, they'll continue to get further away from their correct settings.
The problem description is a lot like this other question; one notable difference is that the designer source file is not changed, i.e., I can open the designer source file in a separate text editor and see the correct values for location and position of all the affected controls, while at the same time I have the project open in Visual Studio and see the incorrect values in the Properties window. (Doing a "Save" or "Save All" doesn't affect the designer source file after just opening the project, but changing anything on the form and then saving it will make the source file match the incorrect values from Visual Studio.)
Any ideas about why Visual Studio is displaying the form incorrectly? I'd really like to avoid having to spend the extra time to fix it every day. And I'm not keen on adding code to the constructor to re-set those properties, as suggested elsewhere (violation of SPOT/DRY rule, you know--fraught with peril).
You can compare the Designer.vb file of the problem form from one version to the next. (Click Show All Files in Solution Explorer). That should tell you what is being changed and maybe you can find a workaround.
I've had similar problems that were resolved by uninstalling and reinstalling Visual Studio.
I finally found a way to get around this. When I set the affected form's Minimum Size property in the designer to something other than 0,0 (such as the current size of the form) some of the controls relocate themselves the next time I open the form. Setting Minimum Size back to 0,0 resolves it. The affected controls either have no Anchor setting or have Anchor set to Bottom.
So its seems the combination of Anchor Bottom and non-zero Minimum Size is what makes this unwanted movement happen.

Resources