Error in Exercise 11 in WSSF hand on labs

Topics: July and December Releases Forum
May 12, 2007 at 5:57 PM
Hi,
I am going through Exercise 11 in the WSSF hands on labs and I am not able to get the tests for AddExceptionShieldingEntryActionFixture pass. This is Item 6 on page 5 in the Instructions.doc. Can you please let me know what to do to get these tests to pass? Stack trace is attached below.
Thanks much,
Vasi



TestCase 'Microsoft.Practices.ServiceFactory.WCFTests.Actions.AddExceptionShieldingEntryActionFixture.ShouldCreateConfigurationSection'
failed: System.ArgumentException: GenericArguments0, 'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlerData', on 'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.NameTypeConfigurationElementCollection`1T' violates the constraint of type 'T'.
System.ArgumentException: GenericArguments0, 'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlerData', on 'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.NameTypeConfigurationElementCollection`1T' violates the constraint of type 'T'. ---> System.TypeLoadException: GenericArguments0, 'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlerData', on 'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.NamedElementCollection`1T' violates the constraint of type parameter 'T'.
at System.RuntimeTypeHandle._Instantiate(RuntimeTypeHandle[] inst)
at System.RuntimeTypeHandle.Instantiate(RuntimeTypeHandle[] inst)
at System.RuntimeType.MakeGenericType(Type[] instantiation)
--- End of inner exception stack trace ---
at System.RuntimeType.ValidateGenericArguments(MemberInfo definition, Type[] genericArguments, Exception e)
at System.RuntimeType.MakeGenericType(Type[] instantiation)
D:\users\vasi\projects\WCF Guidance Package\WCF Guidance Package\WCF Guidance Package\Actions\Configuration\AddExceptionShieldingEntryAction.cs(142,0): at Microsoft.Practices.ServiceFactory.WCF.Actions.Configuration.AddExceptionShieldingEntryAction.GetNameTypeConfigurationElementCollection(Object value)
D:\users\vasi\projects\WCF Guidance Package\WCF Guidance Package\WCF Guidance Package\Actions\Configuration\AddExceptionShieldingEntryAction.cs(124,0): at Microsoft.Practices.ServiceFactory.WCF.Actions.Configuration.AddExceptionShieldingEntryAction.SetConfigurationPropertyValue(Object obj, Object value, String propertyName, Boolean useNamedElementCollection)
D:\users\vasi\projects\WCF Guidance Package\WCF Guidance Package\WCF Guidance Package\Actions\Configuration\AddExceptionShieldingEntryAction.cs(111,0): at Microsoft.Practices.ServiceFactory.WCF.Actions.Configuration.AddExceptionShieldingEntryAction.UpdateConfigurationSection(ConfigurationSection section)
D:\users\vasi\projects\WCF Guidance Package\WCF Guidance Package\WCF Guidance Package\Actions\Configuration\AddExceptionShieldingEntryAction.cs(71,0): at Microsoft.Practices.ServiceFactory.WCF.Actions.Configuration.AddExceptionShieldingEntryAction.Execute()
D:\users\vasi\projects\WCF Guidance Package\WCF Guidance Package\UnitTests (VSTS)\WCF Guidance Package Tests\Actions\AddExceptionShieldingEntryActionFixture.cs(33,0): at Microsoft.Practices.ServiceFactory.WCFTests.Actions.AddExceptionShieldingEntryActionFixture.ShouldCreateConfigurationSection()


0 passed, 1 failed, 0 skipped, took 641.56 seconds.
May 14, 2007 at 11:17 AM
Vasi,

This problem seem to be related with the probing references of ExceptionShielding binary.
So the solution that fix this is to set the asm location to the test folder where all the required binaries lives.
Go to the PopulateArguments function and change line 90 with:

action.ExceptionHandlingAssembly = ConfigurationLoader.GetConfigurationFilePath("Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll");
After this change you should successfully run both tests.
This issue is now documented in the Hands on Lab page.