Skip to content

No way to set TransactionManager.DefaultTimeout #71025

@Epic-Santiago

Description

@Epic-Santiago

Description

On .NET Framework we could set the System.Transactions.TransactionManager.DefaultTimeout from the config file as follows:

<system.transactions>
  <defaultSettings timeout="00:05:00" />
</system.transactions>

On .NET 6 (and presumably all previous versions of .NET and .NET Core), that configuration is not available. Attempting to use it results in this error:

ConfigurationErrorsException: Unrecognized configuration section system.transactions.

Since DefaultTimeout has no setter, that means there is no way of changing this setting other than reflection hacks. The documentation makes no mention of this.

This is similar to #1418 but not the same. That other issue relates to MaximumTimeout, not DefaultTimeout.

Reproduction Steps

  1. Add the timeout setting per the issue description
  2. Confirm that you get a runtime error
  3. Instead try to set the DefaultTimeout
  4. Confirm that you get a compile time error as there is no setter

Expected behavior

There should be some way of setting this (config setting, setter or other API) or the setting should be removed altogether.

Actual behavior

No way to change that setting so it is effectively hard coded to 00:01:00.

Regression?

Yes. It worked on .NET Framework.

Known Workarounds

Use reflection to set the value.

Configuration

  • .NET 6
  • Windows 10
  • x64
  • It is not specific to that configuration
  • n/a

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions