Posts Tagged ‘bug’

Visual Studio debugger is too sensitive about exceptions

I was working on XBList the other day when I hit a peculiarity of Visual Studio. I wanted to call a method asynchronously, so I was using BeginInvoke with a callback, as described in this article on MSDN. So I used BeginInvoke to fire off a method, and the method I invoked happened to throw an exception. I didn’t expect this to be a big deal – when the callback was called, I would call EndInvoke which would re-throw the exception and I could deal with it. However, while running in Visual Studio’s debugger, I got a break and an error dialog that claimed I had an unhandled exception. My code never made it to EndInvoke. It said something like “Exception unhandled by user code”.

It turns out that this is just some weirdness in Visual Studio. If you go to the Debug menu, choose “Exceptions…”, and uncheck “User-unhandled” for Common Language Runtime Exceptions, the exception will get properly thrown when EndInvoke is called, and everything’s fine.

exceptions-setting

It’s annoying that I have to give up the relatively useful unhandled-exception trapping that the Visual Studio debugger gives me, but I guess there’s no other way around it.

Firefox bug rendering list items next to floated elements

I was working on a web app a couple weeks ago when I hit a weird problem. I had a sidebar floated right, and an unordered list right next to it. What was weird is that each list item was getting “pushed aside” by the floated sidebar. This went against what I thought I knew about how floats work in CSS. My understanding was that floats should be removed from the page layout, and appear above any other block level elements, like my list items. Reading CSS Float Theory: Things You Should Know and the W3C spec on floats only backed up what I thought. Floats should always appear above block boxes, like LIs. I wrote up a minimal test case and tried it out. What I expected was something like this, where the green boxes are LIs, the red box is my floated DIV, and the purple box is a normal block element like a P:

CSS compliant float rendering

Instead, what I saw in Firefox 2 was:

Firefox bug 163110

It actually took me a very long time to get to this point because I hadn’t even bothered to try it out in non-Firefox browsers, since I assumed Firefox was right and I was missing some arcana in the spec. I had tried it out in Internet Explorer 6, but I had taken that as even more evidence that Firefox was right (if it differs between IE6 and Firefox, it’s usually IE6 doing it wrong). However, when I finally popped my test case into Safari 3 and Opera 9 and they agreed with IE, I realized that it was really a Firefox bug. Not too much searching later I came across this css-discuss post which pointed out the bug and offered two solutions. Either I could force my LIs to take up the whole space by setting “width: 100%” on them, or I could use the proprietary Mozilla CSS property “-moz-float-edge: content-box“. Either one made the list items act like I expected them to, though you give up some flexibility with the first method, and the second won’t validate.

This bug has been filed as Bug 163110 since August 2002, and many duplicate bugs or similar-but-not-quite-duplicate bugs have been filed since. Unfortunately, it doesn’t look like anyone is working on fixing it, and I don’t expect to see this problem go away in Firefox 3, which should be shipping relatively soon. I’m just going to have to add it to the list of bugs and workarounds I need to keep in mind whenever I’m navigating the minefield of modern web design.

Update (5/29/08): This has been fixed as of Firefox 3 RC1. Yay!

Vista Windows Media Center and Tablet PC don’t play well together

Getting my Xbox 360 to work as a Media Center Extender was no walk in the park. The first major obstacle I had (before even worrying about how to get XviD transcoding working) was a strange error message I got every time I connected to the Media Center from my Xbox. The Media Center interface would load, show me everything for half a second, then switch to a screen that just said “Connection Terminated. The Xbox 360 has been disconnected because an application has launched UI unexpectedly. Would you like to reconnect?” A few seconds later it would reconnect, go through the startup sequence, and drop right back to that error. Over and over again.

I checked out Event Viewer on my Vista machine, and this is what I saw: “An unauthorized window was detected while running the Windows Media Center Experience, ‘Tablet Driver’, with file name ”.” What? So after poking around the Internet a bit, I came across this newsgroup post. It looks like the problem is that the Tablet PC Input Panel gets activated even though it shouldn’t on a Windows Media Extender. I thought it was really cool to hook up my Wacom tablet and use the Tablet PC functionality, but until the Tablet PC team fixes this bug, I’ve had to uninstall my tablet drivers so Windows Vista no longer bothers with any Tablet PC parts. It’s a pity, but at least Windows Media Center works now.