Have that thing where your square brackets (aka the  thingies) don’t work any more when you want to access an indexer in Visual Studio 2010?
It’s your shortcut keys that are messing with your keyboard I tell ya!
So to fix this very annoying little side effect, you go to Tools > Options > Environment > Keyboard from the menu.
Now in the text field to create a new shortcut, press the combo to get your square bracket, which is Alt Gr + ^ in my case (Belgian keyboard). That should show you which command is using up your key combination as a shortcut. In my case that’s Edit.AlignAssignments.
Then it’s just a matter of looking that command up in the list and smacking the Remove button. That’ll teach it to mess with your shortcuts dammit!
I get the impression that these changes are only saved when you close your Visual Studio instance. So if you have more than 1 open, you have to close the one where you changed the setting in last. Otherwise, you’ll have to do this again. And again. And again….
And now: a no thrills .NET WCF technology post in the hope of saving some developer’s time while trying to figure out wtf is going wrong.
The problem looks like this:
Your w3wp process crashes, or your IIS application pool gets stopped for no clear reason. Restarting it only causes it to stop again after a few seconds.
Deactivating the Net.Msmq Listener Adapter in the service control panel makes the problem stop.
Your Windows event log shows errors like this:
An unhandled exception occurred and the process was terminated.
Application ID: /LM/W3SVC/1/ROOT
Message: The service ‘~/foobarQueue’ does not exist.
StackTrace: at System.ServiceModel.ServiceHostingEnvironment.NormalizeVirtualPath(String virtualPath)
at System.ServiceModel.Channels.MsmqHostedTransportManager.HostedBindingFilter.MatchFound(String host, String name, Boolean isPrivate)
at System.ServiceModel.Channels.MsmqBindingMonitor.MatchQueue(MatchState state)
at System.ServiceModel.Channels.MsmqBindingMonitor.ProcessFoundQueues(MessageQueue queues, Dictionary`2 knownQueues, Boolean isPrivate)
at System.ServiceModel.Channels.MsmqBindingMonitor.OnTimer(Object state)
at System.Security.SecurityContext.Run(SecurityContext securityContext, ContextCallback callback, Object state)
at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.CompletionCallback(Object state)
at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
The problem is in the Net .Msmq Listener for the Windows Process Activation Service (or WAS for short). WAS checks all your MSMQ queues on the system and tries to figure out if there are any WCF services that it should poke to start reading the messages in the queues. Problem is in the case mentioned above there are also queues on the system which do not have WCF services that process them. WAS tries to activate a service for this “foobarQueue” anyway, which results in an exception.
And here is how you fix it:
- Make sure all WCF services that should be processing queues are in a virtual directory on IIS. For example http://localhost/foo/foobarservice.svc
- The queues to process will also have to resemble this virtual directory in the queue-name, like: .\private$\foo/foobarservice.svc
- Set your web site’s MSMQ bindings to localhost/foo instead of just the default localhost.
You do this in the IIS Management tool by right clicking your web site, then click Edit Bindings in the pop-up, select the MSMQ binding and edit the bindings’ information as mentioned above.
That should do the trick.
This tip is one of those “Why didn’t I think of that before” things when I saw it being used first. You see, sometimes you’re on this production database and you need to run some SQL statements in Microsoft SQL Management Studio. Statements that if you mess them up will end up ruining your customer’s day, and most certainly yours too.
Of course you’ve already taken a backup, but that isn’t perfect. It takes time to restore those and the most recent changes might be lost. The database might also be humongous, making backup & restore operations rather annoying.
You know this! Before you run any statement doing anything destructive on your database, first run the
BEGIN TRANSACTION statement. It feels like spring doesn’t it? With fluffy little bunnies hopping around merrily in the green grass and yellow flowers.
Whatever you run next, nothing will actually happen until you run:
If in the meanwhile however that delete statement turns out to act like the Spanish Flue and wipes out half of the precious records stored in your database table, there’s always:
Undo. Restore from last save. You don’t lose a life.
Awesome. More fluffy bunnies.
One thing to keep in mind though. As long as your transaction isn’t committed your statements will be putting locks on rows and perhaps even tables. The longer you keep those, the more chance other people’s queries will have to wait for you to release those locks and might even time out. This is bad. So keep your transaction trickery as short as possible.
For more details on those magical statements, see MSDN.
So you have this WCF service with a typical HTTP binding on it. When you try to use it with a client, or when you simply open up the .svc file link in your browser, it throws an error message telling you your MSMQ binding is incorrect. MSMQ!
Contract requires TwoWay (either request-reply or duplex), but Binding ‘NetMsmqBinding’ doesn’t support it or isn’t configured properly to support it.
But it’s a HTTP binding! Of course it’s two-way!
It took me a while to figure out what was happening, but apparently it was all caused due to a typo in the binding configuration for the service in the web.config.
So when you run into this, check your web.config binding configuration for that service. An incorrect class path or class name in the service’s name attribute can be causing this effect. Also check for mismatches between the used class in the binding and the class used in the service’s .svc file.
I’m guessing the “missing binding” is causing WCF or WAS (which is installed) to try and activate the MSMQ protocol as a default oslt. I don’t get it really. So if someone reads this and understands why this misleading error occurs, feel free to enlighten me.
Photo by greg biché, cc-licensed.
Getting a new computer is awesome. Installing all your most frequently used and essential bits of Windows software on it isn’t. So I searched the web for something that could do this boring task for me. Computers are usually good at that. I remember using something called AppSnap in the past, but that hasn’t been updated since 2008 which makes it so 2008 that I didn’t think of using it anymore. A few well placed Google queries later I ended up with something called Ninite.
Ninite gives you a list of well-chosen and good free and open source software (I’m just saying this cause most of my personal favs are in the list), check some boxes and download a lightweight installer. After that, the installer gets the list of your preselected software and goes off to download them one by one and installs them for you. Like a nice little helper robot monkey oslt. Awesome.
Saved me a bunch of time, which I used to write this little review. Ain’t that something!
Photo by Robert S. Donovan, cc-licensed.
Ran into this annoying bugger of a problem with Visual Studio 2010 on Windows 7 where every time I saved a file (any file, no matter how large or small it was) the GUI started reacting extremely slow on me. Menu’s didn’t react, keystrokes didn’t appear, scrolling didn’t work. It acted like a whole bunch of stuff was going on, but nothing really was. After a few minutes or so responses where back to normal, until I saved a file again…
While it was happening CPU usage of devenv.exe was fine (very low). Cleaning the solution didn’t help either, which in some cases fixes odd VS behaviour. In short, I was at a loss. Googling for a solution didn’t really bring up a solid answer, until I found a post that mentioned something about jumplists in Windows 7 and VS 2010 being slow. In that post the antivirus software is blamed but that was not the issue in my case, since the issue only started occurring recently without any changes to my setup.
Using the Systems Internals (great tools there btw if you want to dig deeper into your Windows system) file monitoring tool I noticed that a file in a specific path was sort of hanging things. When I looked up the file it did point to those so-called jumplist thingies again. After clearing these shortcut files, VS started acting like normal again.
So, if you’re having issues with a slow VS 2010 on Windows 7 on saving, try clearing the jumplists like this:
- Right-click the Start button
- Choose Properties
- Uncheck both checkboxes under the Privacy group
- Click the Apply button
- Re-check both checkboxes
- Press OK
If you’re lucky, VS should be running smooth as butter again.
Photo by Morgennebel, cc-licensed.
I installed my PC initially with a separate C drive dedicated for Windows and system specific files. Unfortunately it turned out that I picked that drive too small as I didn’t foresee that there is plenty of software out there that simply won’t allow you to install to a different location than C:\Program Files. To add to that, Windows itself had its share of service packs and updates which doesn’t actually make it smaller in size either. And then there’s the .NET framework, in all it’s versions.
So soon I ran into the very annoying issue that Windows kept telling me I was running low on disk space on my C drive. This eventually causes updates unpacking to your temp folder (also on the C drive of course) to fail, stuffing up even more hard drive space. Over the years I found a few tricks to avoid or fix this issue and as a good blogger I also documented those right here.
Here’s a little round-up of what you can do to free up some disk space, or create some more:
Spread the word if any of these tips helped you out and saved you from wasting hours reinstalling your machine. It saved me from doing just that a few times, so I’m hoping this post can be a huge time-saver for anyone coming across it.