Wednesday, July 27, 2011

More issues with permissions and VS2008

If you set up your app with a manifest so it runs as admin, VS can't run it, unless it is run as admin. It helpfully offers to run itself as admin. However, when it closes itself, if you have more than one instance open, it won't open the one that's running your program, necessarily. For me, it closed my website, opened a new instance that was showing my app, and still claimed it needed to run itself as admin. I edited my manifest, so I could build it and work on other things.

You need permission

I am working on an autoupdater, which, I know, means the first thing I need to test, is making it work to copy files in Windows 7. I run my exe inside the Program Files folder where I want my files copied. To copy the exe, I'm told I need admin rights. Now, I approve of all this new protection stuff, when it works. I try to copy an update, and get a 'you need permission to do this' error. The reason I could not copy it was, I was running it, and needed to close it. If Windows is going to lock me out of the file system, is it too much to ask that it tells me in a meaningful way what the issue is, instead of some generic rubbish ?

Wednesday, July 13, 2011

More stupid VS errors

As I've said before, my WPF project cannot show a designer as it gives a 'string is not a valid DateTime' error ( despite me having zero code that works with dates in any way ). So, today I created a property and decided to rename it. I tried to use the built in renaming function and got an error.

The file '' cannot be refactored. String was not recognised as a valid date time.

You'd think that Microsoft would have the money to pay developers to check before showing an error message like that.

Tuesday, June 28, 2011

How can Visual Studio search and replace be so utterly broken ?

I have the thankless task of editing a ton of HTML files. I have a bunch of URLs that all have different IDs, but I want to point to the same place. So, I investigated regex searching in VS. Well, the regex was easy, and the search found all my strings. Replace, however, leaves the regex section behind. My search was s=c&vl=vlg&vi=\d*, and it would replace s=c&vl=vlg&vi= and leave my digits behind.

Some googling told me that VS has it's own Regex syntax ( although using standard syntax WAS matching my strings ), so I tried that. Still no dice, I get matches, but it won't replace the bit matched by regex. I am unsure what the point of that is.

So, I decided to try wildcards. s=c&vl=vlg&vi=#* works perfectly, it searches AND replaces. So, I showed it to friends I'd been asking for help with the regex. Some guy says 'but you always want there to be a number, * is zero or more'. I KNOW I was reading MSDN, so I grab the entry to prove him wrong. Here is the text from MSDN:

One or more characters * Matches zero or more characters. For example, new* matches any text that includes "new", such as newfile.txt.

So, is it one or more, or zero or more ? It's one or more. But, I had to test, because the documentation contradicts itself. How very helpful.

Saturday, April 23, 2011

WPF loves to divide by zero

Ignoring for a moment how worthless the WPF designer is ( and I've not tried the VS2010 one b/c VS2010 is so slow and buggy that I don't want to move my projects there ), it seems like at random points, my large WPF project will compile, and fail to run, with a divide by zero error at the root of the project, in the App class. Rebuilding will fix it, there's never a bug in my code.

Wednesday, April 20, 2011

string.Split

There is no question that, compared to C++, C# makes working with strings a lot easier. However, some things still don't make sense. I have used the split method on the string class countless times. I could count on one hand the number of times I had more than one argument to split by. Why is there no overload that takes a single string or char, and doesn't force me to write code that creates a single element array inline so I can satisfy the method signature requirements ?

A little thing...

When I create a new project in VS, it gives me two textboxes, one for a project name, and one for a folder. If I type in to the folder textbox, it autocompletes based on paths that exist. This is nice. When I get a list of folders that exist, if I select one and press 'enter', the OK button gets triggered and 'WindowsFormApp1' gets created in the location I chose. Surely the fact that it's the default, useless name, is a clue that I was entering the path first ?

Wednesday, March 23, 2011

MVC bread crumbs

Wow, is it a year since I posted here ? I just gave up posting, I still find things broken in MS products every day. At the moment I am working on an MVC website in VS 2010. The fun thing is that VS2010's web server blue screens my PC about 8 times a day. But that's not what I wanted to say. In MVC, there's XML files to set up site maps and related pages. These can then be iterated over to create links to related pages, and breadcrumbs. That's kind of groovy, although having to synch up a lot of XML files or your site blows up is very Javabeans IMO.

Now, we all know that XML is case sensitive. So, what does this mean ? It means when I create my own links to my pages in my site, if I don't get the case right, these features do not work. That's right - my pages render with no links to related pages and no bread crumbs. In other words, Microsoft have succeeded in making URLs case sensitive. Well done, Microsoft !!!