ExtensionToPropertySheetSample & Unable to get installer types

I am currently researching possible scenarios for extending ADUC property pages with .NET. I have started with the ExtensionToPropertySheetSample, shipped with (probably) with VS2005 or VS2008 (I’m not sure how it made to my dev box 😉 ), located by default in the C:Program FilesMicrosoft SDKsWindowsv6.0SamplesSysMgmtMMC3.0

After quick change in broken references it compiled nicely and I wanted to install it. During install I got the finger:

C:Program FilesMicrosoft SDKsWindowsv6.0SamplesSysMgmtMMC3.0ExtensionToPropertySheetSamplebinDebug>installutil ExtensionToPropertySheetSample.dll /showcallstack
Microsoft (R) .NET Framework Installation utility Version 2.0.50727.1433
Copyright (c) Microsoft Corporation.  All rights reserved.

Running a transacted installation.

Beginning the Install phase of the installation.
See the contents of the log file for the C:Program FilesMicrosoft SDKsWindowsv6.0SamplesSysMgmtMMC3.0ExtensionToPropertySheetSamplebinDebugExtensionToPropertySheetSample.dll assembly's progress.
The file is located at C:Program FilesMicrosoft SDKsWindowsv6.0SamplesSysMgmtMMC3.0ExtensionToPropertySheetSamplebinDebugExtensionToPropertySheetSample.InstallLog.
Installing assembly 'C:Program FilesMicrosoft SDKsWindowsv6.0SamplesSysMgmtMMC3.0ExtensionToPropertySheetSamplebinDebugExtensionToPropertySheetSample.dll'.
Affected parameters are:
   logtoconsole =
   assemblypath = C:Program FilesMicrosoft SDKsWindowsv6.0SamplesSysMgmtMMC3.0ExtensionToPropertySheetSamplebinDebugExtensionToPropertySheetSample.dll
   logfile = C:Program FilesMicrosoft SDKsWindowsv6.0SamplesSysMgmtMMC3.0ExtensionToPropertySheetSamplebinDebugExtensionToPropertySheetSample.InstallLog
An exception occurred while trying to find the installers in the C:Program FilesMicrosoft SDKsWindowsv6.0SamplesSysMgmtMMC3.0ExtensionToPropertySheetSamplebinDebugExtensionToPropertySheetSample.dll assembly.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Aborting installation for C:Program FilesMicrosoft SDKsWindowsv6.0SamplesSysMgmtMMC3.0ExtensionToPropertySheetSamplebinDebugExtensionToPropertySheetSample.dll.

An exception occurred during the Install phase.
System.InvalidOperationException: Unable to get installer types in the C:Program FilesMicrosoft SDKsWindowsv6.0SamplesSysMgmtMMC3.0ExtensionToPropertySheetSamplebinDebugExtensionToPropertySheetSample.dll assembly.
   at System.Configuration.Install.AssemblyInstaller.InitializeFromAssembly()
   at System.Configuration.Install.AssemblyInstaller.Install(IDictionary savedState)
   at System.Configuration.Install.Installer.Install(IDictionary stateSaver)
   at System.Configuration.Install.TransactedInstaller.Install(IDictionary savedState)
The inner exception System.Reflection.ReflectionTypeLoadException was thrown with the following error message: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information..
   at System.Reflection.Module._GetTypesInternal(StackCrawlMark& stackMark)
   at System.Reflection.Module.GetTypes()
   at System.Configuration.Install.AssemblyInstaller.GetInstallerTypes(Assembly assem)
   at System.Configuration.Install.AssemblyInstaller.InitializeFromAssembly()

The Rollback phase of the installation is beginning.
See the contents of the log file for the C:Program FilesMicrosoft SDKsWindowsv6.0SamplesSysMgmtMMC3.0ExtensionToPropertySheetSamplebinDebugExtensionToPropertySheetSample.dll assembly's progress.
The file is located at C:Program FilesMicrosoft SDKsWindowsv6.0SamplesSysMgmtMMC3.0ExtensionToPropertySheetSamplebinDebugExtensionToPropertySheetSample.InstallLog.
Rolling back assembly 'C:Program FilesMicrosoft SDKsWindowsv6.0SamplesSysMgmtMMC3.0ExtensionToPropertySheetSamplebinDebugExtensionToPropertySheetSample.dll'.
Affected parameters are:
   logtoconsole =
   assemblypath = C:Program FilesMicrosoft SDKsWindowsv6.0SamplesSysMgmtMMC3.0ExtensionToPropertySheetSamplebinDebugExtensionToPropertySheetSample.dll
   logfile = C:Program FilesMicrosoft SDKsWindowsv6.0SamplesSysMgmtMMC3.0ExtensionToPropertySheetSamplebinDebugExtensionToPropertySheetSample.InstallLog
An exception occurred while trying to find the installers in the C:Program FilesMicrosoft SDKsWindowsv6.0SamplesSysMgmtMMC3.0ExtensionToPropertySheetSamplebinDebugExtensionToPropertySheetSample.dll assembly.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Aborting installation for C:Program FilesMicrosoft SDKsWindowsv6.0SamplesSysMgmtMMC3.0ExtensionToPropertySheetSamplebinDebugExtensionToPropertySheetSample.dll.
An exception occurred during the Rollback phase of the System.Configuration.Install.AssemblyInstaller installer.
System.InvalidOperationException: Unable to get installer types in the C:Program FilesMicrosoft SDKsWindowsv6.0SamplesSysMgmtMMC3.0ExtensionToPropertySheetSamplebinDebugExtensionToPropertySheetSample.dll assembly.
   at System.Configuration.Install.AssemblyInstaller.InitializeFromAssembly()
   at System.Configuration.Install.AssemblyInstaller.Rollback(IDictionary savedState)
   at System.Configuration.Install.Installer.Rollback(IDictionary savedState)
The inner exception System.Reflection.ReflectionTypeLoadException was thrown with the following error message: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information..
   at System.Reflection.Module._GetTypesInternal(StackCrawlMark& stackMark)
   at System.Reflection.Module.GetTypes()
   at System.Configuration.Install.AssemblyInstaller.GetInstallerTypes(Assembly assem)
   at System.Configuration.Install.AssemblyInstaller.InitializeFromAssembly()
An exception occurred during the Rollback phase of the installation. This exception will be ignored and the rollback will continue. However, the machine might not fully revert to its initial state after the rollback is complete.

The Rollback phase completed successfully.

The transacted install has completed.
The installation failed, and the rollback has been performed.

Now, that’s a helpful error message. Assuming that it should just install, it could be little more descriptive 🙁

So I have tried FUSLOGVW.exe tool to see those binding errors (by default in C:Program FilesMicrosoft Visual Studio 8SDKv2.0Bin). Again after pocking around i’ve got some info (by default it does not log anything 😉 ):

P

It looks OK, and examining those log entries (each has it’s on html log file!) did give any clue.

After a while of doing something else, I have returned to the task with fresh ideas: catch the binding failure in VS2005 while debugging! For this you have to configure Debug->Exceptions for the debugger to stop on BindingFailure:

Binding failures in Debug-Exceptions

Voila! That’s the exception message that tells me something:

BindingFailure was detected
Message: The assembly with display name 'Microsoft.ManagementConsole' failed to load in the 'LoadFrom' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.ManagementConsole, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
File name: 'Microsoft.ManagementConsole, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' ---> System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A)
The Zone of the assembly that failed was:
MyComputer

Something I already know, Microsoft.ManagementConsole.dll does not have a valid strong name. One of the first thing I tryed after getting binding errors was to try install Microsoft.ManagementConsole.dll in GAC, and I have dicovered that it is only partially signed. What I did not know is that partially singed assemblies can cause such problems, silly from where I am now 🙁 .

So either I took wrong assembly, and the one in c:Program FilesReference AssembliesMicrosoftmmcv3.0 is there for some other reason than to reference it ;P or there is another assembly that is fully signed and good to go. As matter of the fact there is annother assembly in c:WINDOWSsystem32 but valid strong name is not the one difference, these are different file versions: 6.0.6001.17011 and 5.2.3790.2612.

So now I have referenced this assembly and copied it locally just to be sure, and with it its presemmed dependency: mmcfxcommon.dll. This time installation works! 🙂

I’am fanatic beliver of always including inner/cathed excetptions while throwing another ones, and always showing all the inner exceptions info. I belive that developer life would be a lot easier if it would be a common practice. I was jumping through hoops of fire just to get a simple „strong name validation failed” message from the assembly binder.

3 Comments

  1. Eric

    I am very interested in the code you used to create your property sheet extension for Active Directory Users and Computers? Could you possibly share your code??

Dodaj komentarz