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
|
||||
|
@@ -1 +1 @@
|
||||
7994e5dac7692b46aba8982a568232486c9ab689
|
||||
320d4a5e541cb9f48bd256bfb8f3f98ddbcbc1d6
|
@@ -49,13 +49,13 @@ namespace System
|
||||
#endif
|
||||
|
||||
#region Switch APIs
|
||||
#if !MONO
|
||||
|
||||
static AppContext()
|
||||
{
|
||||
// populate the AppContext with the default set of values
|
||||
AppContextDefaultValues.PopulateDefaultValues();
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Try to get the value of the switch.
|
||||
/// </summary>
|
||||
@@ -102,7 +102,6 @@ namespace System
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#if !MONO
|
||||
// 3. The switch has a valid value, but we need to check for overrides.
|
||||
// Regardless of whether or not the switch has an override, we need to update the value to reflect
|
||||
// the fact that we checked for overrides.
|
||||
@@ -112,7 +111,6 @@ namespace System
|
||||
// we found an override!
|
||||
isEnabled = overrideValue;
|
||||
}
|
||||
#endif
|
||||
// Update the switch in the dictionary to mark it as 'checked for override'
|
||||
s_switchMap[switchName] = (isEnabled ? SwitchValueState.HasTrueValue : SwitchValueState.HasFalseValue)
|
||||
| SwitchValueState.HasLookedForOverride;
|
||||
@@ -132,7 +130,6 @@ namespace System
|
||||
// In this case, we want to capture the fact that we looked for a value and found nothing by adding
|
||||
// an entry in the dictionary with the 'sentinel' value of 'SwitchValueState.UnknownValue'.
|
||||
// Example: This will prevent us from trying to find overrides for values that we don't have in the dictionary
|
||||
#if !MONO
|
||||
// 1. The value has an override specified.
|
||||
bool overrideValue;
|
||||
if (AppContextDefaultValues.TryGetSwitchOverride(switchName, out overrideValue))
|
||||
@@ -145,7 +142,6 @@ namespace System
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
// 2. The value does not have an override.
|
||||
s_switchMap[switchName] = SwitchValueState.UnknownValue;
|
||||
}
|
||||
|
@@ -11,6 +11,11 @@ namespace System
|
||||
|
||||
internal static class AppContextSwitches
|
||||
{
|
||||
#if MOBILE
|
||||
public static readonly bool ThrowExceptionIfDisposedCancellationTokenSource = false;
|
||||
public static readonly bool SetActorAsReferenceWhenCopyingClaimsIdentity = false;
|
||||
public static readonly bool NoAsyncCurrentCulture = false;
|
||||
#else
|
||||
private static int _noAsyncCurrentCulture;
|
||||
public static bool NoAsyncCurrentCulture
|
||||
{
|
||||
@@ -120,5 +125,6 @@ namespace System
|
||||
switchValue = isSwitchEnabled ? 1 /*true*/ : -1 /*false*/;
|
||||
return isSwitchEnabled;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@@ -147,6 +147,8 @@ namespace Mono.CilStripper {
|
||||
for (int i = 0; i < methodTable.Rows.Count; i++) {
|
||||
MethodRow methodRow = methodTable[i];
|
||||
|
||||
methodRow.ImplFlags |= MethodImplAttributes.NoInlining;
|
||||
|
||||
MetadataToken methodToken = MetadataToken.FromMetadataRow (TokenType.Method, i);
|
||||
|
||||
MethodDefinition method = (MethodDefinition) assembly.MainModule.LookupByToken (methodToken);
|
||||
|
Reference in New Issue
Block a user