[Mono-dev] UnixRegistryApi question

Cory Foy usergroup at cornetdesign.com
Sat Mar 11 19:10:58 EST 2006


Hi All,

I'm building NUnit on Linux with the latest version of Mono (.14) and am 
getting the following:

      [exec] 5) NUnit.Util.Tests.NUnitRegistryTests.TestClearRoutines : 
System.InvalidCastException : Cannot cast from source type to 
destination type.
      [exec] in <0x00095> Microsoft.Win32.UnixRegistryApi:DeleteValue 
(Microsoft.Win32.RegistryKey rkey, System.String value, Boolean 
throw_if_missing)
      [exec] in <0x00038> Microsoft.Win32.RegistryKey:DeleteValue 
(System.String value, Boolean shouldThrowWhenKeyMissing)
      [exec] in <0x0000f> Microsoft.Win32.RegistryKey:DeleteValue 
(System.String value)
      [exec] in (wrapper remoting-invoke-with-check) 
Microsoft.Win32.RegistryKey:DeleteValue (string)
      [exec] in <0x00070> NUnit.Util.NUnitRegistry:ClearKey 
(Microsoft.Win32.RegistryKey key)
      [exec] in <0x00030> NUnit.Util.NUnitRegistry:ClearSubKey 
(Microsoft.Win32.RegistryKey baseKey, System.String subKey)
      [exec] in <0x00023> NUnit.Util.NUnitRegistry:ClearTestKeys ()
      [exec] in <0x00139> 
NUnit.Util.Tests.NUnitRegistryTests:TestClearRoutines ()
      [exec] in <0x00000> <unknown method>
      [exec] in (wrapper managed-to-native) 
System.Reflection.MonoMethod:InternalInvoke (object,object[])
      [exec] in <0x0008d> System.Reflection.MonoMethod:Invoke 
(System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder 
binder, System.Object[] parameters, System.Globalization.CultureInfo 
culture)

The code is pretty straightforward:

public static void ClearKey( RegistryKey key )
{
	foreach( string name in key.GetValueNames() )
		key.DeleteValue( name );
  	foreach( string name in key.GetSubKeyNames() )
		key.DeleteSubKeyTree( name );
}


Does this look to you all to be a bug in the UnixRegistryApi, or 
something innocuous like an invalid name? The code that is calling 
ClearKey verifies that the RegistryKey it is passing in isn't null. Any 
pointers would be appreciated. Thanks!

Cory



More information about the Mono-devel-list mailing list