I’ve recently started my web hosting company so I’m going to be moving my blog onto my own domain.
I’ll be designing it myself and I’m really excited to get going, watch this space for more info.
As is the case most of the time, I’m posting now to tell you about a problem I’ve just fixed.
My asp.NET Menu Control was rendering perfectly in IE 7, but looked completely horrid in Chrome. My submenus also weren’t displaying on mouseover.
My code was fine because the menu did work perfectly in IE 7. The problem must, therefore, be with the browser.
Based on what I’ve found online researching this problem, it seems that ASP.NET renders controls in a specific way to allow for backward compatibility with older browsers. As it turns out, ASP.NET doesn’t have a “definition” for Google Chrome that tells it what the browser’s capabilities are. The end result being that the server renders the control incorrectly because ASP.NET doesn’t know what Chrome can do.
Given the explanation above, the solution seems obvious: Tell ASP.NET what Chrome can do.
To do this, you can follow these steps:
- Add the App_Browsers folder to your website
- Create a new Browsers file in this folder and call it Chrome.browser
- Comment out everything in the file and replace it with this:
|4||<adapter controlType=“System.Web.UI.WebControls.Menu“ adapterType=“” />|
All this basically does (as far as I can logically understand) is tell the server that Chrome can handle the Menu Control’s full functionality.
Yes, sadly, you read that right. I’ve only found 1 case when testing an application at work in which the application doesn’t run through to the end properly because the error raises the following exception at a specific point in processing.
The CLR has been unable to transition from COM context 0x1afb80 to COM context 0x1afcf0 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.
This is a ContextSwitchDeadlock was detected Message that the Managed Debugging Assistant (MDA) throws at you.
MDAs are debugging aids that work in conjunction with the common language runtime (CLR) to provide info on the runtime state and generate useful info about runtime events that you can’t otherwise trap
(You can read more about MDAs here: http://msdn.microsoft.com/en-us/library/d21c150d(VS.80).aspx)
I’d go into it, but that’s not the focus of this post, although it is definitely helpful.
You can, however, configure MDAs in VS2005 by going to the Debug >> Exceptions… menu, and opening the Managed Debugging Assistants tree. There you’ll find a list of the MDAs that are thrown. Deselect the ContextSwitchDeadlock item and you can continue to debug the application.
I didn’t know this when I got the error, so I just published my app and ran it fine (after I’d found out that it was the debugger causing the error).
I’ll be posting more about the ContextSwitchDeadlock exception at a later stage, so keep an eye open for that.
Until next time…
So for those of you who read my blog (as regularly as I post new stuff anyway), you’ll know that I was working at an E-Commerce website when I started posting, and then got “let go”.
Well, I found another job! I’ve been working here a month now, and the best part about it is that it’s as close to what I want to be doing for a career as dammit is to swearing. The only way it’s not exactly what I want to be doing is the fact that I’m writing web applications in ASP classic, not asp.NET. It’s not too bad, at the very least, I’m learning the “foundation” stuff I missed out on when I was teaching myself code…
I’m really enjoying it here, the people are awesome, and every friday afternoon’s a rush. We have a 38m tall tower in the back. We take hardware (like computer screens, UPSs, printer, etc.) that doesn’t work to the top of the tower and drop it onto a slab of concrete on the ground (we aim for the boss’ car, but miss most of the time j/k :-P). All this while drinking beer and wine…
I’m told there’s been an accident or two though, which is why we’re not allowed to go up if we’ve had even 1 beer… One of the worst accidents I heard about was one of the technicians went up and fell, he broke both his legs in a number of places…
Overall, it’s quite an experience to be working here. I’m still working on a temporary contact, and I really hope that when that’s finished, I’ll be offered a permanent contract. So much in my life depends on it, so I really want this. Hold thumbs for me ppl!!!!
I’m working on an update for my netGuest application… If you wanna go have a look at that, the URL is http://code.msdn.com/netguest – you can download it all there. Just please don’t change anything.
The next – or should I say first – update should be ready by the end of May at the absolute latest. I know, I’ve been talking about it for a while, but things being as they are, I’ve got a lot on my plate at the moment (what with giving 110% to my job and all), so I really don’t feel like coding when I get home at night.
Anyway, I’d like to thank you for your time, it means a lot to me that you’d spend even 5mins of your day here and I really appreciate that.
Until next time, keep smiling!!!