Build/Test Issues

Tests that use a transactionscope fail to run

Started by brunomlopes on 5,691 views

Hello all,

I don't seem to be able to run my integration tests.
They are nunit tests that use a transaction scope to revert the database to a known state, and all fail with the error below at [2]. Each test has a setup and teardown like [1] and the error occurs when creating the TransactionScope.

Has anyone seen anything similar? The tests run on the console runner and on the resharper runner.

Thanks,
Bruno


[1]

        [SetUp]
        public void Setup()
        {
            _TransactionScope = new TransactionScope(TransactionScopeOption.RequiresNew);
        }

        [TearDown]
        public void TearDown()
        {
            if(_TransactionScope != null)
                _TransactionScope.Dispose();
        }




[2]
SetUp : System.Configuration.ConfigurationErrorsException : An error occurred creating the configuration section handler for system.transactions/machineSettings: Could not load type 'System.e.Configuration.MachineSettingsSection' from assembly 'System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null'. (C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\machine.config line 50)
----> System.TypeLoadException : Could not load type 'System.e.Configuration.MachineSettingsSection' from assembly 'System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null'.
at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey, Boolean getLkg, Boolean checkPermission)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
at System.Transactions.Configuration.MachineSettingsSection.GetSection()
at System.Transactions.TransactionManager.get_MachineSettings()
at System.Transactions.TransactionManager.get_MaximumTimeout()
at System.Transactions.TransactionManager.ValidateTimeout(TimeSpan transactionTimeout)
at System.Transactions.TransactionManager.get_DefaultTimeout()
at System.Transactions.CommittableTransaction..ctor()
at System.Transactions.TransactionScope..ctor(TransactionScopeOption scopeOption)
Okay, it was an error in my machine.config that apparently didn't surface on the rest of the test runners.

I've fixed it and ncrunch runs ok :)
This post has been deleted.

Post a reply

Log in to reply.