+++ /dev/null
-<Project Sdk="Microsoft.NET.Sdk">
- <PropertyGroup>
- <OutputType>Library</OutputType>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <CLRTestKind>SharedLibrary</CLRTestKind>
- <CLRTestPriority>1</CLRTestPriority>
- </PropertyGroup>
- <ItemGroup>
- <Compile Include="nullabletypes.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="$(TestSourceDir)Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
- </ItemGroup>
-</Project>
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-#pragma warning disable 414
-
-using System;
-using System.Globalization;
-
-//Define all the standard delegates to be used
-public delegate int iDi(int i, out string m);
-public delegate int iDNi(int? i, out string m);
-public delegate int iDI(I i, out string m);
-public delegate int iDS(S s, out string m);
-public delegate int iDNS(S? s, out string m);
-public delegate int IDo(object o, out string m);
-public delegate S SDi(int i, out string m);
-public delegate S? NSDi(int i, out string m);
-public delegate I IDi(int i, out string m);
-public delegate int iDo(object o, out string m);
-public delegate object oDi(int i, out string m);
-
-//Define all the open instance delegates to be used
-public delegate int iDi<T>(T t,int i, out string m);
-public delegate int iDNi<T>(T t,int? i, out string m);
-public delegate int iDI<T>(T t,I i, out string m);
-public delegate int iDS<T>(T t,S s, out string m);
-public delegate int iDNS<T>(T t,S? s, out string m);
-public delegate int iDo<T>(T t,object o, out string m);
-public delegate S SDi<T>(T t, int i, out string m);
-public delegate S? NSDi<T>(T t, int i, out string m);
-public delegate I IDi<T>(T t, int i, out string m);
-public delegate int IDo<T>(T t,object o, out string m);
-public delegate object oDi<T>(T t, int i, out string m);
-
-//Define all the closed static delegates to be used
-public delegate T tD<T>(out string m);
-public delegate T tDi<T>(int i, out string m);
-
-//@TODO - Are G<Foo> and G<Foo?> equivalent? Can you even specify a G<Foo?>??
-//@TODO - Can you close over an out or ref parameter???
-//@TODO - another case, ex. close this method static M(int? i) over a null argument
-//@TODO - A delegate declared as D(S?) used as an open instance to bind to a method on S????? Probably just doesn't work as the type isn't really an S, might work to bind to methods on the Nullable<T> type, but that would be expected. Should check it to be sure.
-
-//Define the custom types to be used
-public interface I{
- bool Equals(int i);
-}
-
-public struct S : I{
- //Dummy fields to extend this value type and stress
- //the stub. We really don't care that they're not used.
- private double f1,f2,f3,f4,f5,f6,f7,f8,f9,f10;
-
- //An assignable field to be checked for correctness
- public int value;
-
- public S(int i){
- f1=0;f2=0;f3=0;f4=0;f5=0;f6=0;f7=0;f8=0;f9=0;f10=0;//@BUGBUG - It puzzles me to no end why there is a compiler error if I don't initialize these in the constructor
- value = i;
- }
-
- public bool Equals(int i){
- return (value==i);
- }
-
- //For later cleanliness
- public static bool operator ==(S s, int i){
- return s.Equals(i);
- }
-
- public static bool operator !=(S s, int i){
- return !s.Equals(i);
- }
-
- public override bool Equals(object o){
- throw new Exception("this just exists to stop a compiler warning, don't call it");
- }
- public override int GetHashCode(){
- throw new Exception("this just exists to stop a compiler warning, don't call it");
- }
-}
-
-//Define the various delegate target methods
-
-public class RefInst{ //Instance methods on a reference class
- //The out parameters are a crude tag to verify which method
- //was actually called. Necessary because the other functionality
- //of the methods is pretty much identical
-
-#region Overloads for BindToMethodName ambiguity testing
- //These should appear in order from most general to most
- //specific or (@TODO) we should have additional tests that
- //vary the method order. This is to confirm that any
- //ambiguous matching logic in BindToMethodName isn't just
- //settling for the first "match" it sees. There should
- //be no ambiguity at all in matching.
-
- public int M(int? i, out string m){
- m = "one";
- if(i==null)
- throw new ArgumentNullException();
- else
- return (int)i;
- }
-
- public int M(S? s, out string m){
- m = "two";
- if(s==null)
- throw new ArgumentException();
- else
- return ((S)s).value;
- }
-
- public int M(I i, out string m){
- m = "three";
- if(i==null)
- throw new ArgumentNullException();
- if(!(i is S))
- throw new ArgumentException();
- return ((S)i).value;
- }
-
- public int M(object o, out string m){
- m = "four";
- if(o == null)
- throw new ArgumentNullException();
- if(!(o is S))
- throw new ArgumentException();
- return ((S)o).value;
- }
-
- public int M(S s, out string m){
- m = "five";
- return s.value;
- }
-
- public int M(int i, out string m){
- m = "six";
- return i;
- }
-#endregion
-
-#region Non-overloaded methods to allow for (easier) explicit method selection
- public int iMNi(int? i, out string m){
- m = "iMNi";
- if(i==null)
- throw new ArgumentNullException();
- else
- return (int)i;
- }
-
- public int iMNS(S? s, out string m){
- m = "iMNS";
- if(s==null)
- throw new ArgumentException();
- else
- return ((S)s).value;
- }
-
- public int iMI(I i, out string m){
- m = "iMI";
- if(i==null)
- throw new ArgumentNullException();
- if(!(i is S))
- throw new ArgumentException();
- return ((S)i).value;
- }
-
- public int iMo(object o, out string m){
- m = "iMo";
- if(o == null)
- throw new ArgumentNullException();
- if(!(o is S))
- throw new ArgumentException();
- return ((S)o).value;
- }
-
- public int iMS(S s, out string m){
- m = "iMS";
- return s.value;
- }
-
- public int iMi(int i, out string m){
- m = "iMi";
- return i;
- }
-#endregion
-
- public S SMi(int i, out string m){
- m = "SMi";
- return new S(i);
- }
-
- public S? NSMi(int i, out string m){
- m = "NSMi";
- return new S(i);
- }
-
- public I IMi(int i, out string m){
- m = "IMi";
- return new S(i);
- }
-
- public object oMi(int i, out string m){
- m = "oMi";
- return new S(i);
- }
-}
-
-public class RefStat{ //Static methods on a reference class
- //The out parameters are a crude tag to verify which method
- //was actually called. Necessary because the other functionality
- //of the methods is pretty much identical
-
-#region Overloads for BindToMethodName ambiguity testing
- //These should appear in order from most general to most
- //specific or (@TODO) we should have additional tests that
- //vary the method order. This is to confirm that any
- //ambiguous matching logic in BindToMethodName isn't just
- //settling for the first "match" it sees. There should
- //be no ambiguity at all in matching.
-
- public static int M(int? i, out string m){
- m = "one";
- if(i==null)
- throw new ArgumentNullException();
- else
- return (int)i;
- }
-
- public static int M(S? s, out string m){
- m = "two";
- if(s==null)
- throw new ArgumentException();
- else
- return ((S)s).value;
- }
-
- public static int M(I i, out string m){
- m = "three";
- if(i==null)
- throw new ArgumentNullException();
- if(!(i is S))
- throw new ArgumentException();
- return ((S)i).value;
- }
-
- public static int M(object o, out string m){
- m = "four";
- if(o == null)
- throw new ArgumentNullException();
- if(!(o is S))
- throw new ArgumentException();
- return ((S)o).value;
- }
-
- public static int M(S s, out string m){
- m = "five";
- return s.value;
- }
-
- public static int M(int i, out string m){
- m = "six";
- return i;
- }
-#endregion
-
-#region Non-overloaded methods to allow for (easier) explicit method selection
- public static int iMNi(int? i, out string m){
- m = "iMNi";
- if(i==null)
- throw new ArgumentNullException();
- else
- return (int)i;
- }
-
- public static int iMNS(S? s, out string m){
- m = "iMNS";
- if(s==null)
- throw new ArgumentException();
- else
- return ((S)s).value;
- }
-
- public static int iMI(I i, out string m){
- m = "iMI";
- if(i==null)
- throw new ArgumentNullException();
- if(!(i is S))
- throw new ArgumentException();
- return ((S)i).value;
- }
-
- public static int iMo(object o, out string m){
- m = "iMo";
- if(o == null)
- throw new ArgumentNullException();
- if(!(o is S))
- throw new ArgumentException();
- return ((S)o).value;
- }
-
- public static int iMS(S s, out string m){
- m = "iMS";
- return s.value;
- }
-
- public static int iMi(int i, out string m){
- m = "iMi";
- return i;
- }
-#endregion
-
- public static S SMi(int i, out string m){
- m = "SMi";
- return new S(i);
- }
-
- public static S? NSMi(int i, out string m){
- m = "NSMi";
- return new S(i);
- }
-
- public static I IMi(int i, out string m){
- m = "IMi";
- return new S(i);
- }
-
- public static object oMi(int i, out string m){
- m = "oMi";
- return new S(i);
- }
-}
-
-public struct ValInst{ //Instance methods on a value class
-}
-
-public struct ValStat{ //Static methods on a value class
-}
-
-//Some reusable helper methods
-public class Util{
- //Method to do quick culture invariant string comparisons (quick in the sense that I don't have to type of cultureinfo.invariantlsjflakjdlfjsldkjf 7000 times).
- public static bool Equals(string s1, string s2){
- return String.Equals(s1, s2, StringComparison.Ordinal);
- }
-}
-
-#pragma warning restore
+++ /dev/null
-<Project Sdk="Microsoft.NET.Sdk">
- <PropertyGroup>
- <OutputType>Library</OutputType>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <CLRTestKind>SharedLibrary</CLRTestKind>
- <CLRTestPriority>1</CLRTestPriority>
- </PropertyGroup>
- <ItemGroup>
- <Compile Include="central.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="$(TestSourceDir)Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
- </ItemGroup>
-</Project>
+++ /dev/null
-<Project Sdk="Microsoft.NET.Sdk">
- <PropertyGroup>
- <OutputType>Library</OutputType>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <CLRTestKind>SharedLibrary</CLRTestKind>
- <CLRTestPriority>1</CLRTestPriority>
- </PropertyGroup>
- <ItemGroup>
- <Compile Include="securedispatcher.cs" />
- </ItemGroup>
-</Project>
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-using System;
-
-namespace Avalon.Secure
-{
-
- public class Foo
- {
-
- static public void FooMethod(object sender, EventArgs e)
- {
- bar.BarEvent -= new EventHandler(Foo.FooMethod);
- bar.OnBarEvent();
- }
-
-
- ///<summary>
- ///</summary>
- static public Bar bar = null;
-
- }
-
-
-
-
- public class Bar
- {
- public Bar(){}
-
- public event EventHandler BarEvent;
-
- public void OnBarEvent()
- {
- if (BarEvent != null)
- BarEvent(this, EventArgs.Empty);
- }
-
-
- }
-
-
-}
-
+++ /dev/null
-<Project Sdk="Microsoft.NET.Sdk">
- <PropertyGroup>
- <OutputType>Library</OutputType>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <CLRTestKind>SharedLibrary</CLRTestKind>
- <CLRTestPriority>1</CLRTestPriority>
- </PropertyGroup>
- <ItemGroup>
- <Compile Include="target.cs" />
- </ItemGroup>
-</Project>
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-using System;
-using System.Runtime.CompilerServices;
-using System.Security;
-
-[assembly: InternalsVisibleTo("ClassFriend, PublicKey=00240000048000009400000006020000002400005253413100040000010001000fc5993e0f511ad5e16e8b226553493e09067afc41039f70daeb94a968d664f40e69a46b617d15d3d5328be7dbedd059eb98495a3b03cb4ea4ba127444671c3c84cbc1fdc393d7e10b5ee3f31f5a29f005e5eed7e3c9c8af74f413f0004f0c2cabb22f9dd4f75a6f599784e1bab70985ef8174ca6c684278be82ce055a03ebaf")]
-[assembly: InternalsVisibleTo("StaticClassFriend, PublicKey=00240000048000009400000006020000002400005253413100040000010001000fc5993e0f511ad5e16e8b226553493e09067afc41039f70daeb94a968d664f40e69a46b617d15d3d5328be7dbedd059eb98495a3b03cb4ea4ba127444671c3c84cbc1fdc393d7e10b5ee3f31f5a29f005e5eed7e3c9c8af74f413f0004f0c2cabb22f9dd4f75a6f599784e1bab70985ef8174ca6c684278be82ce055a03ebaf")]
-[assembly: InternalsVisibleTo("StructFriend, PublicKey=00240000048000009400000006020000002400005253413100040000010001000fc5993e0f511ad5e16e8b226553493e09067afc41039f70daeb94a968d664f40e69a46b617d15d3d5328be7dbedd059eb98495a3b03cb4ea4ba127444671c3c84cbc1fdc393d7e10b5ee3f31f5a29f005e5eed7e3c9c8af74f413f0004f0c2cabb22f9dd4f75a6f599784e1bab70985ef8174ca6c684278be82ce055a03ebaf")]
-
-
-//
-// This file can be compiled in two ways: ALL public (ALL_PUB), or Restricted.
-// The intention of the ALL public (ALL_PUB) is to allow a C# caller to build.
-// The restricted version is intended to be used at runtime, causing some
-// calls to fail.
-//
-
-//
-// Enum
-//
-#if ALL_PUB
-public
-#endif
- enum DefaultEnum { VALUE1, VALUE3 }
-public enum PublicEnum { VALUE1, VALUE3 }
-
-#if ALL_PUB
-public enum InternalEnum { VALUE1, VALUE3 }
-#else
-internal enum InternalEnum { VALUE1, VALUE3 }
-#endif
-
-
-
-//
-// Class
-//
-#if ALL_PUB
- public
-#endif
- class DefaultClass
-{
-}
-
-public class PublicClass
-{
- //
- // Ctors
- //
- public PublicClass() {}
-#if ALL_PUB
- public
-#endif
- PublicClass(int i1) {}
- public PublicClass(int i1, int i2) {}
-#if ALL_PUB
- public PublicClass(int i1, int i2, int i3) {}
- public PublicClass(int i1, int i2, int i3, int i4) {}
- public PublicClass(int i1, int i2, int i3, int i4, int i5) {}
- public PublicClass(int i1, int i2, int i3, int i4, int i5, int i6) {}
-#else
- protected PublicClass(int i1, int i2, int i3) {}
- internal PublicClass(int i1, int i2, int i3, int i4) {}
- protected internal PublicClass(int i1, int i2, int i3, int i4, int i5) {}
- private PublicClass(int i1, int i2, int i3, int i4, int i5, int i6) {}
-#endif
-
-
- //
- // static fields
- //
-#pragma warning disable 169
-#if ALL_PUB
- public
-#endif
- static int defaultStaticField;
- public static int publicStaticField = 0;
-#if ALL_PUB
- public static int protectedStaticField = 0;
- public static int internalStaticField = 0;
- public static int protectedInternalStaticField = 0;
- public static int privateStaticField;
-#else
- protected static int protectedStaticField = 0;
- internal static int internalStaticField = 0;
- protected internal static int protectedInternalStaticField = 0;
- private static int privateStaticField;
-#endif
-
-
- //
- // instance fields
- //
-#if ALL_PUB
- public
-#endif
- int defaultField;
- public int publicField;
-#if ALL_PUB
- public int protectedField;
- public int internalField;
- public int protectedInternalField;
- public int privateField;
-#else
- protected int protectedField;
- internal int internalField;
- protected internal int protectedInternalField;
- private int privateField;
-#endif
-
-#pragma warning restore 169
- //
- // static Properties
- //
-#if ALL_PUB
- public
-#endif
- static int DefaultStaticProperty
- {
- get { return 0; }
- set { ; }
- }
- public static int PublicStaticProperty
- {
- get { return 0; }
- set { ; }
- }
-#if ALL_PUB
- public static int ProtectedStaticProperty
- {
- get { return 0; }
- set { ; }
- }
- public static int InternalStaticProperty
- {
- get { return 0; }
- set { ; }
- }
- public static int ProtectedInternalStaticProperty
- {
- get { return 0; }
- set { ; }
- }
- public static int PrivateStaticProperty
- {
- get { return 0; }
- set { ; }
- }
-#else
- protected static int ProtectedStaticProperty
- {
- get { return 0; }
- set { ; }
- }
- internal static int InternalStaticProperty
- {
- get { return 0; }
- set { ; }
- }
- protected internal static int ProtectedInternalStaticProperty
- {
- get { return 0; }
- set { ; }
- }
- private static int PrivateStaticProperty
- {
- get { return 0; }
- set { ; }
- }
-#endif
-
- //
- // instance Properties
- //
-#if ALL_PUB
- public
-#endif
- int DefaultProperty
- {
- get { return 0; }
- set { ; }
- }
- public int PublicProperty
- {
- get { return 0; }
- set { ; }
- }
-#if ALL_PUB
- public int ProtectedProperty
- {
- get { return 0; }
- set { ; }
- }
- public int InternalProperty
- {
- get { return 0; }
- set { ; }
- }
- public int ProtectedInternalProperty
- {
- get { return 0; }
- set { ; }
- }
- public int PrivateProperty
- {
- get { return 0; }
- set { ; }
- }
-#else
- protected int ProtectedProperty
- {
- get { return 0; }
- set { ; }
- }
- internal int InternalProperty
- {
- get { return 0; }
- set { ; }
- }
- protected internal int ProtectedInternalProperty
- {
- get { return 0; }
- set { ; }
- }
- private int PrivateProperty
- {
- get { return 0; }
- set { ; }
- }
-#endif
-
-
- //
- // static Methods
- //
-#if ALL_PUB
- public
-#endif
- static int DefaultStaticMethod() { return 1; }
- public static int PublicStaticMethod() { return 1; }
-#if ALL_PUB
- public static int ProtectedStaticMethod() { return 1; }
- public static int InternalStaticMethod() { return 1; }
- public static int ProtectedInternalStaticMethod() { return 1; }
- public static int PrivateStaticMethod() { return 1; }
-#else
- protected static int ProtectedStaticMethod() { return 1; }
- internal static int InternalStaticMethod() { return 1; }
- protected internal static int ProtectedInternalStaticMethod() { return 1; }
- private static int PrivateStaticMethod() { return 1; }
-#endif
-
-
- //
- // instance Methods
- //
-#if ALL_PUB
- public
-#endif
- int DefaultMethod() { return 1; }
- public int PublicMethod() { return 1; }
-#if ALL_PUB
- public int ProtectedMethod() { return 1; }
- public int InternalMethod() { return 1; }
- public int ProtectedInternalMethod() { return 1; }
- public int PrivateMethod() { return 1; }
-#else
- protected int ProtectedMethod() { return 1; }
- internal int InternalMethod() { return 1; }
- protected internal int ProtectedInternalMethod() { return 1; }
- private int PrivateMethod() { return 1; }
-#endif
-}
-
-#if ALL_PUB
-public class InternalClass
-#else
-internal class InternalClass
-#endif
-{
-}
-
-
-//
-// Static Class
-//
-#if ALL_PUB
-public
-#endif
- static class DefaultStaticClass
-{
- public static int field = 0;
-}
-
-public static class PublicStaticClass
-{
- public static int field = 0;
-}
-
-#if ALL_PUB
-public static class InternalStaticClass
-#else
-internal static class InternalStaticClass
-#endif
-{
- public static int field = 0;
-}
-
-
-//
-// Interface
-//
-#if ALL_PUB
-public
-#endif
- interface DefaultInterface
-{
- bool Foo();
-}
-
-
-public interface PublicInterface
-{
- bool Foo();
-}
-
-#if ALL_PUB
-public interface InternalInterface
-#else
-internal interface InternalInterface
-#endif
-{
- bool Foo();
-}
-
-
-//
-// Struct
-//
-#if ALL_PUB
- public
-#endif
- struct DefaultStruct {}
-public struct PublicStruct
-{
- //
- // Ctors
- //
-#if ALL_PUB
- public
-#endif
- PublicStruct(int i1) {defaultField=publicField=internalField=privateField=0;}
- public PublicStruct(int i1, int i2) {defaultField=publicField=internalField=privateField=0;}
-#if ALL_PUB
- public PublicStruct(int i1, int i2, int i3) {defaultField=publicField=internalField=privateField=0;}
- public PublicStruct(int i1, int i2, int i3, int i4) {defaultField=publicField=internalField=privateField=0;}
-#else
- internal PublicStruct(int i1, int i2, int i3) {defaultField=publicField=internalField=privateField=0;}
- private PublicStruct(int i1, int i2, int i3, int i4) {defaultField=publicField=internalField=privateField=0;}
-#endif
-
-#pragma warning disable 414
- //
- // static fields
- //
-#if ALL_PUB
- public
-#endif
- static int defaultStaticField = 0;
- public static int publicStaticField = 0;
-#if ALL_PUB
- public static int internalStaticField = 0;
- public static int privateStaticField = 0;
-#else
- internal static int internalStaticField = 0;
- private static int privateStaticField = 0;
-#endif
-
-
- //
- // instance fields
- //
-#if ALL_PUB
- public
-#endif
- int defaultField;
- public int publicField;
-#if ALL_PUB
- public int internalField;
- public int privateField;
-#else
- internal int internalField;
- private int privateField;
-#endif
-
-#pragma warning restore 414
- //
- // static Properties
- //
-#if ALL_PUB
- public
-#endif
- static int DefaultStaticProperty
- {
- get { return 0; }
- set { ; }
- }
- public static int PublicStaticProperty
- {
- get { return 0; }
- set { ; }
- }
-#if ALL_PUB
- public static int InternalStaticProperty
- {
- get { return 0; }
- set { ; }
- }
- public static int PrivateStaticProperty
- {
- get { return 0; }
- set { ; }
- }
-#else
- internal static int InternalStaticProperty
- {
- get { return 0; }
- set { ; }
- }
- private static int PrivateStaticProperty
- {
- get { return 0; }
- set { ; }
- }
-#endif
-
- //
- // instance Properties
- //
-#if ALL_PUB
- public
-#endif
- int DefaultProperty
- {
- get { return 0; }
- set { ; }
- }
- public int PublicProperty
- {
- get { return 0; }
- set { ; }
- }
-#if ALL_PUB
- public int InternalProperty
- {
- get { return 0; }
- set { ; }
- }
- public int PrivateProperty
- {
- get { return 0; }
- set { ; }
- }
-#else
- internal int InternalProperty
- {
- get { return 0; }
- set { ; }
- }
- private int PrivateProperty
- {
- get { return 0; }
- set { ; }
- }
-#endif
-
-
- //
- // static Methods
- //
-#if ALL_PUB
- public
-#endif
- static int DefaultStaticMethod() { return 1; }
- public static int PublicStaticMethod() { return 1; }
-#if ALL_PUB
- public static int InternalStaticMethod() { return 1; }
- public static int PrivateStaticMethod() { return 1; }
-#else
- internal static int InternalStaticMethod() { return 1; }
- private static int PrivateStaticMethod() { return 1; }
-#endif
-
-
- //
- // instance Methods
- //
-#if ALL_PUB
- public
-#endif
- int DefaultMethod() { return 1; }
- public int PublicMethod() { return 1; }
-#if ALL_PUB
- public int InternalMethod() { return 1; }
- public int PrivateMethod() { return 1; }
-#else
- internal int InternalMethod() { return 1; }
- private int PrivateMethod() { return 1; }
-#endif
-}
-
-#if ALL_PUB
-public struct InternalStruct {};
-#else
-internal struct InternalStruct {};
-#endif
-
-