Visual Studio 2008 likes to insert random strings into my code

Here's the setup:

I have some controls with text fields that I wish to be blank. So I might have, in my designer file:

someControl.HeaderText = ""

or

someControl.HeaderText = Properties.Resources.blank_string

THis only seems to happen when i'm trying to specify a blank string for a text or headertext property to a control.

If I open up the designer file (perhaps becuase I was searching something) and close/save all, VS will sometimes replace my "" or Properties.Resources.blank_string

with:

global::ProjNameSpace.Properties.Resources."SomethingCompletelyRandomHere!!!!"

Awesome!

I sometimes won't catch this until I start screwing around with my application and notice strange strings showing up in places where there should be none.

WHY is this happening?

Actually, what I think it's doing is a replace. I have a bunch of entries in my default string resources file that are all blank (populated ones are the in the translated resource files). So I think it's going through and finding "" or blank strings and just saying, "hey, looks like u got some other blank strings in this resource file, let's just swap this one with this one, Cool! I'm Microsoft!"

Answers


You shouldn't be editing the designer file. It's auto generated and visual studio will happily clobber anything you put in there.

if something needs to be blank either set the default values in the .aspx/.ascx file or in your codebehind.

As a matter of fact, all the designer files i've seen start off with:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.4927
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

Need Your Help

Spark Streaming over TCP

python sockets tcp apache-spark

I'm currently trying to get Spark Streaming over TCP working but I constantly get a "[Errno 111] Connection refused" error...

Linq query across all sites and subsites on a sharepoint server?

c# .net linq sharepoint-2010

I'm working on a webpart for a sharepoint 2010 installation. This has multiple sites, and each site has pages, and may have subsites, themselves with more pages and sites. I want to get a list of all