blob: 4a14e5733c4698247ced66e53ba3c0ddc182cade (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
// 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.
//
/*============================================================
**
**
**
** Purpose: Defines a publically documentable contract for
** reliability between a method and its callers, expressing
** what state will remain consistent in the presence of
** failures (ie async exceptions like thread abort) and whether
** the method needs to be called from within a CER.
**
**
===========================================================*/
namespace System.Runtime.ConstrainedExecution {
using System.Runtime.InteropServices;
using System;
// **************************************************************************************************************************
//
// Note that if you change either of the enums below or the constructors, fields or properties of the custom attribute itself
// you must also change the logic and definitions in vm\ConstrainedExecutionRegion.cpp to match.
//
// **************************************************************************************************************************
[Serializable]
public enum Consistency : int
{
MayCorruptProcess = 0,
MayCorruptAppDomain = 1,
MayCorruptInstance = 2,
WillNotCorruptState = 3,
}
[Serializable]
public enum Cer : int
{
None = 0,
MayFail = 1, // Might fail, but the method will say it failed
Success = 2,
}
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Interface /* | AttributeTargets.Delegate*/, Inherited = false)]
public sealed class ReliabilityContractAttribute : Attribute
{
private Consistency _consistency;
private Cer _cer;
public ReliabilityContractAttribute(Consistency consistencyGuarantee, Cer cer)
{
_consistency = consistencyGuarantee;
_cer = cer;
}
public Consistency ConsistencyGuarantee {
get { return _consistency; }
}
public Cer Cer {
get { return _cer; }
}
}
}
|