Page 1 of 9 in the Technical category Next Page
# Friday, August 06, 2010
Close up blog entry

The ClientBuildManager is a .NET BCL class that facilitates compiling ASP.NET markup files outside of IIS. I did run into an issue using this class which others may hit as well.

I compiled some ASP.NET MVC .aspx views and tried to get the type using ClientBuildManager.GetCompiledType, but the GetCompiledType function returned null. Hmm…I could see the compilation was working because the assemblies were seemingly generated correctly.

It ends up that the type would not load because the calling project did not reference all the assemblies needed to load the type. The ClientBuildManager compiles the web components in a separate application domain. When trying to retrieve the type, the assembly is loaded into the calling application domain, and then the type retrieval is attempted. If the type can not load no error is thrown, instead you get a null return value.

So make sure the application using ClientBuildManager references all assemblies referenced by the web application you are compiling.

I hope this saves someone some time. It took a bit of head banging to figure this one out. I had to debug down into System.Web to figure out what was going on :-(

Share/Bookmark
Friday, August 06, 2010 10:53:45 PM (Eastern Daylight Time, UTC-04:00)  #    Disclaimer  |  Comments [0]  | 
# Monday, August 02, 2010
Close up blog entry

One feature of CodeRush from DevExpress which I use a lot when navigating code is the ability to navigate to a function/method/property implementation from a variable that is of an interface type. I do a lot interface programming (OK OK I get a bit interface happy) and this navigation feature rocks.

The default shortcut keys to bring up the Navigate/Jump To menu is Ctrl + Alt + N. I prefer to bind the Navigate command to Ctrl + E, as it is a bit quicker to type when your fingers are in home position on the keyboard. I show how to update the binding in the screen cast embedded with this blog post.

With the cursor on a function/property of a variable of some interface type, bring up the Jump To menu.

Visual Studio CodeRush Navigate Interface to Implementation

If you pick Implementations from the popup menu, you’ll be taken to the class implementation of the interface function/property. If multiple implementations exist, then a popup menu displaying the various choices will be displayed.

I created a screen cast to show this feature in action:

I’d suggest experimenting with the other Jump To options as well as they come in handy when navigating code.

I hope this helps!

Share/Bookmark
Monday, August 02, 2010 11:41:58 PM (Eastern Daylight Time, UTC-04:00)  #    Disclaimer  |  Comments [0]  | 
Close up blog entry

A CodeRush feature that comes in very handy from time to time is the ability to easily extract and implement interfaces in Visual Studio.

This tip involves using the Refactor command included with CodeRush/Refactor Pro. The default shortcut key is Ctrl + ` .  Personally I prefer to map the Refactor command to Ctrl + R for a more convenient key stroke. I show how to do the mapping in the screen cast embedded later in this blog post.

Extract an interface from a class

You can easily extract interfaces from an existing class. With the cursor on a class, bring up the Refactor menu and select Extract Interface.

Visual Studio CodeRush Extract Interface

This will create an interface that contains the public properties and methods of the class. You can then move the interface to it’s own file by using the Refactor menu once again and select Move Type to File.

CodeRush Move Type To File Interface

Create an interface implementation

You can very quickly create and interface implementation. With the cursor on an interface, bring up the Refactor menu and select Create Implementer. You can choose to create an implicit or explicit implementation.

Visual Studio CodeRush Implement Interface

You can quickly move the implementation to a separate file the same way as shown above for extracting an interface.

I created a screen cast to show this in action:

CodeRush/Refactor Pro is a rock’in Visual Studio add-on from DevExpress.

I hope this helps!

Share/Bookmark
Monday, August 02, 2010 11:33:18 PM (Eastern Daylight Time, UTC-04:00)  #    Disclaimer  |  Comments [0]  | 
# Thursday, July 29, 2010
Close up blog entry

Visual Studio tip: if the cursor is located after a variable followed by a dot without intellisense showing, press Ctrl + Space Bar to bring up intellisense. One common use of this shortcut is if the wrong property or function is chosen you can quickly select the property or function, delete the selection, and press Ctrl + Space Bar to popup intellisense to pick the correct one.

I created a short demonstration to show the shortcut in action:

I hope this helps!

Share/Bookmark
Thursday, July 29, 2010 10:13:32 PM (Eastern Daylight Time, UTC-04:00)  #    Disclaimer  |  Comments [0]  | 
Close up blog entry

Visual Studio tip: if your cursor is located between the parenthesis in a C# function/method you can use use Ctrl + Shift + Space Bar to bring up the function parameter help popup. 

I created a short video to demonstrate how the shortcut works:

I hope this tip helps!

Share/Bookmark
Thursday, July 29, 2010 9:35:50 PM (Eastern Daylight Time, UTC-04:00)  #    Disclaimer  |  Comments [0]  |