Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Jeff Makes Software

The software musings of Jeff Putz

  • More Visual Studio pain

    I conceded to use VSTS testing instead of NUnit in order to enjoy the tests running under the ASP.NET runtime, but now I can't debug. This page describes how you should be doing it, but it doesn't work. First of all, it wasn't obvious (and why would it be?) that running tests with debug didn't actually work. If it's not going to work, then why the hell would you not tell the user this?

    In fact, the first time I did this, VS spawned two WebDev server instances, then a third where the tests were actually run. The other two remained active when the tests ended. The one that appeared then disappeared was for the Web project (file-based with testing code), while the second one pointed the same place, and the third pointed to the production Web project (also file-based). Needless to say, it's the one that appeared then disappeared that you have to attach to, as that's the one that is acting as the environment for the tests.

    Why is it that with every step forward, we take a step back?

  • Why must Microsoft tools work against me?

    Let me say that Visual Studio 2005 is a huge step forward in a lot of ways, especially for Web developers. What still sucks though is database handling quirks.

    For example, I just want to open a query window against a SQLEXPRESS database in my Web project and fire off some SQL. You know, the way we did in the old days. I want to create a table from SQL commands, and it tells me, "The CREATE TABLE SQL construct or statement is not supported." Then below that is says the query can't be represented graphically in the diagram and criteria plane. Well no shit, that's why I turned it off.

    So then I figured I'd fire up SQL Management Studio and just attach to the database. Yeah right. I try to attach to the file, and the file dialog doesn't let you type in a path, and won't navigate beyond the user name in the Docs/Settings folder (I happen to have the project on a desktop folder).

    I eventually went back to the VS IDE and did a mass check-out from source control, and suddenly the table create query runs. That's not surprising since the database is probably read-only while checked-in, but why didn't VS tell me that instead of telling me CREATE TABLE isn't supported?

    Nothing annoys me more than fighting the tools for ridiculous amounts of time to do simple things. And that's the way it always is with Microsoft tools. Usually 95% of what you do is powerful and easy, but then you lose all of that saved time with dumb shit like this.

  • Unit testing programmatic web.config edits

    Perhaps there's some easier way with VSTS's testing, but because I know not everyone has that, I'm trying to write unit tests for the programmatic manipulation of web.config data.

    So on one hand, you've got...

    System.Configuration.Configuration config = System.Web.Configuration.WebConfigurationManager.
       OpenWebConfiguration(HttpRuntime.AppDomainAppVirtualPath);


    in your configuration editing junk. Works like a champ when you call Save() on that object. The problem is that HttpRuntime.AppDomainAppVirtualPath has no value in a unit test. The weird thing though is that you can call the above code from the test and call it's Save() and it throws no errors. It sure thinks it's saving some config data somewhere, but I can't figure out where.

    I know I'm being nutty here, but I really want to be able to test this stuff. Any suggestions?

    EDIT: Actually, the test is manipulating web.config in the C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG folder. That's odd.

  • Due to caching and moderation, it may not be displayed right away.

    We have an internal CS blog here at my current gig. You get this when you comment:

    "However, due to caching and moderation, it may not be displayed right away."

    Am I the only one troubled by this as being generally bad form? In techie circles, sure, whatever, I can deal with that, but would John Q. Pornsurfer care about the technical implementation? And even if they did, why wouldn't the update cache-bust the data anyway?

    Maybe one of the Telligent folks can explain the thinking on this.

  • How do you unit test an HttpModule?

    I would think that blasting through Google I could find an answer to this, but I'm not finding anything useful at all. How does one unit test an HttpModule? I can't imagine that it's not possible. I'm not sure how to fire off and test the various events or simulate the request/response lifecycle.

  • File change behaviour in v2 not so good

    As you'll see in this post from Scott, app restarts now occur whenever you add or delete a folder. That's bad news. I know of at least one application that I've written that has to add or remove folders from time to time.

    We should be able to turn this off. It seems like an arbitrary and not well thought out change.

  • More confusion about custom Membership and Profile providers

    OK, so help me out here. I was looking at the default system-generated database, and it stores the membership user reference for the profile table as uniqueidentifier. How can it do that if the current Membership provider uses some other data type? As I mentioned in my last post, I don't understand how this can be. MembershipUser.ProviderUserKey is an object, so it can take anything. It's not limited to guid's.