Prevent ASP.NET web.config inheritance, and inheritInChildApplications attribute

By Jerome at March 23, 2008 12:34 Tags: , ,

Since I've changed my top level blog engine, I've had some troubles with YAF, the forum engine I'm using for my Remote Control software.

The forum I'm using is in a child directory, which is a child application defined in IIS as an other application. The BlogEngine.NET disables the use of Sessions, and YAF requires sessions to be enabled, plus BlogEngine.NET adds some custom HTTP handlers, which incidentally are not known but the forum application. This is quite a mess, and to be able to get both applications running without fine tuning each one to work with the other, I had to use the little known attribute inheritInChildApplications.

This attribute prevents an application from passing its configuration as a default to child applications. Using this attribute is a little tricky, and has to be used this way :


<!-- Root web.config file -->

<?xml version="1.0"?>

<configuration>

  <location path="." inheritInChildApplications="false">

    <system.web>

      <compilation debug="false" />

      <!-- other configuration attributes -->

    </system.web>

  </location>

</configuration>

This way, any child application defined below this application will not use the current configuration. There's some mystery around the inheritInChildApplications attribute; it is not defined in the dotnetconfig.xsd file and it still is a rather helpful configuration option...

Visual Studio 2008 Solution Tree Items Collapse

By Jerome at March 17, 2008 19:26 Tags: ,

Even though there is a way to expand all nodes in the solution tree of Visual Studio 2008, there is no way to do the opposite, which is collapse all. Not collapse all top level nodes, but collapse all child nodes, one by one.

There's a bug in VS2005/2008 that prevents a node from being collapsed properly for some obscure reason. The Expanded property keeps on being "true" even if set to "false".

Fortunately, a fix by Scott Kuhl which was working with Visual Studio 2005 is also working with Visual Studio 2008. The script is doing some trick to simulate a DefaultAction each node, which seems to collapse a node without using the Expanded property. 

Nice trick :) It avoids me the burden of hitting the minus and enter keys numerous times...

Blog Update

By Jerome at March 16, 2008 17:54 Tags: , ,

Last Monday, I attended a GUVSM meeting with Rod Paddock and it was a great presentation. Rod is an interesting speaker, and he seems to have some sort of an independant view on Microsoft technologies. I'm also joining Guy Barette to thank Rod for his long trip visit in Montréal !

He's been talking about MIX'08 and all the Silverlight buzz. He was also here to talk about 10 Open Source tools worth looking at, and he's mentionned BlogEngine.NET. This blog engine kept my attention, not because it's particularly easy to install, but because it's able to use an XML datasource to store its data, that it has a pretty small foot print and that it is extensible.

Back at home, I gave it a look, and decided to switch to this engine. There's a bunch of features that can be a pain to develop and stabilize, like PingBack and TrackBack protocols. It's nice to have it out of the box.

I'm just hoping that it is going to increase the visibility of this blog. We'll see :)

.NET Threads, CallContext and ILogicalThreadAffinative

By Jerome at February 10, 2008 21:53 Tags: , ,

I've recently been looking for a way to automatically pass information from a thread's current call context to any thread that's been spawned from this thread. This can be useful for many reasons, and sometimes having some TLS information like the current user, or some custom context information.

This can be done by wrapping any thread entry point around some custom code that will effectively pass the context to the new thread. This is a bit annoying, especially if this is information that is generated internally by a framework, because it requires the user of the framework to always use the wrapping method.

There's a way around this by using the CallContext class, and particularly GetData/SetData methods. Problem is, if you set some data in the CallContext, it will not pass onto a spawned thread. Actually, it will if the type you are placing in the CallContext implements the ILogicalThreadAffinative interface.

This is a marker interface that is used to avoid context data that is not meant to "flow" through each spawned thread.

It's also interesting to know that ILogicalThreadAffinative flagged types will also be passed along to threads spawned by the thread pool, and incidentally to delegates enqueued via the BeginInvoke compiler generated method.

Finally, in case of a remoting call, any ILogicalThreadAffinative flagged type will also serialized to the remote context and be serialized back to the local context.

Being able to step through the Framework's code has been somehow a time saver to better understand this :)

Some news on Bluetooth Remote Control for Windows Mobile

By Jerome at January 15, 2008 01:00 Tags:

Some news around my little software utility...

I don't have plans for a major release yet, but maybe I'll make an other small release to add some really minor enhancements.

Stay tuned :) And thanks for using Bluetooth Remote Control for Windows Mobile !

Bluetooth Remote Control 0.8.5

By Jerome at December 25, 2007 17:56 Tags:

This is a minor release to fix a bug that slipped into the previous release. A blocker bug that prevented the software to run for new users... This is now fixed !

See here to download the fixed build.

Visual Studio 2008 Presentation in Montréal

By Jerome at December 11, 2007 21:46 Tags: ,

This last Monday, there's been a presentation for the GUVSM of Visual Studio 2008 at Microsoft Montréal by Guy Barrette, a Microsoft Regional Directory. The room was a bit crowded but there was a pretty good ambience. This was my first time there and I met a former distant colleague of mine from Winwise, Laurent Duveau.

On the menu, an overview of only the tooling that can be found in Visual Studio 2008. Not that C# 3.0 and .NET 3.5 are not interesting, far from it, but this will probably be the point of another session.

Multi Targeting

VS2005 forced the migration to .NET 2.0 when coming from VS2003. VS2008 does not enforce the migration to .NET 3.5, and leaves a choice of targeting .NET 2.0, 3.0 and 3.5. Solution and Project files don't change much, which means a smoother transition from VS2005 to VS2008. Some developers can run VS2005 and some others VS2008 without any difficulties. The only downside about the multi-targeting is that Microsoft dropped the support of .NET CF 1.0 and forces the conversion of projects to .NET CF 2.0.
The target framework can also be changed afterward, upgrade or downgrade. At that point, this is a good feature but if you have a solution that contains 100+ projects, this can be a repetitive task to migrate each and every one of them. I'll discuss that in an other post, but I wrote a small tool that converts every csproj file it can find to a .NET 3.5 project. That gave me the opportunity to test XLinq, by the way :)

VSTO (Visual Studio Tools for Office)

There is now no more the need to install add-ins to create VSTO addins, support for Office 2003 and 2007 is now included out of the box. Guy showed us how to create a simple plugin that creates a task pane which opens via a custom Excel Ribbon button, fills up from a database, and then fills the selected cell with some info. Pretty interesting stuff and easy to setup. It seems that now the deployment of VSTO addins has been greatly enhanced, compared to what could be done with VSTO and VS2005.

WCF

WCF now has an integrated webservice testing tool, that allows to call your WCF webservice without having to create the little testing project in Console that calls the webservice to test it. I'm guessing that it'll be useful only in the first few minutes of the webservice development, but after that... Maybe for the demos :)

Javascript

Javascript has a better support, especially for debugging. It is now possible to step into methods defined in javascript in the actual files, not in their memory representation. It is also possible to have custom help for javascript methods ! This is a hack using xml comments like in the ones found in C#, but that's helpful. I kind of hate the javascript development partly for the lack of debugging features and intellisense, but with this, I might hate it a little bit less...

SQL Server CE

It is a port of the SQL CE engine found on Mobile Devices. It's a small database engine similar to Jet could have been back in its days, but is compatible with SQL server to some extents. There's no stored procedures, no security, but it's a cheap way to store data instead of maybe using XML files to store data.

Database Cache

which is a out of the box component that is able to create a snapshot of the database, and handle the synchronization of the snapshot later in time.

Mobile Development

And finally a few words on mobile side, for which it is now possible to test security scenarios, with third party executable signature enabled, for instance.

This was a pretty rich session, with too much to say probably, but I learnt a few things along the way. I'll definitely attend the next one in january !

Visual Studio 2008 : Where is my Solution Explorer item sort gone ?

By Jerome at December 11, 2007 13:58 Tags: , ,

As a new user of VS2008 and senior user of VS2005, you may just just start to convert your projects to VS2008. Good. Then you look at your solution and start to look for your favorite project in the Solution Explorer and have trouble finding it... Of course ! The list is not sorted...

You may wonder, where is that sorting gone ? Well, I don't know exactly but it seems that if you select a project, press F2, then enter without modifying a thing... The tree sorts itself out! The bad thing is that you can't save that sorted list, as it seems that it is only the TreeView that sorts the item list, not the internal list that is sorted... I know for a fact that there are some PowerToys that sort the entries in the SLN file, I'll try to look for that.

How could something as visible as this has passed through the beta phase ? :)

The (non generic) System.Action delegate

By Jerome at December 09, 2007 22:33 Tags: , ,

There's been one delegate I wish would have been integrated in .NET 2.0 :

1:
2: namespace System
3: {
4:   public delegate void Action();
5: }

Well, it's been added to the .NET framework 3.5. That will avoid me to create here and there an empty delegate that returns nothing and takes nothing in parameter. It's particularly useful with anonymous methods.

My discovery of that particular type is a bit odd though. A big project I'm currently working on is defining this type :

1:
2: namespace T1 { public enum Action { A } }

"T1" is made up, "Action" is not. And it's being used like this :

1:
2: Action a = Action.A;

And it compiled just fine using .NET 2.0. During a migration to the .NET Framework 3.5, I came across some compilation problems telling me that the resolution of "Action" was ambiguous. I thought at first that this was because of a change in the resolutions of types in C# 3.0, but after a bit of digging I found out about that non-generic System.Action delegate, which is defined in System.Core.dll. By the way, they also added some other System.Action overloads with two, three and four generic parameters.

Reflector tells me that the non generic version is being used by System.Linq.Expressions.Expression. I'm guessing that might be used by LINQ in some way... maybe by some generated code.

Bluetooth Remote Control 0.8.4

By Jerome at December 09, 2007 20:06 Tags:

This is my first Canadian based release :) This is also a minor release that addresses a few issues and adds some cheap features that have an important added value.

Download here.

I've changed some minor things like :

  • Adding panning control to Winamp and the Windows Mixer
  • Adding the ability to start the server minimized to tray
  • Adding a Start with Windows option at install time and on the server side menu
  • Adding the ability to keep the Backlight on for the Mobile Side when connected
  • Adding new bindings for the Windows Media Center (Channel Up/Down, Zoom, The Green Button)
  • Building using Windows Broadcom SDK 6.1.0.1501 and Windows CE SDK 1.7.1.5201
  • Fixing mobile side crash when tapping on the screen in some situations
  • Adding a more explicit message when the Bluetooth Stack is not supported on the Mobile Side.

I'm also considering a migration to Visual Studio 2008 and .NET 3.5, but this means that I'll have to drop the support for WM 2003 based devices. VS2008 does not allow the compilation of .NET CF 1.0 projects, which bugs me a bit. So this release might be the last to support WM2003 devices. I don't have much of choice either... .NET 3.5 muses are quite appealing !

Have fun !

About me

My name is Jerome Laban, I am a Software Architect, C# MVP and .NET enthustiast from Montréal, QC. You will find my blog on this site, where I'm adding my thoughts on current events, or the things I'm working on, such as the Remote Control for Windows Phone.