Imported Upstream version 5.2.0.175

Former-commit-id: bb0468d0f257ff100aa895eb5fe583fb5dfbf900
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-06-07 13:16:24 +00:00
parent 4bdbaf4a88
commit 966bba02bb
8776 changed files with 346420 additions and 149650 deletions

View File

@@ -0,0 +1,50 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Transactions.Local.Tests", "tests\System.Transactions.Local.Tests.csproj", "{1C397868-9644-48CB-94BF-35805C4AE024}"
ProjectSection(ProjectDependencies) = postProject
{E97557E3-7DB1-4828-ACA5-44D8C68B6698} = {E97557E3-7DB1-4828-ACA5-44D8C68B6698}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Transactions.Local", "src\System.Transactions.Local.csproj", "{E97557E3-7DB1-4828-ACA5-44D8C68B6698}"
ProjectSection(ProjectDependencies) = postProject
{A0C4383D-B0B0-492F-AEEE-CA1BC6E5B6D4} = {A0C4383D-B0B0-492F-AEEE-CA1BC6E5B6D4}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Transactions.Local", "ref\System.Transactions.Local.csproj", "{A0C4383D-B0B0-492F-AEEE-CA1BC6E5B6D4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{1A2F9F4A-A032-433E-B914-ADD5992BB178}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E107E9C1-E893-4E87-987E-04EF0DCEAEFD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{2E666815-2EDB-464B-9DF6-380BF4789AD4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1C397868-9644-48CB-94BF-35805C4AE024}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU
{1C397868-9644-48CB-94BF-35805C4AE024}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU
{1C397868-9644-48CB-94BF-35805C4AE024}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU
{1C397868-9644-48CB-94BF-35805C4AE024}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU
{E97557E3-7DB1-4828-ACA5-44D8C68B6698}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU
{E97557E3-7DB1-4828-ACA5-44D8C68B6698}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU
{E97557E3-7DB1-4828-ACA5-44D8C68B6698}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU
{E97557E3-7DB1-4828-ACA5-44D8C68B6698}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU
{A0C4383D-B0B0-492F-AEEE-CA1BC6E5B6D4}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU
{A0C4383D-B0B0-492F-AEEE-CA1BC6E5B6D4}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU
{A0C4383D-B0B0-492F-AEEE-CA1BC6E5B6D4}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU
{A0C4383D-B0B0-492F-AEEE-CA1BC6E5B6D4}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{1C397868-9644-48CB-94BF-35805C4AE024} = {1A2F9F4A-A032-433E-B914-ADD5992BB178}
{E97557E3-7DB1-4828-ACA5-44D8C68B6698} = {E107E9C1-E893-4E87-987E-04EF0DCEAEFD}
{A0C4383D-B0B0-492F-AEEE-CA1BC6E5B6D4} = {2E666815-2EDB-464B-9DF6-380BF4789AD4}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\dir.props" />
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<IsNETCoreApp>true</IsNETCoreApp>
<IsUAP>true</IsUAP>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
netcoreapp;
uap;
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<OutputType>Library</OutputType>
<ProjectGuid>{A0C4383D-B0B0-492F-AEEE-CA1BC6E5B6D4}</ProjectGuid>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Release|AnyCPU'" />
<ItemGroup>
<Compile Include="System.Transactions.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
<ProjectReference Include="..\..\System.Runtime.Serialization.Primitives\ref\System.Runtime.Serialization.Primitives.csproj" />
<ProjectReference Include="..\..\System.Runtime.Serialization.Formatters\ref\System.Runtime.Serialization.Formatters.csproj" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View File

@@ -0,0 +1,258 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// ------------------------------------------------------------------------------
// Changes to this file must follow the http://aka.ms/api-review process.
// ------------------------------------------------------------------------------
namespace System.Transactions
{
public sealed partial class CommittableTransaction : System.Transactions.Transaction, System.IAsyncResult
{
public CommittableTransaction() { }
public CommittableTransaction(System.TimeSpan timeout) { }
public CommittableTransaction(System.Transactions.TransactionOptions options) { }
object System.IAsyncResult.AsyncState { get { throw null; } }
System.Threading.WaitHandle System.IAsyncResult.AsyncWaitHandle { get { throw null; } }
bool System.IAsyncResult.CompletedSynchronously { get { throw null; } }
bool System.IAsyncResult.IsCompleted { get { throw null; } }
public System.IAsyncResult BeginCommit(System.AsyncCallback asyncCallback, object asyncState) { throw null; }
public void Commit() { }
public void EndCommit(System.IAsyncResult asyncResult) { }
}
public enum DependentCloneOption
{
BlockCommitUntilComplete = 0,
RollbackIfNotComplete = 1,
}
public sealed partial class DependentTransaction : System.Transactions.Transaction
{
internal DependentTransaction() { }
public void Complete() { }
}
public partial class Enlistment
{
internal Enlistment() { }
public void Done() { }
}
[System.FlagsAttribute]
public enum EnlistmentOptions
{
EnlistDuringPrepareRequired = 1,
None = 0,
}
public enum EnterpriseServicesInteropOption
{
Automatic = 1,
Full = 2,
None = 0,
}
public delegate System.Transactions.Transaction HostCurrentTransactionCallback();
public partial interface IDtcTransaction
{
void Abort(System.IntPtr reason, int retaining, int async);
void Commit(int retaining, int commitType, int reserved);
void GetTransactionInfo(System.IntPtr transactionInformation);
}
public partial interface IEnlistmentNotification
{
void Commit(System.Transactions.Enlistment enlistment);
void InDoubt(System.Transactions.Enlistment enlistment);
void Prepare(System.Transactions.PreparingEnlistment preparingEnlistment);
void Rollback(System.Transactions.Enlistment enlistment);
}
public partial interface IPromotableSinglePhaseNotification : System.Transactions.ITransactionPromoter
{
void Initialize();
void Rollback(System.Transactions.SinglePhaseEnlistment singlePhaseEnlistment);
void SinglePhaseCommit(System.Transactions.SinglePhaseEnlistment singlePhaseEnlistment);
}
public partial interface ISimpleTransactionSuperior : System.Transactions.ITransactionPromoter
{
void Rollback();
}
public partial interface ISinglePhaseNotification : System.Transactions.IEnlistmentNotification
{
void SinglePhaseCommit(System.Transactions.SinglePhaseEnlistment singlePhaseEnlistment);
}
public enum IsolationLevel
{
Chaos = 5,
ReadCommitted = 2,
ReadUncommitted = 3,
RepeatableRead = 1,
Serializable = 0,
Snapshot = 4,
Unspecified = 6,
}
public partial interface ITransactionPromoter
{
byte[] Promote();
}
public partial class PreparingEnlistment : System.Transactions.Enlistment
{
internal PreparingEnlistment() { }
public void ForceRollback() { }
public void ForceRollback(System.Exception e) { }
public void Prepared() { }
public byte[] RecoveryInformation() { throw null; }
}
public partial class SinglePhaseEnlistment : System.Transactions.Enlistment
{
internal SinglePhaseEnlistment() { }
public void Aborted() { }
public void Aborted(System.Exception e) { }
public void Committed() { }
public void InDoubt() { }
public void InDoubt(System.Exception e) { }
}
public sealed partial class SubordinateTransaction : System.Transactions.Transaction
{
public SubordinateTransaction(System.Transactions.IsolationLevel isoLevel, System.Transactions.ISimpleTransactionSuperior superior) { }
}
public partial class Transaction : System.IDisposable, System.Runtime.Serialization.ISerializable
{
internal Transaction() { }
public static System.Transactions.Transaction Current { get { throw null; } set { } }
public System.Transactions.IsolationLevel IsolationLevel { get { throw null; } }
public System.Guid PromoterType { get { throw null; } }
public System.Transactions.TransactionInformation TransactionInformation { get { throw null; } }
public event System.Transactions.TransactionCompletedEventHandler TransactionCompleted { add { } remove { } }
public System.Transactions.Transaction Clone() { throw null; }
public System.Transactions.DependentTransaction DependentClone(System.Transactions.DependentCloneOption cloneOption) { throw null; }
public void Dispose() { }
public System.Transactions.Enlistment EnlistDurable(System.Guid resourceManagerIdentifier, System.Transactions.IEnlistmentNotification enlistmentNotification, System.Transactions.EnlistmentOptions enlistmentOptions) { throw null; }
public System.Transactions.Enlistment EnlistDurable(System.Guid resourceManagerIdentifier, System.Transactions.ISinglePhaseNotification singlePhaseNotification, System.Transactions.EnlistmentOptions enlistmentOptions) { throw null; }
public bool EnlistPromotableSinglePhase(System.Transactions.IPromotableSinglePhaseNotification promotableSinglePhaseNotification) { throw null; }
public bool EnlistPromotableSinglePhase(System.Transactions.IPromotableSinglePhaseNotification promotableSinglePhaseNotification, System.Guid promoterType) { throw null; }
public System.Transactions.Enlistment EnlistVolatile(System.Transactions.IEnlistmentNotification enlistmentNotification, System.Transactions.EnlistmentOptions enlistmentOptions) { throw null; }
public System.Transactions.Enlistment EnlistVolatile(System.Transactions.ISinglePhaseNotification singlePhaseNotification, System.Transactions.EnlistmentOptions enlistmentOptions) { throw null; }
public override bool Equals(object obj) { throw null; }
public override int GetHashCode() { throw null; }
public byte[] GetPromotedToken() { throw null; }
public static bool operator ==(System.Transactions.Transaction x, System.Transactions.Transaction y) { throw null; }
public static bool operator !=(System.Transactions.Transaction x, System.Transactions.Transaction y) { throw null; }
public System.Transactions.Enlistment PromoteAndEnlistDurable(System.Guid resourceManagerIdentifier, System.Transactions.IPromotableSinglePhaseNotification promotableNotification, System.Transactions.ISinglePhaseNotification enlistmentNotification, System.Transactions.EnlistmentOptions enlistmentOptions) { throw null; }
public void Rollback() { }
public void Rollback(System.Exception e) { }
public void SetDistributedTransactionIdentifier(System.Transactions.IPromotableSinglePhaseNotification promotableNotification, System.Guid distributedTransactionIdentifier) { }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext context) { }
}
public partial class TransactionAbortedException : System.Transactions.TransactionException
{
public TransactionAbortedException() { }
protected TransactionAbortedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public TransactionAbortedException(string message) { }
public TransactionAbortedException(string message, System.Exception innerException) { }
}
public delegate void TransactionCompletedEventHandler(object sender, System.Transactions.TransactionEventArgs e);
public partial class TransactionEventArgs : System.EventArgs
{
public TransactionEventArgs() { }
public System.Transactions.Transaction Transaction { get { throw null; } }
}
public partial class TransactionException : System.SystemException
{
public TransactionException() { }
protected TransactionException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public TransactionException(string message) { }
public TransactionException(string message, System.Exception innerException) { }
}
public partial class TransactionInDoubtException : System.Transactions.TransactionException
{
public TransactionInDoubtException() { }
protected TransactionInDoubtException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public TransactionInDoubtException(string message) { }
public TransactionInDoubtException(string message, System.Exception innerException) { }
}
public partial class TransactionInformation
{
internal TransactionInformation() { }
public System.DateTime CreationTime { get { throw null; } }
public System.Guid DistributedIdentifier { get { throw null; } }
public string LocalIdentifier { get { throw null; } }
public System.Transactions.TransactionStatus Status { get { throw null; } }
}
public static partial class TransactionInterop
{
public static readonly System.Guid PromoterTypeDtc;
public static System.Transactions.IDtcTransaction GetDtcTransaction(System.Transactions.Transaction transaction) { throw null; }
public static byte[] GetExportCookie(System.Transactions.Transaction transaction, byte[] whereabouts) { throw null; }
public static System.Transactions.Transaction GetTransactionFromDtcTransaction(System.Transactions.IDtcTransaction transactionNative) { throw null; }
public static System.Transactions.Transaction GetTransactionFromExportCookie(byte[] cookie) { throw null; }
public static System.Transactions.Transaction GetTransactionFromTransmitterPropagationToken(byte[] propagationToken) { throw null; }
public static byte[] GetTransmitterPropagationToken(System.Transactions.Transaction transaction) { throw null; }
public static byte[] GetWhereabouts() { throw null; }
}
public static partial class TransactionManager
{
public static System.TimeSpan DefaultTimeout { get { throw null; } }
public static System.Transactions.HostCurrentTransactionCallback HostCurrentCallback { get { throw null; } set { } }
public static System.TimeSpan MaximumTimeout { get { throw null; } }
public static event System.Transactions.TransactionStartedEventHandler DistributedTransactionStarted { add { } remove { } }
public static void RecoveryComplete(System.Guid resourceManagerIdentifier) { }
public static System.Transactions.Enlistment Reenlist(System.Guid resourceManagerIdentifier, byte[] recoveryInformation, System.Transactions.IEnlistmentNotification enlistmentNotification) { throw null; }
}
public partial class TransactionManagerCommunicationException : System.Transactions.TransactionException
{
public TransactionManagerCommunicationException() { }
protected TransactionManagerCommunicationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public TransactionManagerCommunicationException(string message) { }
public TransactionManagerCommunicationException(string message, System.Exception innerException) { }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public partial struct TransactionOptions
{
public System.Transactions.IsolationLevel IsolationLevel { get { throw null; } set { } }
public System.TimeSpan Timeout { get { throw null; } set { } }
public override bool Equals(object obj) { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Transactions.TransactionOptions x, System.Transactions.TransactionOptions y) { throw null; }
public static bool operator !=(System.Transactions.TransactionOptions x, System.Transactions.TransactionOptions y) { throw null; }
}
public partial class TransactionPromotionException : System.Transactions.TransactionException
{
public TransactionPromotionException() { }
protected TransactionPromotionException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public TransactionPromotionException(string message) { }
public TransactionPromotionException(string message, System.Exception innerException) { }
}
public sealed partial class TransactionScope : System.IDisposable
{
public TransactionScope() { }
public TransactionScope(System.Transactions.Transaction transactionToUse) { }
public TransactionScope(System.Transactions.Transaction transactionToUse, System.TimeSpan scopeTimeout) { }
public TransactionScope(System.Transactions.Transaction transactionToUse, System.TimeSpan scopeTimeout, System.Transactions.EnterpriseServicesInteropOption interopOption) { }
public TransactionScope(System.Transactions.Transaction transactionToUse, System.TimeSpan scopeTimeout, System.Transactions.TransactionScopeAsyncFlowOption asyncFlowOption) { }
public TransactionScope(System.Transactions.Transaction transactionToUse, System.Transactions.TransactionScopeAsyncFlowOption asyncFlowOption) { }
public TransactionScope(System.Transactions.TransactionScopeAsyncFlowOption asyncFlowOption) { }
public TransactionScope(System.Transactions.TransactionScopeOption scopeOption) { }
public TransactionScope(System.Transactions.TransactionScopeOption scopeOption, System.TimeSpan scopeTimeout) { }
public TransactionScope(System.Transactions.TransactionScopeOption scopeOption, System.TimeSpan scopeTimeout, System.Transactions.TransactionScopeAsyncFlowOption asyncFlowOption) { }
public TransactionScope(System.Transactions.TransactionScopeOption scopeOption, System.Transactions.TransactionOptions transactionOptions) { }
public TransactionScope(System.Transactions.TransactionScopeOption scopeOption, System.Transactions.TransactionOptions transactionOptions, System.Transactions.EnterpriseServicesInteropOption interopOption) { }
public TransactionScope(System.Transactions.TransactionScopeOption scopeOption, System.Transactions.TransactionOptions transactionOptions, System.Transactions.TransactionScopeAsyncFlowOption asyncFlowOption) { }
public TransactionScope(System.Transactions.TransactionScopeOption scopeOption, System.Transactions.TransactionScopeAsyncFlowOption asyncFlowOption) { }
public void Complete() { }
public void Dispose() { }
}
public enum TransactionScopeAsyncFlowOption
{
Enabled = 1,
Suppress = 0,
}
public enum TransactionScopeOption
{
Required = 0,
RequiresNew = 1,
Suppress = 2,
}
public delegate void TransactionStartedEventHandler(object sender, System.Transactions.TransactionEventArgs e);
public enum TransactionStatus
{
Aborted = 2,
Active = 0,
Committed = 1,
InDoubt = 3,
}
}

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
netcoreapp;
uap-Windows_NT;
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="AsyncFlowAndESInteropNotSupported" xml:space="preserve"><value>TransactionScope with TransactionScopeAsyncFlowOption.Enabled option is not supported when the TransactionScope is used within Enterprise Service context with Automatic or Full EnterpriseServicesInteropOption enabled in parent scope.</value></data>
<data name="BadAsyncResult" xml:space="preserve"><value>The IAsyncResult parameter must be the same parameter returned by BeginCommit.</value></data>
<data name="BadResourceManagerId" xml:space="preserve"><value>Resource Manager Identifiers cannot be Guid.Empty.</value></data>
<data name="CannotPromoteSnapshot" xml:space="preserve"><value>Transactions with IsolationLevel Snapshot cannot be promoted.</value></data>
<data name="CannotSetCurrent" xml:space="preserve"><value>Current cannot be set directly when Com+ Interop is enabled.</value></data>
<data name="ConfigInvalidTimeSpanValue" xml:space="preserve"><value>Valid TimeSpan values are greater than TimeSpan.Zero.</value></data>
<data name="CurrentDelegateSet" xml:space="preserve"><value>The delegate for an external current can only be set once.</value></data>
<data name="DisposeScope" xml:space="preserve"><value>The current TransactionScope is already complete. You should dispose the TransactionScope.</value></data>
<data name="EnlistmentStateException" xml:space="preserve"><value>The operation is not valid for the current state of the enlistment.</value></data>
<data name="EsNotSupported" xml:space="preserve"><value>Com+ Interop features cannot be supported.</value></data>
<data name="InternalError" xml:space="preserve"><value>Internal Error</value></data>
<data name="InvalidArgument" xml:space="preserve"><value>The argument is invalid.</value></data>
<data name="InvalidIPromotableSinglePhaseNotificationSpecified" xml:space="preserve"><value>The specified IPromotableSinglePhaseNotification is not the same as the one provided to EnlistPromotableSinglePhase.</value></data>
<data name="InvalidRecoveryInformation" xml:space="preserve"><value>Transaction Manager in the Recovery Information does not match the configured transaction manager.</value></data>
<data name="InvalidScopeThread" xml:space="preserve"><value>A TransactionScope must be disposed on the same thread that it was created.</value></data>
<data name="PromotionFailed" xml:space="preserve"><value>There was an error promoting the transaction to a distributed transaction.</value></data>
<data name="PromotedReturnedInvalidValue" xml:space="preserve"><value>The Promote method returned an invalid value for the distributed transaction.</value></data>
<data name="PromotedTransactionExists" xml:space="preserve"><value>The transaction returned from Promote already exists as a distributed transaction.</value></data>
<data name="TooLate" xml:space="preserve"><value>It is too late to add enlistments to this transaction.</value></data>
<data name="TraceTransactionTimeout" xml:space="preserve"><value>Transaction Timeout</value></data>
<data name="TransactionAborted" xml:space="preserve"><value>The transaction has aborted.</value></data>
<data name="TransactionAlreadyCompleted" xml:space="preserve"><value>DependentTransaction.Complete or CommittableTransaction.Commit has already been called for this transaction.</value></data>
<data name="TransactionIndoubt" xml:space="preserve"><value>The transaction is in doubt.</value></data>
<data name="TransactionManagerCommunicationException" xml:space="preserve"><value>Communication with the underlying transaction manager has failed.</value></data>
<data name="TransactionScopeComplete" xml:space="preserve"><value>The current TransactionScope is already complete.</value></data>
<data name="TransactionScopeIncorrectCurrent" xml:space="preserve"><value>Transaction.Current has changed inside of the TransactionScope.</value></data>
<data name="TransactionScopeInvalidNesting" xml:space="preserve"><value>TransactionScope nested incorrectly.</value></data>
<data name="TransactionScopeIsolationLevelDifferentFromTransaction" xml:space="preserve"><value>The transaction specified for TransactionScope has a different IsolationLevel than the value requested for the scope.</value></data>
<data name="TransactionScopeTimerObjectInvalid" xml:space="preserve"><value>TransactionScope timer object is invalid.</value></data>
<data name="TransactionStateException" xml:space="preserve"><value>The operation is not valid for the state of the transaction.</value></data>
<data name="UnexpectedFailureOfThreadPool" xml:space="preserve"><value>There was an unexpected failure of QueueUserWorkItem.</value></data>
<data name="UnexpectedTimerFailure" xml:space="preserve"><value>There was an unexpected failure of a timer.</value></data>
<data name="UnrecognizedRecoveryInformation" xml:space="preserve"><value>The RecoveryInformation provided is not recognized by this version of System.Transactions.</value></data>
<data name="VolEnlistNoRecoveryInfo" xml:space="preserve"><value>Volatile enlistments do not generate recovery information.</value></data>
<data name="DistributedTxIDInTransactionException" xml:space="preserve"><value>{0} Distributed Transaction ID is {1}</value></data>
<data name="PromoterTypeInvalid" xml:space="preserve"><value>The specified PromoterType is invalid.</value></data>
<data name="PromoterTypeUnrecognized" xml:space="preserve"><value>There is a promotable enlistment for the transaction which has a PromoterType value that is not recognized by System.Transactions. {0}</value></data>
<data name="DistributedNotSupported" xml:space="preserve"><value>This platform does not support distributed transactions.</value></data>
</root>

View File

@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<ProjectGuid>{E97557E3-7DB1-4828-ACA5-44D8C68B6698}</ProjectGuid>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<!-- Default configurations to help VS understand the options -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Windows_NT-Release|AnyCPU'" />
<ItemGroup>
<Compile Include="System\Transactions\CommittableTransaction.cs" />
<Compile Include="System\Transactions\DependentTransaction.cs" />
<Compile Include="System\Transactions\DistributedTransaction.cs" />
<Compile Include="System\Transactions\DurableEnlistmentState.cs" />
<Compile Include="System\Transactions\EnterpriseServices.cs" />
<Compile Include="System\Transactions\Enlistment.cs" />
<Compile Include="System\Transactions\EnlistmentState.cs" />
<Compile Include="System\Transactions\EnlistmentTraceIdentifier.cs" />
<Compile Include="System\Transactions\IEnlistmentNotification.cs" />
<Compile Include="System\Transactions\InternalTransaction.cs" />
<Compile Include="System\Transactions\IPromotableSinglePhaseNotification.cs" />
<Compile Include="System\Transactions\ISimpleTransactionSuperior.cs" />
<Compile Include="System\Transactions\ISinglePhaseNotification.cs" />
<Compile Include="System\Transactions\ITransactionPromoter.cs" />
<Compile Include="System\Transactions\PreparingEnlistment.cs" />
<Compile Include="System\Transactions\SinglePhaseEnlistment.cs" />
<Compile Include="System\Transactions\SubordinateTransaction.cs" />
<Compile Include="System\Transactions\Transaction.cs" />
<Compile Include="System\Transactions\TransactionException.cs" />
<Compile Include="System\Transactions\TransactionInformation.cs" />
<Compile Include="System\Transactions\TransactionInterop.cs" />
<Compile Include="System\Transactions\TransactionManager.cs" />
<Compile Include="System\Transactions\TransactionOptions.cs" />
<Compile Include="System\Transactions\TransactionScope.cs" />
<Compile Include="System\Transactions\TransactionState.cs" />
<Compile Include="System\Transactions\TransactionTable.cs" />
<Compile Include="System\Transactions\TransactionTraceIdentifier.cs" />
<Compile Include="System\Transactions\VolatileEnlistmentMultiplexing.cs" />
<Compile Include="System\Transactions\VolatileEnlistmentState.cs" />
<Compile Include="System\Transactions\Configuration\AppSettings.cs" />
<Compile Include="System\Transactions\Configuration\ConfigurationStrings.cs" />
<Compile Include="System\Transactions\Configuration\DefaultSettingsSection.cs" />
<Compile Include="System\Transactions\Configuration\MachineSettingsSection.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Diagnostics.Debug" />
<Reference Include="System.Diagnostics.Tools" />
<Reference Include="System.Diagnostics.Tracing" />
<Reference Include="System.Resources.ResourceManager" />
<Reference Include="System.Runtime" />
<Reference Include="System.Runtime.Extensions" />
<Reference Include="System.Runtime.InteropServices" />
<Reference Include="System.Runtime.Serialization.Formatters" />
<Reference Include="System.Threading" />
<Reference Include="System.Threading.Thread" />
<Reference Include="System.Threading.ThreadPool" />
<Reference Include="System.Threading.Timer" />
</ItemGroup>
<ItemGroup>
<Compile Include="System\Transactions\TransactionsEtwProvider.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View File

@@ -0,0 +1,230 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Threading;
namespace System.Transactions
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2229", Justification="Serialization not yet supported and will be done using DistributedTransaction")]
[Serializable]
public sealed class CommittableTransaction : Transaction, IAsyncResult
{
internal bool _completedSynchronously = false;
// Create a transaction with defaults
public CommittableTransaction() : this(TransactionManager.DefaultIsolationLevel, TransactionManager.DefaultTimeout)
{
}
// Create a transaction with the given info
public CommittableTransaction(TimeSpan timeout) : this(TransactionManager.DefaultIsolationLevel, timeout)
{
}
// Create a transaction with the given options
public CommittableTransaction(TransactionOptions options) : this(options.IsolationLevel, options.Timeout)
{
}
internal CommittableTransaction(IsolationLevel isoLevel, TimeSpan timeout) : base(isoLevel, (InternalTransaction)null)
{
// object to use for synchronization rather than locking on a public object
_internalTransaction = new InternalTransaction(timeout, this);
// Because we passed null for the internal transaction to the base class, we need to
// fill in the traceIdentifier field here.
_internalTransaction._cloneCount = 1;
_cloneId = 1;
TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
if (etwLog.IsEnabled())
{
etwLog.TransactionCreated(this, "CommittableTransaction");
}
}
public IAsyncResult BeginCommit(AsyncCallback asyncCallback, object asyncState)
{
TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
if (etwLog.IsEnabled())
{
etwLog.MethodEnter(TraceSourceType.TraceSourceLtm, this);
etwLog.TransactionCommit(this, "CommittableTransaction");
}
if (Disposed)
{
throw new ObjectDisposedException(nameof(CommittableTransaction));
}
lock (_internalTransaction)
{
if (_complete)
{
throw TransactionException.CreateTransactionCompletedException(DistributedTxId);
}
// this.complete will get set to true when the transaction enters a state that is
// beyond Phase0.
_internalTransaction.State.BeginCommit(_internalTransaction, true, asyncCallback, asyncState);
}
if (etwLog.IsEnabled())
{
etwLog.MethodExit(TraceSourceType.TraceSourceLtm, this);
}
return this;
}
// Forward the commit to the state machine to take the appropriate action.
//
public void Commit()
{
TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
if (etwLog.IsEnabled())
{
etwLog.MethodEnter(TraceSourceType.TraceSourceLtm, this);
etwLog.TransactionCommit(this, "CommittableTransaction");
}
if (Disposed)
{
throw new ObjectDisposedException(nameof(CommittableTransaction));
}
lock (_internalTransaction)
{
if (_complete)
{
throw TransactionException.CreateTransactionCompletedException(DistributedTxId);
}
_internalTransaction.State.BeginCommit(_internalTransaction, false, null, null);
// now that commit has started wait for the monitor on the transaction to know
// if the transaction is done.
do
{
if (_internalTransaction.State.IsCompleted(_internalTransaction))
{
break;
}
} while (Monitor.Wait(_internalTransaction));
_internalTransaction.State.EndCommit(_internalTransaction);
}
if (etwLog.IsEnabled())
{
etwLog.MethodExit(TraceSourceType.TraceSourceLtm, this);
}
}
internal override void InternalDispose()
{
TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
if (etwLog.IsEnabled())
{
etwLog.MethodEnter(TraceSourceType.TraceSourceLtm, this);
}
if (Interlocked.Exchange(ref _disposed, Transaction._disposedTrueValue) == Transaction._disposedTrueValue)
{
return;
}
if (_internalTransaction.State.get_Status(_internalTransaction) == TransactionStatus.Active)
{
lock (_internalTransaction)
{
// Since this is the root transaction do state based dispose.
_internalTransaction.State.DisposeRoot(_internalTransaction);
}
}
// Attempt to clean up the internal transaction
long remainingITx = Interlocked.Decrement(ref _internalTransaction._cloneCount);
if (remainingITx == 0)
{
_internalTransaction.Dispose();
}
if (etwLog.IsEnabled())
{
etwLog.MethodExit(TraceSourceType.TraceSourceLtm, this);
}
}
public void EndCommit(IAsyncResult asyncResult)
{
TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
if (etwLog.IsEnabled())
{
etwLog.MethodEnter(TraceSourceType.TraceSourceLtm, this);
}
if (asyncResult != ((object)this))
{
throw new ArgumentException(SR.BadAsyncResult, nameof(asyncResult));
}
lock (_internalTransaction)
{
do
{
if (_internalTransaction.State.IsCompleted(_internalTransaction))
{
break;
}
} while (Monitor.Wait(_internalTransaction));
_internalTransaction.State.EndCommit(_internalTransaction);
}
if (etwLog.IsEnabled())
{
etwLog.MethodExit(TraceSourceType.TraceSourceLtm, this);
}
}
object IAsyncResult.AsyncState => _internalTransaction._asyncState;
bool IAsyncResult.CompletedSynchronously => _completedSynchronously;
WaitHandle IAsyncResult.AsyncWaitHandle
{
get
{
if (_internalTransaction._asyncResultEvent == null)
{
lock (_internalTransaction)
{
if (_internalTransaction._asyncResultEvent == null)
{
// Demand create an event that is already signaled if the transaction has completed.
ManualResetEvent temp = new ManualResetEvent(
_internalTransaction.State.get_Status(_internalTransaction) != TransactionStatus.Active);
_internalTransaction._asyncResultEvent = temp;
}
}
}
return _internalTransaction._asyncResultEvent;
}
}
bool IAsyncResult.IsCompleted
{
get
{
lock (_internalTransaction)
{
return _internalTransaction.State.get_Status(_internalTransaction) != TransactionStatus.Active;
}
}
}
}
}

View File

@@ -0,0 +1,39 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Transactions.Configuration
{
internal static class AppSettings
{
private static volatile bool s_settingsInitalized = false;
private static object s_appSettingsLock = new object();
private static bool s_includeDistributedTxIdInExceptionMessage;
private static void EnsureSettingsLoaded()
{
if (!s_settingsInitalized)
{
lock (s_appSettingsLock)
{
if (!s_settingsInitalized)
{
// TODO: Determine how to handle configuration.
// This uses System.Configuration on desktop to load:
// Transactions:IncludeDistributedTransactionIdInExceptionMessage
s_includeDistributedTxIdInExceptionMessage = false;
}
}
}
}
internal static bool IncludeDistributedTxIdInExceptionMessage
{
get
{
EnsureSettingsLoaded();
return s_includeDistributedTxIdInExceptionMessage;
}
}
}
}

View File

@@ -0,0 +1,13 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Transactions.Configuration
{
internal static class ConfigurationStrings
{
internal const string DefaultDistributedTransactionManagerName = "";
internal const string DefaultMaxTimeout = "00:10:00";
internal const string DefaultTimeout = "00:01:00";
}
}

View File

@@ -0,0 +1,29 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Transactions.Configuration
{
internal sealed class DefaultSettingsSection // ConfigurationSection
{
private static readonly DefaultSettingsSection s_section = new DefaultSettingsSection();
private static TimeSpan s_timeout = TimeSpan.Parse(ConfigurationStrings.DefaultTimeout);
internal static DefaultSettingsSection GetSection() => s_section;
public string DistributedTransactionManagerName { get; set; } = ConfigurationStrings.DefaultDistributedTransactionManagerName;
public TimeSpan Timeout
{
get { return s_timeout; }
set
{
if (value < TimeSpan.Zero || value > TimeSpan.MaxValue)
{
throw new ArgumentOutOfRangeException(nameof(Timeout), SR.ConfigInvalidTimeSpanValue);
}
s_timeout = value;
}
}
}
}

View File

@@ -0,0 +1,27 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Transactions.Configuration
{
internal sealed class MachineSettingsSection // ConfigurationSection
{
private static readonly MachineSettingsSection s_section = new MachineSettingsSection();
private static TimeSpan s_maxTimeout = TimeSpan.Parse(ConfigurationStrings.DefaultMaxTimeout);
internal static MachineSettingsSection GetSection() => s_section;
public TimeSpan MaxTimeout
{
get { return s_maxTimeout; }
set
{
if (value < TimeSpan.Zero || value > TimeSpan.MaxValue)
{
throw new ArgumentOutOfRangeException(nameof(MaxTimeout), SR.ConfigInvalidTimeSpanValue);
}
s_maxTimeout = value;
}
}
}
}

View File

@@ -0,0 +1,72 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Transactions
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2229", Justification = "Serialization not yet supported and will be done using DistributedTransaction")]
[Serializable]
public sealed class DependentTransaction : Transaction
{
private bool _blocking;
// Create a transaction with the given settings
//
internal DependentTransaction(IsolationLevel isoLevel, InternalTransaction internalTransaction, bool blocking) :
base(isoLevel, internalTransaction)
{
_blocking = blocking;
lock (_internalTransaction)
{
if (blocking)
{
_internalTransaction.State.CreateBlockingClone(_internalTransaction);
}
else
{
_internalTransaction.State.CreateAbortingClone(_internalTransaction);
}
}
}
public void Complete()
{
TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
if (etwLog.IsEnabled())
{
etwLog.MethodEnter(TraceSourceType.TraceSourceLtm, this);
}
lock (_internalTransaction)
{
if (Disposed)
{
throw new ObjectDisposedException(nameof(DependentTransaction));
}
if (_complete)
{
throw TransactionException.CreateTransactionCompletedException(DistributedTxId);
}
_complete = true;
if (_blocking)
{
_internalTransaction.State.CompleteBlockingClone(_internalTransaction);
}
else
{
_internalTransaction.State.CompleteAbortingClone(_internalTransaction);
}
}
if (etwLog.IsEnabled())
{
etwLog.TransactionDependentCloneComplete(this, "DependentTransaction");
etwLog.MethodExit(TraceSourceType.TraceSourceLtm, this);
}
}
}
}

View File

@@ -0,0 +1,172 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Runtime.Serialization;
namespace System.Transactions.Distributed
{
internal sealed class DistributedTransactionManager
{
internal object NodeName { get; set; }
internal IPromotedEnlistment ReenlistTransaction(Guid resourceManagerIdentifier, byte[] resourceManagerRecoveryInformation, RecoveringInternalEnlistment internalEnlistment)
{
throw DistributedTransaction.NotSupported();
}
internal DistributedCommittableTransaction CreateTransaction(TransactionOptions options)
{
throw DistributedTransaction.NotSupported();
}
internal void ResourceManagerRecoveryComplete(Guid resourceManagerIdentifier)
{
throw DistributedTransaction.NotSupported();
}
internal byte[] GetWhereabouts()
{
throw DistributedTransaction.NotSupported();
}
internal static Transaction GetTransactionFromDtcTransaction(IDtcTransaction transactionNative)
{
throw DistributedTransaction.NotSupported();
}
internal static DistributedTransaction GetTransactionFromExportCookie(byte[] cookie, Guid txId)
{
throw DistributedTransaction.NotSupported();
}
internal static DistributedTransaction GetDistributedTransactionFromTransmitterPropagationToken(byte[] propagationToken)
{
throw DistributedTransaction.NotSupported();
}
}
/// <summary>
/// A Transaction object represents a single transaction. It is created by TransactionManager
/// objects through CreateTransaction or through deserialization. Alternatively, the static Create
/// methodis provided, which creates a "default" TransactionManager and requests that it create
/// a new transaction with default values. A transaction can only be committed by
/// the client application that created the transaction. If a client application wishes to allow
/// access to the transaction by multiple threads, but wants to prevent those other threads from
/// committing the transaction, the application can make a "clone" of the transaction. Transaction
/// clones have the same capabilities as the original transaction, except for the ability to commit
/// the transaction.
/// </summary>
[Serializable]
internal class DistributedTransaction : ISerializable, IObjectReference
{
internal DistributedTransaction()
{
}
protected DistributedTransaction(SerializationInfo serializationInfo, StreamingContext context)
{
if (serializationInfo == null)
{
throw new ArgumentNullException(nameof(serializationInfo));
}
throw NotSupported();
}
internal Exception InnerException { get; set; }
internal Guid Identifier { get; set; }
internal RealDistributedTransaction RealTransaction { get; set; }
internal TransactionTraceIdentifier TransactionTraceId { get; set; }
internal IsolationLevel IsolationLevel { get; set; }
internal Transaction SavedLtmPromotedTransaction { get; set; }
internal void Dispose()
{
}
internal IPromotedEnlistment EnlistVolatile(InternalEnlistment internalEnlistment, EnlistmentOptions enlistmentOptions)
{
throw NotSupported();
}
internal IPromotedEnlistment EnlistDurable(Guid resourceManagerIdentifier, DurableInternalEnlistment internalEnlistment, bool v, EnlistmentOptions enlistmentOptions)
{
throw NotSupported();
}
internal void Rollback()
{
throw NotSupported();
}
internal DistributedDependentTransaction DependentClone(bool v)
{
throw NotSupported();
}
internal IPromotedEnlistment EnlistVolatile(VolatileDemultiplexer volatileDemux, EnlistmentOptions enlistmentOptions)
{
throw NotSupported();
}
internal byte[] GetExportCookie(byte[] whereaboutsCopy)
{
throw NotSupported();
}
public object GetRealObject(StreamingContext context)
{
throw NotSupported();
}
internal byte[] GetTransmitterPropagationToken()
{
throw NotSupported();
}
internal IDtcTransaction GetDtcTransaction()
{
throw NotSupported();
}
void ISerializable.GetObjectData(SerializationInfo serializationInfo, StreamingContext context)
{
if (serializationInfo == null)
{
throw new ArgumentNullException(nameof(serializationInfo));
}
throw NotSupported();
}
internal static Exception NotSupported()
{
return new PlatformNotSupportedException(SR.DistributedNotSupported);
}
[Serializable]
internal class RealDistributedTransaction
{
internal InternalTransaction InternalTransaction { get; set; }
}
}
[Serializable]
internal class DistributedDependentTransaction : DistributedTransaction
{
internal void Complete()
{
throw NotSupported();
}
}
[Serializable]
internal class DistributedCommittableTransaction : DistributedTransaction
{
internal void BeginCommit(InternalTransaction tx)
{
throw NotSupported();
}
}
}

View File

@@ -0,0 +1,301 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics;
using System.Threading;
namespace System.Transactions
{
// Base class for all durable enlistment states
internal abstract class DurableEnlistmentState : EnlistmentState
{
private static DurableEnlistmentActive s_durableEnlistmentActive;
private static DurableEnlistmentAborting s_durableEnlistmentAborting;
private static DurableEnlistmentCommitting s_durableEnlistmentCommitting;
private static DurableEnlistmentDelegated s_durableEnlistmentDelegated;
private static DurableEnlistmentEnded s_durableEnlistmentEnded;
// Object for synchronizing access to the entire class( avoiding lock( typeof( ... )) )
private static object s_classSyncObject;
internal static DurableEnlistmentActive DurableEnlistmentActive =>
LazyInitializer.EnsureInitialized(ref s_durableEnlistmentActive, ref s_classSyncObject, () => new DurableEnlistmentActive());
protected static DurableEnlistmentAborting DurableEnlistmentAborting =>
LazyInitializer.EnsureInitialized(ref s_durableEnlistmentAborting, ref s_classSyncObject, () => new DurableEnlistmentAborting());
protected static DurableEnlistmentCommitting DurableEnlistmentCommitting =>
LazyInitializer.EnsureInitialized(ref s_durableEnlistmentCommitting, ref s_classSyncObject, () => new DurableEnlistmentCommitting());
protected static DurableEnlistmentDelegated DurableEnlistmentDelegated =>
LazyInitializer.EnsureInitialized(ref s_durableEnlistmentDelegated, ref s_classSyncObject, () => new DurableEnlistmentDelegated());
protected static DurableEnlistmentEnded DurableEnlistmentEnded =>
LazyInitializer.EnsureInitialized(ref s_durableEnlistmentEnded, ref s_classSyncObject, () => new DurableEnlistmentEnded());
}
// Active state for a durable enlistment. In this state the transaction can be aborted
// asynchronously by calling abort.
internal class DurableEnlistmentActive : DurableEnlistmentState
{
internal override void EnterState(InternalEnlistment enlistment)
{
// Set the enlistment state
enlistment.State = this;
// Yeah it's active
}
internal override void EnlistmentDone(InternalEnlistment enlistment)
{
// Mark the enlistment as done.
DurableEnlistmentEnded.EnterState(enlistment);
}
internal override void InternalAborted(InternalEnlistment enlistment)
{
// Transition to the aborting state
DurableEnlistmentAborting.EnterState(enlistment);
}
internal override void ChangeStateCommitting(InternalEnlistment enlistment)
{
// Transition to the committing state
DurableEnlistmentCommitting.EnterState(enlistment);
}
internal override void ChangeStatePromoted(InternalEnlistment enlistment, IPromotedEnlistment promotedEnlistment)
{
// Save the promoted enlistment because future notifications must be sent here.
enlistment.PromotedEnlistment = promotedEnlistment;
// The transaction is being promoted promote the enlistment as well
EnlistmentStatePromoted.EnterState(enlistment);
}
internal override void ChangeStateDelegated(InternalEnlistment enlistment)
{
// This is a valid state transition.
DurableEnlistmentDelegated.EnterState(enlistment);
}
}
// Aborting state for a durable enlistment. In this state the transaction has been aborted,
// by someone other than the enlistment.
//
internal class DurableEnlistmentAborting : DurableEnlistmentState
{
internal override void EnterState(InternalEnlistment enlistment)
{
// Set the enlistment state
enlistment.State = this;
Monitor.Exit(enlistment.Transaction);
try
{
TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
if (etwLog.IsEnabled())
{
etwLog.EnlistmentStatus(enlistment, NotificationCall.Rollback);
}
// Send the Rollback notification to the enlistment
if (enlistment.SinglePhaseNotification != null)
{
enlistment.SinglePhaseNotification.Rollback(enlistment.SinglePhaseEnlistment);
}
else
{
enlistment.PromotableSinglePhaseNotification.Rollback(enlistment.SinglePhaseEnlistment);
}
}
finally
{
Monitor.Enter(enlistment.Transaction);
}
}
internal override void Aborted(InternalEnlistment enlistment, Exception e)
{
if (enlistment.Transaction._innerException == null)
{
enlistment.Transaction._innerException = e;
}
// Transition to the ended state
DurableEnlistmentEnded.EnterState(enlistment);
}
internal override void EnlistmentDone(InternalEnlistment enlistment)
{
// Transition to the ended state
DurableEnlistmentEnded.EnterState(enlistment);
}
}
// Committing state is when SPC has been sent to an enlistment but no response
// has been received.
//
internal class DurableEnlistmentCommitting : DurableEnlistmentState
{
internal override void EnterState(InternalEnlistment enlistment)
{
bool spcCommitted = false;
// Set the enlistment state
enlistment.State = this;
Monitor.Exit(enlistment.Transaction);
try
{
TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
if (etwLog.IsEnabled())
{
etwLog.EnlistmentStatus(enlistment, NotificationCall.SinglePhaseCommit);
}
// Send the Commit notification to the enlistment
if (enlistment.SinglePhaseNotification != null)
{
enlistment.SinglePhaseNotification.SinglePhaseCommit(enlistment.SinglePhaseEnlistment);
}
else
{
enlistment.PromotableSinglePhaseNotification.SinglePhaseCommit(enlistment.SinglePhaseEnlistment);
}
spcCommitted = true;
}
finally
{
if (!spcCommitted)
{
enlistment.SinglePhaseEnlistment.InDoubt();
}
Monitor.Enter(enlistment.Transaction);
}
}
internal override void EnlistmentDone(InternalEnlistment enlistment)
{
// EnlistmentDone should be treated the same as Committed from this state.
// This eliminates a race between the SPC call and the EnlistmentDone call.
// Transition to the ended state
DurableEnlistmentEnded.EnterState(enlistment);
// Make the transaction commit
enlistment.Transaction.State.ChangeStateTransactionCommitted(enlistment.Transaction);
}
internal override void Committed(InternalEnlistment enlistment)
{
// Transition to the ended state
DurableEnlistmentEnded.EnterState(enlistment);
// Make the transaction commit
enlistment.Transaction.State.ChangeStateTransactionCommitted(enlistment.Transaction);
}
internal override void Aborted(InternalEnlistment enlistment, Exception e)
{
// Transition to the ended state
DurableEnlistmentEnded.EnterState(enlistment);
// Start the transaction aborting
enlistment.Transaction.State.ChangeStateTransactionAborted(enlistment.Transaction, e);
}
internal override void InDoubt(InternalEnlistment enlistment, Exception e)
{
// Transition to the ended state
DurableEnlistmentEnded.EnterState(enlistment);
if (enlistment.Transaction._innerException == null)
{
enlistment.Transaction._innerException = e;
}
// Make the transaction in dobut
enlistment.Transaction.State.InDoubtFromEnlistment(enlistment.Transaction);
}
}
// Delegated state for a durable enlistment represents an enlistment that was
// origionally a PromotableSinglePhaseEnlisment that where promotion has happened.
// These enlistments don't need to participate in the commit process anymore.
internal class DurableEnlistmentDelegated : DurableEnlistmentState
{
internal override void EnterState(InternalEnlistment enlistment)
{
// Set the enlistment state
enlistment.State = this;
// At this point the durable enlistment should have someone to forward to.
Debug.Assert(enlistment.PromotableSinglePhaseNotification != null);
}
internal override void Committed(InternalEnlistment enlistment)
{
// Transition to the ended state
DurableEnlistmentEnded.EnterState(enlistment);
// Change the transaction to committed.
enlistment.Transaction.State.ChangeStatePromotedCommitted(enlistment.Transaction);
}
internal override void Aborted(InternalEnlistment enlistment, Exception e)
{
// Transition to the ended state
DurableEnlistmentEnded.EnterState(enlistment);
if (enlistment.Transaction._innerException == null)
{
enlistment.Transaction._innerException = e;
}
// Start the transaction aborting
enlistment.Transaction.State.ChangeStatePromotedAborted(enlistment.Transaction);
}
internal override void InDoubt(InternalEnlistment enlistment, Exception e)
{
// Transition to the ended state
DurableEnlistmentEnded.EnterState(enlistment);
if (enlistment.Transaction._innerException == null)
{
enlistment.Transaction._innerException = e;
}
// Tell the transaction that the enlistment is InDoubt. Note that
// for a transaction that has been delegated and then promoted there
// are two chances to get a better answer than indoubt. So it may be that
// the TM will have a better answer.
enlistment.Transaction.State.InDoubtFromEnlistment(enlistment.Transaction);
}
}
// Ended state is the state that is entered when the durable enlistment has committed,
// aborted, or said read only for an enlistment. At this point there are no valid
// operations on the enlistment.
internal class DurableEnlistmentEnded : DurableEnlistmentState
{
internal override void EnterState(InternalEnlistment enlistment)
{
// Set the enlistment state
enlistment.State = this;
}
internal override void InternalAborted(InternalEnlistment enlistment)
{
// From the Aborting state the transaction may tell the enlistment to abort. At this point
// it already knows. Eat this message.
}
internal override void InDoubt(InternalEnlistment enlistment, Exception e)
{
// Ignore this in case the enlistment gets here before
// the transaction tells it to do so
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,205 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics;
using System.Threading;
namespace System.Transactions
{
// Base class for all enlistment states
internal abstract class EnlistmentState
{
internal abstract void EnterState(InternalEnlistment enlistment);
internal static EnlistmentStatePromoted _enlistmentStatePromoted;
// Object for synchronizing access to the entire class( avoiding lock( typeof( ... )) )
private static object s_classSyncObject;
internal static EnlistmentStatePromoted EnlistmentStatePromoted =>
LazyInitializer.EnsureInitialized(ref _enlistmentStatePromoted, ref s_classSyncObject, () => new EnlistmentStatePromoted());
internal virtual void EnlistmentDone(InternalEnlistment enlistment)
{
throw TransactionException.CreateEnlistmentStateException(null, enlistment == null ? Guid.Empty : enlistment.DistributedTxId);
}
internal virtual void Prepared(InternalEnlistment enlistment)
{
throw TransactionException.CreateEnlistmentStateException(null, enlistment == null ? Guid.Empty : enlistment.DistributedTxId);
}
internal virtual void ForceRollback(InternalEnlistment enlistment, Exception e)
{
throw TransactionException.CreateEnlistmentStateException(null, enlistment == null ? Guid.Empty : enlistment.DistributedTxId);
}
internal virtual void Committed(InternalEnlistment enlistment)
{
throw TransactionException.CreateEnlistmentStateException(null, enlistment == null ? Guid.Empty : enlistment.DistributedTxId);
}
internal virtual void Aborted(InternalEnlistment enlistment, Exception e)
{
throw TransactionException.CreateEnlistmentStateException(null, enlistment == null ? Guid.Empty : enlistment.DistributedTxId);
}
internal virtual void InDoubt(InternalEnlistment enlistment, Exception e)
{
throw TransactionException.CreateEnlistmentStateException(null, enlistment == null ? Guid.Empty : enlistment.DistributedTxId);
}
internal virtual byte[] RecoveryInformation(InternalEnlistment enlistment)
{
throw TransactionException.CreateEnlistmentStateException(null, enlistment == null ? Guid.Empty : enlistment.DistributedTxId);
}
internal virtual void InternalAborted(InternalEnlistment enlistment)
{
Debug.Assert(false, string.Format(null, "Invalid Event for InternalEnlistment State; Current State: {0}", GetType()));
throw TransactionException.CreateEnlistmentStateException(null, enlistment == null ? Guid.Empty : enlistment.DistributedTxId);
}
internal virtual void InternalCommitted(InternalEnlistment enlistment)
{
Debug.Assert(false, string.Format(null, "Invalid Event for InternalEnlistment State; Current State: {0}", GetType()));
throw TransactionException.CreateEnlistmentStateException(null, enlistment == null ? Guid.Empty : enlistment.DistributedTxId);
}
internal virtual void InternalIndoubt(InternalEnlistment enlistment)
{
Debug.Assert(false, string.Format(null, "Invalid Event for InternalEnlistment State; Current State: {0}", GetType()));
throw TransactionException.CreateEnlistmentStateException(null, enlistment == null ? Guid.Empty : enlistment.DistributedTxId);
}
internal virtual void ChangeStateCommitting(InternalEnlistment enlistment)
{
Debug.Assert(false, string.Format(null, "Invalid Event for InternalEnlistment State; Current State: {0}", GetType()));
throw TransactionException.CreateEnlistmentStateException(null, enlistment == null ? Guid.Empty : enlistment.DistributedTxId);
}
internal virtual void ChangeStatePromoted(InternalEnlistment enlistment, IPromotedEnlistment promotedEnlistment)
{
Debug.Assert(false, string.Format(null, "Invalid Event for InternalEnlistment State; Current State: {0}", GetType()));
throw TransactionException.CreateEnlistmentStateException(null, enlistment == null ? Guid.Empty : enlistment.DistributedTxId);
}
internal virtual void ChangeStateDelegated(InternalEnlistment enlistment)
{
Debug.Assert(false, string.Format(null, "Invalid Event for InternalEnlistment State; Current State: {0}", GetType()));
throw TransactionException.CreateEnlistmentStateException(null, enlistment == null ? Guid.Empty : enlistment.DistributedTxId);
}
internal virtual void ChangeStatePreparing(InternalEnlistment enlistment)
{
Debug.Assert(false, string.Format(null, "Invalid Event for InternalEnlistment State; Current State: {0}", GetType()));
throw TransactionException.CreateEnlistmentStateException(null, enlistment == null ? Guid.Empty : enlistment.DistributedTxId);
}
internal virtual void ChangeStateSinglePhaseCommit(InternalEnlistment enlistment)
{
Debug.Assert(false, string.Format(null, "Invalid Event for InternalEnlistment State; Current State: {0}", GetType()));
throw TransactionException.CreateEnlistmentStateException(null, enlistment == null ? Guid.Empty : enlistment.DistributedTxId);
}
}
internal class EnlistmentStatePromoted : EnlistmentState
{
internal override void EnterState(InternalEnlistment enlistment)
{
enlistment.State = this;
}
internal override void EnlistmentDone(InternalEnlistment enlistment)
{
Monitor.Exit(enlistment.SyncRoot);
try
{
enlistment.PromotedEnlistment.EnlistmentDone();
}
finally
{
Monitor.Enter(enlistment.SyncRoot);
}
}
internal override void Prepared(InternalEnlistment enlistment)
{
Monitor.Exit(enlistment.SyncRoot);
try
{
enlistment.PromotedEnlistment.Prepared();
}
finally
{
Monitor.Enter(enlistment.SyncRoot);
}
}
internal override void ForceRollback(InternalEnlistment enlistment, Exception e)
{
Monitor.Exit(enlistment.SyncRoot);
try
{
enlistment.PromotedEnlistment.ForceRollback(e);
}
finally
{
Monitor.Enter(enlistment.SyncRoot);
}
}
internal override void Committed(InternalEnlistment enlistment)
{
Monitor.Exit(enlistment.SyncRoot);
try
{
enlistment.PromotedEnlistment.Committed();
}
finally
{
Monitor.Enter(enlistment.SyncRoot);
}
}
internal override void Aborted(InternalEnlistment enlistment, Exception e)
{
Monitor.Exit(enlistment.SyncRoot);
try
{
enlistment.PromotedEnlistment.Aborted(e);
}
finally
{
Monitor.Enter(enlistment.SyncRoot);
}
}
internal override void InDoubt(InternalEnlistment enlistment, Exception e)
{
Monitor.Exit(enlistment.SyncRoot);
try
{
enlistment.PromotedEnlistment.InDoubt(e);
}
finally
{
Monitor.Enter(enlistment.SyncRoot);
}
}
internal override byte[] RecoveryInformation(InternalEnlistment enlistment)
{
Monitor.Exit(enlistment.SyncRoot);
try
{
return enlistment.PromotedEnlistment.GetRecoveryInformation();
}
finally
{
Monitor.Enter(enlistment.SyncRoot);
}
}
}
}

View File

@@ -0,0 +1,61 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Transactions
{
/// <summary>
/// This identifier is used in tracing to distiguish transaction
/// enlistments. This identifier is only unique within
/// a given AppDomain.
/// </summary>
internal struct EnlistmentTraceIdentifier : IEquatable<EnlistmentTraceIdentifier>
{
public static readonly EnlistmentTraceIdentifier Empty = new EnlistmentTraceIdentifier();
public EnlistmentTraceIdentifier(
Guid resourceManagerIdentifier,
TransactionTraceIdentifier transactionTraceId,
int enlistmentIdentifier)
{
_resourceManagerIdentifier = resourceManagerIdentifier;
_transactionTraceIdentifier = transactionTraceId;
_enlistmentIdentifier = enlistmentIdentifier;
}
private readonly Guid _resourceManagerIdentifier;
/// <summary>
/// The Guid identifier of the resource manager that made the
/// enlistment. If the enlistment is a Volatile enlistment,
/// this value will be Guid.Empty.
/// </summary>
public Guid ResourceManagerIdentifier => _resourceManagerIdentifier;
private readonly TransactionTraceIdentifier _transactionTraceIdentifier;
/// <summary>
/// The TransactionTraceIdentifier for the transaction that is
/// enlisted upon.
/// </summary>
public TransactionTraceIdentifier TransactionTraceId => _transactionTraceIdentifier;
private readonly int _enlistmentIdentifier;
/// <summary>
/// A value that distiguishes between multiple enlistments on the same
/// transaction instance by the same resource manager.
/// </summary>
public int EnlistmentIdentifier => _enlistmentIdentifier;
public override int GetHashCode() => base.GetHashCode(); // Don't have anything better to do.
public override bool Equals(object obj) => obj is EnlistmentTraceIdentifier && Equals((EnlistmentTraceIdentifier)obj);
public bool Equals(EnlistmentTraceIdentifier other) =>
_enlistmentIdentifier == other._enlistmentIdentifier &&
_resourceManagerIdentifier == other._resourceManagerIdentifier &&
_transactionTraceIdentifier == other._transactionTraceIdentifier;
public static bool operator ==(EnlistmentTraceIdentifier left, EnlistmentTraceIdentifier right) => left.Equals(right);
public static bool operator !=(EnlistmentTraceIdentifier left, EnlistmentTraceIdentifier right) => !left.Equals(right);
}
}

View File

@@ -0,0 +1,48 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Transactions
{
internal static class EnterpriseServices
{
internal static bool EnterpriseServicesOk => false;
internal static void VerifyEnterpriseServicesOk()
{
if (!EnterpriseServicesOk)
{
ThrowNotSupported();
}
}
internal static Transaction GetContextTransaction(ContextData contextData)
{
if (EnterpriseServicesOk)
{
ThrowNotSupported();
}
return null;
}
internal static bool CreatedServiceDomain { get; set; } = false;
internal static bool UseServiceDomainForCurrent() => false;
internal static void PushServiceDomain(Transaction newCurrent)
{
ThrowNotSupported();
}
internal static void LeaveServiceDomain()
{
ThrowNotSupported();
}
private static void ThrowNotSupported()
{
throw new PlatformNotSupportedException(SR.EsNotSupported);
}
}
}

Some files were not shown because too many files have changed in this diff Show More