Here are the steps I took to get my Android development environment set up on my Windows 7 64-bit box. Read the rest of this entry »

If you have an HTC Hero with a flat rate subscription for data traffic, it is very nice to use it for your laptop’s internet connection as well. Of course, this is valid for any HTC phone or any Android phone for that matter, but I have an HTC Hero so that is what I can tell you about. Read the rest of this entry »

A customer complained today about a WinForms application written for .NET 2.0 that crashed. It turns out that on the customer’s computer, a MissingMethodException is thrown when calling:

bool signal = WaitHandle.WaitOne(0);

Well, it works fine on my computer and I was certain that the project settings in Visual Studio 2008 was set to .NET version 2.0 and that the customer has that version of .NET installed. It is a system method, so it should be there, shouldn’t it?

Not so. Turns out, if I’m not mistaken here, that this a new overload of the WaitOne method that was introduced in .NET 2.0 SP2. There are several overloads of this method, and the two I was having trouble choosing between was:

bool WaitOne(int millisecondsTimeout, bool exitContext);
bool WaitOne(int millisecondsTimeout);

I must confess that I’m not entirely sure what exitContext means and the difference in supplying true or false. So out of laziness, when Visual Studio presented me with these choices, I chose the latter without the bool argument. Bad choice!

From what I understand this overload was actually added in .NET Framework 2.0 Service Pack 2. However it seems that SP2 is not installed by Windows Update and isn’t even available as a separate download. It is only available as part of .NET Framework 3.5 Service Pack 1.

You might know about the confusion about .NET Framework versions that seems to have replaced the old COM based dll hell. I’m probably not the best person to explain it and I sure use my own terminology. However, I’m going to give it a shot:

The thing is that one differentiates between the “core” .NET and “extensions” to .NET. Since version 3.0 of .NET no new versions has been created for the “core”. All libraries from version 3.0 and up are “extensions” and they all depend on the “core”. The “core” .NET is therefore still in version 2.0. However, I guess some bugs might have been discovered but also I’m guessing that while building the “extensions” a need for some updates in the “core” arised, which is why the “core” still had to be changed. And this lead to the release of service packs for the “core”. The result is that the package known as “.NET 3.5 SP1″ includes an update to the core known as “.NET 2.0 SP2″.

Anyway, there are two “fixes” for my problem:

  • Supply a boolean as the second argument to WaitOne in all my code.
  • Require .NET 3.5 SP1 to run the application.

I chose the first one.

To Visual Studio, one might request that you had warned me about this. There is a generation of warnings when building applications where you use certain classes and methods that “should not be used anymore”. I guess this is the opposite, but should still warrant a warning?

Note: Please make a comment if you have a better understanding of this issue than I have. I can’t say I have verified all my findings.

So there you are, working on a nice little project. Plenty of time before your eleven o’clock appointment is coming, expecting a nice demontration of the current status.

“Hello” – someone says. What? Hey – guess what – it’s the customer!

“You’re early!” – I said.

“I am?, I thought we said eleven o’clock” – he replies.

Vista Clock

But I’m not finished and the clock in my right hand corner saids “10:24″. Aaargh. What’s going on? So I click on the damn clock and guess what, the time is REALLY “11:00″. Great!

Now, this has actually happend once for me and once for my coworker. Nothing major of course, but it is really annoying that you can’t trust the Windows Vista clock anymore. Either you have to click on the time in the right hard corner to make sure that it is really, really, the correct time – or maybe invest in a wrist-watch…

Doesn’t it just drive you crazy when you KNOW something IS there, but it isn’t? Like when you’re in Visual Studio 2005 on Windows Vista and would like to debug your asp.net application by attaching to the w3wp.exe process. You know you are running asp.net 2.0 code, but the dialog box still claimes that there is NO managed code inside w3wp.exe. But it is! Aaargh.

So you try to figure out what could be wrong, which may include the following:

  • Debug mode for compilation in web.config. Checked.
  • A setting in IIS 7.0 Manager that you’re unfamiliar with. Well, I found a setting for server side debugging in the ASP-section, which existed before. Turning it on didn’t seem to help (why would it?).
  • Maybe something with the application pool? There is a mode for “Managed Pipeline Mode”, but setting it to “Classic” didn’t seem to help (as it shouldn’t). Changing the identity of the pool didn’t help either.
  • At some point I think I’ve seen something about your account having to be a member of a “debugging” group in your Windows machine. However, there are no such user groups in my local machine. <edit>It seems that this group is not necessary since Visual Studio 2005</edit>
  • Also, of course, you have to run Visual Studio 2005 as an administrator, but I’ve done that since the beginning (no need to right click if you set the Properties, Compatability, Run as administrator checkbox for the icon).

I did use Process Explorer to ensure that .net was loaded in w3wp.exe, and sure enough it was.

So I found a note on the web about “Windows Authentication” being used when debugging asp.net. Now I’m not sure if this was the single thing that helped since I tried several things, but after installing “Windows Authentication” in IIS 7.0, the “Managed” code shows up in w3wp.exe and I can attach to it from Visual Studio 2005.

The solution:

  • Control Panel
  • Programs
  • Turn Windows features on or off
  • Internet Informaton Services
  • World Wide Web Services
  • Security
  • Check for “Windows Authentication”
  • Rebooted computer (just in case – don’t know if it was needed or even if iisreset.exe would have been necessary)

Please write a comment if you’ve had the same problem, and got it solved the same way I did, or if you did something else/more to get it working.

<edit>Although primarily about pressing F5 to automatically attach to w3wp.exe, this blog post talks about what needs to be done.</edit>

Getting my legacy asp scripts to run against a Microsoft Access database on Windows Vista and IIS 7.0 took some investigation. Using Process Monitor was an enormous help when I had no clues but:

An error occurred on the server when processing the URL. Please contact the system administrator.

Hey, that’s me! And then:

Microsoft JET Database Engine error ‘80004005′
Unspecified error
/myapp/myscript.asp, line 9

Ok, so I suspected that the first problem was due to the fact that I needed to activate asp scripts in some way. However, turns out it was a new setting for sending the error message to the client (maybe it has existed somewhere before, but I’ve never had to change it). This setting is located in the new IIS Manager:

Features View, ASP, Debugging Properties, Send Errors to Browser

But this only got me to the second error message. And that, I had seen before. It should have something to do with file and directory permissions. Being uncertain about which user IIS 7 actually runs legacy asp scripts as, I used Process Monitor to find the “IUSR” user. But givning that user full permissons to the directory where my.mdb resided didn’t help. So back to Process Monitor – filtering on failed operations from the w3wp.exe process. Ahh! Temporary files. Of course! The OLEDB driver needs access to the system temporary folder to store some files when opening the connection to the database file. And the location for this in Vista is:

C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp

Now, UAC can really drive you mad. I wonder how long I can take it before giving up and turning it off. For security purposes, it is of course great. Then again, I’ve run Windows for a lot of years as a member of the Administrators group, and never had any real security issues. At least not any that I know of… :)

Pasting “C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp” into the address bar of Explorer will tell you that it doesn’t exist. Well, I didn’t believe Vista so I removed the ending directories until Vista told me that I had to elevate priviliges to get into one of the parent folders. Ok, I did that and now I could get into the full path. Great. A warning that I was changing file permissons on a system directory was all that was standing between me and success – and thankfully that was not an obstacle.

So now I’m running my old asp-scripts until I’ve had the opportunity to convert all projects to asp.net.

About this site

This is a site targeted at software developers that have an interest in the Microsoft.NET platform. Having an open mind also means that other technologies and platforms will be investigated.

Involvements


Follow mikeplate on Twitter
  • Windows Live SkyDrive no Explorer: [...] mynetx, Mike Plate, [...] [...]
  • admin: @Joe: One might suspect that the error is somehow related to Windows 7. Obviously Windows 7 does a l [...]
  • Bill: Mike, Once again, THANKS! I had much the same experience. I think I had to provide my logon password [...]
  • Joe: Having the exact same problems as you are. However I am using a Marvell Yukon 88E8056 ethernet contr [...]
  • admin: @Bill The address you type into the address bar of Windows Explorer should look like: \\docs.live [...]