Jose Escrich

Extensibility Thoughts
AJAX, SSL and the 413 error

If you have been developing and testing your application using an UpdatePanel or something similar without problems over http, maybe you will find some issues when you go live using http over SSL. There is a well known issue when you make a roundtrip to the server making a PUT or POST and it’s related with the size of the message. In that cases you probably will get a 413 error similar to this:

image

The workaround resides on just to increase the value of the IIS UploadReadAHeadSize metabase parameter. Basically this parameter defines the allowed size of the data that can be posted to the server.

To change the value running on IIS 7.0 execute the following command:

appcmd.exe set config  -section:system.webServer/serverRuntime /uploadReadAheadSize:"491521"  /commit:apphost

if you’re running IIS 6.0

cscript adsutil.vbs set w3svc/1/uploadreadaheadsize 65536

You can get more information here:
http://technet.microsoft.com/en-us/library/cc737382(WS.10).aspx

HTH

Technorati Tags: ,,
Posted: Aug 19 2009, 02:56 AM by jescrich | with 3 comment(s)
Filed under:
Using Wireless Connection on HYPER-V without sharing it.

As you know, the wireless adapters are not supported on HYPER-V (HV) so, the most common scenario in that case, is go and create a Private Virtual Network on your Hyper V console then go to your Wireless Adapter and share the connection for the new Private Virtual Network Adapter.

Usually it works but I don’t think that is the better approach. Another side effects regards on your VM is that it gets an internal IP assigned by the shared connection, so then you can’t access the VM from another machine.

There is a way to configure the HV to use the wireless adapter in transparent way. To do that you have to create a Virtual Private Network on your HV.

 image

After create it go the Network Connections folder, there should be a new network adapter (Local Area Connection 4 in my sample), so the only thing that you have to do is, select the new network adapter and the wireless connection, then do a right click and choose Bridge Connections. It will create network bridge as follow…

image

so now restart your VM and Voila!, it should have an IP assigned from your wireless network.

hope it helps.

Posted: Jun 04 2009, 03:03 PM by jescrich | with no comments |
Filed under: ,
Registry redirection on Visual Studio 2008 RTM & SP1 (part 1)

First of all a quick overview, I made a VSIP package which originally addresses just Visual Studio 2005, in where I added support to work with the regular hive and with the Experimental hive. In fact there are no much differences between those but in my package I require to know which registry hive is the current one. Since VS 2008 I used the same bits to address VS2005 and VS2008. The only thing that I had to do was just register the same package made for 2005 but, for VS 2008.

As you know using MPF 8.0 as baseline you can inherit from the Package base class then in there you have the ApplicationRegistryRoot property what it basically does is the follow:

image

Note that if you running on VS 2005 Regular and Experimental hive both are located under HKLM key. So what the GetRegistryRoot method does is determine the value of Software\Microsoft\VisualStudio\* in where * will be the current VS hive (8.0, 8.0Exp or Foo) also that's can be done using IVsShell as follow:

image

However since 2008 that approach has changed due to the Regular is still running into the HKLM as same as VS2005 but, the Experimental hive is running under de HKCU (CurrentUser) registry hive. Aaron Marten has a post with an overview of that.

Regular (no changes): HKLM\Software\Microsoft\VisualStudio\9.0
Experimental: HKCU\Software\Microsoft\VisualStudio\9.0Exp\Configuration

Note that HKLM\Software\Microsoft\VisualStudio\9.0Exp does not exists!.

So if you still using the 8.0 MPF as baseline (using for example ApplicationRegistryRoot) or even if you have your own implementation you should experience problems accessing the current registry hive, but in fact no :S. If you run a VS 2008 in experimental mode and running as normal user then you try to do the follow:

RegistryKey currentRoot = Registry.LocalMachine.OpenSubKey("Software\Microsoft\VisualStudio\9.0Exp");

Debug.Assert(currentRoot != null);

the expected behavior should be get a null reference due to that registry key doesn't exists but no!, and that's because it will be automatically redirected to HKCU\Software\Microsoft\VisualStudio\9.0Exp\Configuration. The confusion comes when you do something like this

image

When you do a ToString() you get a "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\VisualStudio\\9.0Exp", but if you try to write some dummy key or value there, the value is going to HKCU\Software\Microsoft\VisualStudio\9.0Exp\Configuration automatically.

The same thing happens if you use the ILocalRegistry2 to get the GetLocalRegistryRoot output that in fact it returns an string with the current UserSettings path (ie: "Software\\Microsoft\\VisualStudio\\9.0Exp\\UserSettings"), eventually you must use the Registry.LocalMachine.OpenSubKey API to get the registry hive, which btw is not so useful due to we really don't know if it's a HKLM or HKCU entry. We're guessing that's a CurrentUser key because it has a Exp suffix, mmmmm :S.

The Problem.

Since VS 2008 SP1 that behavior has been changed or fixed. I'm not sure if it was a feature or not but in any case with the SP1 applied when you probe for "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\VisualStudio\\9.0Exp" you will get HKLM as expected!.

You can avoid those issues if your package is using 9.0 than 8.0 references but in that case you won't be able to addresses VS2005 and VS2008 with the same bits. In 9.0 you already have an implementation of VSRegistry and I already post about that here: http://weblogs.asp.net/jescrich/archive/2008/08/15/how-to-know-which-is-the-current-running-visual-studio-registry-hive.aspx.

I will back with another approach on how to deal with it avoiding to change your project references.

Enjoy!

Posted: Oct 08 2008, 03:02 PM by jescrich | with no comments |
Filed under: ,
Guidance Automation Extensions for VS2008 SP1 is available.

Today has been released the Guidance Automation Extensions - February 2008 Release SP1, which addresses the following issues:

Registering and Using Guidance Packages on the Visual Studio Experimental Hive
Registering and/or using a guidance package in the Visual Studio Experimental hive fails when Visual Studio 2008 Service Pack 1 is installed. This is now fixed.
Regular Expression Evaluation Enhancements
When an operation (or a message) was created, the duration of the creation task was directly proportional (and much greater than linear) to the length of the operation name. This update offers a performance improvement. See Additional Information section.

You can download it from here

Enjoy!

T4 Editor RTM is finally out!

After several months of work I'm really happy to announce that we've finally shipped the T4 Editor RTM version. Now it comes in different flavors as a Community Edition and a Professional Edition. You can check the most important difference between those version here.


see it in action!

You can find more useful information about T4 Editor in our t4editor site. http://t4editor.net

Download T4 Editor NOW!

How to know which is the current running Visual Studio registry hive.

It’s really useful to know the current registry hive when, for example, when you’re running Visual Studio into the experimental hive even considering, that since Vs 2008 it includes the RANU option (Run as Normal User) with basically means that Visual Studio will loads the information from the HKCU instead of HKLM. You can find more information about that in the Aaron Marten blog.

So, since Vs SDK for Visual Studio 2008 and as a part of MPF we have a VSRegistry helper which tell us in which registry hive the Vs is running, it basically has a static method with a couple of signatures:

image

image

What it does is returns the current running registry key according the type of key, which could be UserSetting, Public Configuration (know as the common registry key, where is located most of the Vs information), etc.

If you’re developing a VSIP package you can also use the ApplicationRegistryRoot property what it basically uses that helper.

Posted: Aug 15 2008, 02:09 PM by jescrich | with 3 comment(s)
Filed under: ,
T4 Editor: coming soon!

Since some time ago, we're working in a new release of the T4 Editor. Maybe one of the most interesting feature is the ability to have intellisense in the contained language. Victor has posted some screenshots  that showcases that feature, check it out here. 

Here you've a quick snapshot of how it looks ;).

Testing T4 templates using mock framework (MoQ)

Some time ago I wrote a post in which I talk about how you can do unit tests over your text templates using the GAX Host. In that example I used a very simple template which receives just a couple of string properties. But it becomes more complicated when you have properties which are complex types ok I know, most probably you're thinking that can resolve that just creating your own mock objects and you're right.

But the thing is that you can do that in a really easiest way using a mock framework. I will not speak here about mock frameworks so you can find a lot of posts about it. I'll speak about MoQ which is a new mock framework developed by Clarius and other companies. You can know more about MoQ in the Daniel's blog and in its google code page.

In the following example what I did was create a simple text template which uses an IEntitySchema object to create something like a Business Entity, so here we got an issue because we need an instance of that IEntitySchema and, the way to get it using the classic TDD approach, is creating an explicit Mock object.

So here is when MoQ comes to the rescue, if you see the code snippet it has a call to new Mock<IEntitySchema>() which will creates a proxy of an IEntitySchema implementation. After that, I defined our expectations for each interface signature in where we want to test an interaction.

image

image

So, at that point we're ready to perform the tests and make all the assertions, plus the really interesting thing, which is the verification of all our expectations. That basically means that, beside make the assertions over states, now we can check if some interactions was made or not (in other words if some method or some property in the interface has been called or not and if was called with certain parameters values and types or not).

I think that the test interactions are a really interesting thing to include in our classic tdd fixtures.

Download Sample Code

Enjoy.

Posted: Feb 27 2008, 05:48 PM by jescrich | with no comments
Filed under: , , , ,
GAX/GAT February 2008 Release

Finally, and after a grand effort, we got a final release of GAX/GAT February 2008 Release.

Mainly the most important improvements are that now you can use GAX side by side with Visual Studio 2005 and Visual Studio 2008 and now you don't have to do the painful task to unregister all your guidance packages prior to uninstall the previous version of GAX. In this particular release, we made an Upgrade than an Installer so you won't have to uninstall GAX, it will be just a click on the msi to get it everything update without loss any guidance package previously registered.

Some of the improvements for this release are:

  • Support side by side for Visual Studio 2005 and Visual Studio 2008.
  • Upgrade than Installer, the current GAX installer is an upgrade, so you don't have to uninstall all your guidance packages then uninstall GAX before to try install it.
  • Now you can also uninstall GAX whenever you want without unregister any guidance packages, it will do that for you ;), anyway you also have a nice UI in the uninstaller which tell you what guidance packages you will lost if you continue the GAX uninstallation.
  • Some error bug fixes when you use GAX for Visual Studio 2008 and the Experimental hive.

You can check the Grigori's Blog to get more information about this release.

Downloads

GAX and GAT must be downloaded and installed separately. GAT requires that GAX is installed first.

Remember: If you have a previous version of GAX installed on Visual Studio 2005, it will be updated to the February 2008 release of GAX. You are no longer required to uninstall GAX and the corresponding guidance packages (with an exception of GAT, which must be re-installed).

Enjoy!.

Posted: Feb 16 2008, 10:02 AM by jescrich | with 2 comment(s)
Filed under: , , , ,
GAX/GAT for Visual Studio 2008 Troubleshooter

As Victor has posted, we made a simple troubleshooter to use in case of you are having troubles with the installation and use of GAX/GAT for Visual Studio 2008 (Orcas). This utility provides a simple log of certain information about how was installed GAX/GAT on your host, making much easier the diagnose of any issue with that. So if you're having troubles just run the utility and post the information in the GAX/GAT specific forum.

You can download from here.

More Posts Next page »