You've already forked linux-packaging-mono
Imported Upstream version 5.0.0.94
Former-commit-id: 09772966aff74491c7b98b6eda49852cfc4aa874
This commit is contained in:
parent
5c980d35e6
commit
67a5eefa39
28
mcs/class/corlib/ReferenceSources/AppContextDefaultValues.cs
Normal file
28
mcs/class/corlib/ReferenceSources/AppContextDefaultValues.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
|
||||
namespace System
|
||||
{
|
||||
internal static class AppContextDefaultValues
|
||||
{
|
||||
internal const string SwitchNoAsyncCurrentCulture = "Switch.System.Globalization.NoAsyncCurrentCulture";
|
||||
internal const string SwitchThrowExceptionIfDisposedCancellationTokenSource = "Switch.System.Threading.ThrowExceptionIfDisposedCancellationTokenSource";
|
||||
internal const string SwitchPreserveEventListnerObjectIdentity = "Switch.System.Diagnostics.EventSource.PreserveEventListnerObjectIdentity";
|
||||
internal const string SwitchUseLegacyPathHandling = "Switch.System.IO.UseLegacyPathHandling";
|
||||
internal const string SwitchBlockLongPaths = "Switch.System.IO.BlockLongPaths";
|
||||
internal const string SwitchDoNotAddrOfCspParentWindowHandle = "Switch.System.Security.Cryptography.DoNotAddrOfCspParentWindowHandle";
|
||||
internal const string SwitchSetActorAsReferenceWhenCopyingClaimsIdentity = "Switch.System.Security.ClaimsIdentity.SetActorAsReferenceWhenCopyingClaimsIdentity";
|
||||
|
||||
public static void PopulateDefaultValues () {
|
||||
}
|
||||
|
||||
//TODO Use the values in app.config
|
||||
public static bool TryGetSwitchOverride (string switchName, out bool overrideValue)
|
||||
{
|
||||
// The default value for a switch is 'false'
|
||||
overrideValue = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +0,0 @@
|
||||
namespace System {
|
||||
static class AppContextSwitches {
|
||||
public static readonly bool ThrowExceptionIfDisposedCancellationTokenSource = true;
|
||||
public static readonly bool SetActorAsReferenceWhenCopyingClaimsIdentity = false;
|
||||
public static readonly bool NoAsyncCurrentCulture = false;
|
||||
}
|
||||
}
|
@@ -790,6 +790,61 @@ namespace MonoTests.System.Reflection.Emit
|
||||
Assert.IsInstanceOfType (typeof (PublicVisibleCustomAttribute), attrs[1]);
|
||||
Assert.IsInstanceOfType (typeof (PublicVisibleCustomAttribute), attrs[2]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CustomAttributeSameAssembly () {
|
||||
// Regression test for 55681
|
||||
//
|
||||
// We build:
|
||||
// class MyAttr : Attr { public MyAttr () { } }
|
||||
// [assembly:MyAttr()]
|
||||
//
|
||||
// the important bit is that we pass the ConstructorBuilder to the CustomAttributeBuilder
|
||||
var assemblyName = new AssemblyName ("Repro55681");
|
||||
var assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly (assemblyName, AssemblyBuilderAccess.Save, tempDir);
|
||||
var moduleBuilder = assemblyBuilder.DefineDynamicModule ("Repro55681", "Repro55681.dll");
|
||||
var typeBuilder = moduleBuilder.DefineType ("MyAttr", TypeAttributes.Public, typeof (Attribute));
|
||||
ConstructorBuilder ctor = typeBuilder.DefineDefaultConstructor (MethodAttributes.Public);
|
||||
typeBuilder.CreateType ();
|
||||
|
||||
assemblyBuilder.SetCustomAttribute (new CustomAttributeBuilder (ctor, new object [] { }));
|
||||
|
||||
assemblyBuilder.Save ("Repro55681.dll");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CustomAttributeAcrossAssemblies () {
|
||||
// Regression test for 55681
|
||||
//
|
||||
// We build:
|
||||
// assembly1:
|
||||
// class MyAttr : Attr { public MyAttr () { } }
|
||||
// assembly2:
|
||||
// class Dummy { }
|
||||
// [assembly:MyAttr()]
|
||||
//
|
||||
// the important bit is that we pass the ConstructorBuilder to the CustomAttributeBuilder
|
||||
var assemblyName1 = new AssemblyName ("Repro55681-2a");
|
||||
var assemblyBuilder1 = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName1, AssemblyBuilderAccess.Save, tempDir);
|
||||
var moduleBuilder1 = assemblyBuilder1.DefineDynamicModule ("Repro55681-2a", "Repro55681-2a.dll");
|
||||
var typeBuilder1 = moduleBuilder1.DefineType ("MyAttr", TypeAttributes.Public, typeof (Attribute));
|
||||
ConstructorBuilder ctor = typeBuilder1.DefineDefaultConstructor (MethodAttributes.Public);
|
||||
typeBuilder1.CreateType ();
|
||||
|
||||
var assemblyName2 = new AssemblyName ("Repro55681-2b");
|
||||
var assemblyBuilder2 = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName2, AssemblyBuilderAccess.Save, tempDir);
|
||||
var moduleBuilder2 = assemblyBuilder2.DefineDynamicModule ("Repro55681-2b", "Repro55681-2b.dll");
|
||||
|
||||
var typeBuilder2 = moduleBuilder2.DefineType ("Dummy", TypeAttributes.Public);
|
||||
typeBuilder2.DefineDefaultConstructor (MethodAttributes.Public);
|
||||
typeBuilder2.CreateType ();
|
||||
|
||||
assemblyBuilder2.SetCustomAttribute (new CustomAttributeBuilder (ctor, new object [] { }));
|
||||
|
||||
assemblyBuilder2.Save ("Repro55681-2b.dll");
|
||||
assemblyBuilder1.Save ("Repro55681-2a.dll");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -325,10 +325,14 @@ namespace MonoTests.System.Threading
|
||||
} catch (ObjectDisposedException) {
|
||||
}
|
||||
|
||||
try {
|
||||
token.Register (() => { });
|
||||
Assert.Fail ("#3");
|
||||
} catch (ObjectDisposedException) {
|
||||
bool throwOnDispose = false;
|
||||
AppContext.TryGetSwitch ("Switch.System.Threading.ThrowExceptionIfDisposedCancellationTokenSource", out throwOnDispose);
|
||||
if (throwOnDispose) {
|
||||
try {
|
||||
token.Register (() => { });
|
||||
Assert.Fail ("#3");
|
||||
} catch (ObjectDisposedException) {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -337,10 +341,12 @@ namespace MonoTests.System.Threading
|
||||
} catch (ObjectDisposedException) {
|
||||
}
|
||||
|
||||
try {
|
||||
CancellationTokenSource.CreateLinkedTokenSource (token);
|
||||
Assert.Fail ("#5");
|
||||
} catch (ObjectDisposedException) {
|
||||
if (throwOnDispose) {
|
||||
try {
|
||||
CancellationTokenSource.CreateLinkedTokenSource (token);
|
||||
Assert.Fail ("#5");
|
||||
} catch (ObjectDisposedException) {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
@@ -870,7 +870,6 @@ System.Threading.Tasks/DecoupledTask.cs
|
||||
../Mono.Parallel/Mono.Threading/AtomicBoolean.cs
|
||||
|
||||
ReferenceSources/__ConsoleStream.cs
|
||||
ReferenceSources/AppContextSwitches.cs
|
||||
ReferenceSources/Array.cs
|
||||
ReferenceSources/BCLDebug.cs
|
||||
ReferenceSources/CalendarData.cs
|
||||
@@ -1053,6 +1052,8 @@ ReferenceSources/Type.cs
|
||||
../referencesource/mscorlib/system/version.cs
|
||||
|
||||
../referencesource/mscorlib/system/AppContext/AppContext.cs
|
||||
../referencesource/mscorlib/system/AppContext/AppContextSwitches.cs
|
||||
ReferenceSources/AppContextDefaultValues.cs
|
||||
|
||||
../referencesource/mscorlib/system/collections/arraylist.cs
|
||||
../referencesource/mscorlib/system/collections/bitarray.cs
|
||||
|
Reference in New Issue
Block a user