@@ -4,20 +4,81 @@ $ExtraDefines$
44// this file must not be importing any namespaces
55// we should use full names everywhere to avoid any potential naming conflicts, example: #1007, #778
66
7+ #pragma warning disable CS0436 // Type conflicts with imported type
78#if !NET7_0_OR_GREATER
89namespace System.Diagnostics.CodeAnalysis
910{
10- /// <summary>
11- /// Specifies that this constructor sets all required members for the current type,
12- /// and callers do not need to set any required members themselves.
13- /// </summary>
1411 [global::System.AttributeUsage(global::System.AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
1512 [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
1613 internal sealed class SetsRequiredMembersAttribute : global::System.Attribute
1714 {
1815 }
1916}
2017#endif
18+ #if !NET5_0_OR_GREATER
19+ namespace System.Diagnostics.CodeAnalysis
20+ {
21+ [global::System.Flags]
22+ internal enum DynamicallyAccessedMemberTypes
23+ {
24+ None = 0,
25+ PublicParameterlessConstructor = 0x0001,
26+ PublicConstructors = 0x0002 | global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor,
27+ NonPublicConstructors = 0x0004,
28+ PublicMethods = 0x0008,
29+ NonPublicMethods = 0x0010,
30+ PublicFields = 0x0020,
31+ NonPublicFields = 0x0040,
32+ PublicNestedTypes = 0x0080,
33+ NonPublicNestedTypes = 0x0100,
34+ PublicProperties = 0x0200,
35+ NonPublicProperties = 0x0400,
36+ PublicEvents = 0x0800,
37+ NonPublicEvents = 0x1000,
38+ Interfaces = 0x2000,
39+ All = ~global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None
40+ }
41+ [global::System.AttributeUsage(global::System.AttributeTargets.Constructor | global::System.AttributeTargets.Field | global::System.AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
42+ [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
43+ [global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")]
44+ internal sealed class DynamicDependencyAttribute : global::System.Attribute
45+ {
46+ public DynamicDependencyAttribute(string memberSignature)
47+ {
48+ MemberSignature = memberSignature;
49+ }
50+ public DynamicDependencyAttribute(string memberSignature, global::System.Type type)
51+ {
52+ MemberSignature = memberSignature;
53+ Type = type;
54+ }
55+ public DynamicDependencyAttribute(string memberSignature, string typeName, string assemblyName)
56+ {
57+ MemberSignature = memberSignature;
58+ TypeName = typeName;
59+ AssemblyName = assemblyName;
60+ }
61+ public DynamicDependencyAttribute(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes memberTypes, global::System.Type type)
62+ {
63+ MemberTypes = memberTypes;
64+ Type = type;
65+ }
66+ public DynamicDependencyAttribute(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes memberTypes, string typeName, string assemblyName)
67+ {
68+ MemberTypes = memberTypes;
69+ TypeName = typeName;
70+ AssemblyName = assemblyName;
71+ }
72+ public string MemberSignature { get; }
73+ public global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberTypes { get; }
74+ public global::System.Type Type { get; }
75+ public string TypeName { get; }
76+ public string AssemblyName { get; }
77+ public string Condition { get; set; }
78+ }
79+ }
80+ #endif
81+ #pragma warning restore CS0436 // Type conflicts with imported type
2182
2283// the namespace name must be in sync with WindowsDisassembler.BuildArguments
2384namespace BenchmarkDotNet.Autogenerated
@@ -38,7 +99,7 @@ namespace BenchmarkDotNet.Autogenerated
3899
39100 private static global::System.Int32 AfterAssemblyLoadingAttached(global::System.String[] args)
40101 {
41- global::BenchmarkDotNet.Engines.IHost host; // this variable name is used by CodeGenerator.GetCoreRtSwitch, do NOT change it
102+ global::BenchmarkDotNet.Engines.IHost host;
42103 if (global::BenchmarkDotNet.Engines.AnonymousPipesHost.TryGetFileHandles(args, out global::System.String writeHandle, out global::System.String readHandle))
43104 host = new global::BenchmarkDotNet.Engines.AnonymousPipesHost(writeHandle, readHandle);
44105 else
@@ -54,23 +115,18 @@ namespace BenchmarkDotNet.Autogenerated
54115 // which could cause the jitting/assembly loading to happen before we do anything
55116 // we have some jitting diagnosers and we want them to catch all the informations!!
56117
57- // this variable name is used by CodeGenerator.GetCoreRtSwitch, do NOT change it
58118 global::System.String benchmarkName = global::System.Linq.Enumerable.FirstOrDefault(global::System.Linq.Enumerable.Skip(global::System.Linq.Enumerable.SkipWhile(args, arg => arg != "--benchmarkName"), 1)) ?? "not provided";
59119 global::BenchmarkDotNet.Diagnosers.RunMode diagnoserRunMode = (global::BenchmarkDotNet.Diagnosers.RunMode) global::System.Int32.Parse(global::System.Linq.Enumerable.FirstOrDefault(global::System.Linq.Enumerable.Skip(global::System.Linq.Enumerable.SkipWhile(args, arg => arg != "--diagnoserRunMode"), 1)) ?? "0");
60120 global::System.Int32 id = args.Length > 0
61- ? global::System.Int32.Parse(args[args.Length - 1]) // this variable name is used by CodeGenerator.GetCoreRtSwitch, do NOT change it
121+ ? global::System.Int32.Parse(args[args.Length - 1])
62122 : 0; // used when re-using generated exe without BDN (typically to repro a bug)
63123
64124 if (args.Length == 0)
65125 {
66126 host.WriteLine("You have not specified benchmark id (an integer) so the first benchmark will be executed.");
67127 }
68- #if NATIVEAOT
69- $NativeAotSwitch$
70- #else
71128 global::System.Type type = typeof(global::BenchmarkDotNet.Autogenerated.UniqueProgramName).Assembly.GetType($"BenchmarkDotNet.Autogenerated.Runnable_{id}");
72129 type.GetMethod("Run", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.Static).Invoke(null, new global::System.Object[] { host, benchmarkName, diagnoserRunMode });
73- #endif
74130 return 0;
75131 }
76132 catch (global::System.Exception oom) when (oom is global::System.OutOfMemoryException || oom is global::System.Reflection.TargetInvocationException reflection && reflection.InnerException is global::System.OutOfMemoryException)
0 commit comments