You've already forked linux-packaging-mono
Imported Upstream version 5.4.0.167
Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
parent
e49d6f06c0
commit
536cd135cc
@@ -2,7 +2,8 @@
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\dir.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyVersion>4.0.3.0</AssemblyVersion>
|
||||
<AssemblyVersion>4.0.4.0</AssemblyVersion>
|
||||
<AssemblyKey>MSFT</AssemblyKey>
|
||||
<IsNETCoreApp>true</IsNETCoreApp>
|
||||
<IsUAP>true</IsUAP>
|
||||
</PropertyGroup>
|
||||
|
@@ -3,14 +3,21 @@
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ref\System.Reflection.DispatchProxy.csproj">
|
||||
<SupportedFramework>net46;netcore50;netcoreapp1.0;$(AllXamarinFrameworks)</SupportedFramework>
|
||||
<SupportedFramework>net461;netcoreapp2.0;$(AllXamarinFrameworks)</SupportedFramework>
|
||||
<!-- Make sure this doesn't get stripped during harvesting.
|
||||
We have an implementation that will work on desktop, thus needs a unique assembly version -->
|
||||
<Preserve>true</Preserve>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\src\System.Reflection.DispatchProxy.csproj" />
|
||||
<HarvestIncludePaths Include="runtimes/aot/lib/netcore50" />
|
||||
<HarvestIncludePaths Include="ref/netstandard1.3;lib/netstandard1.3" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<InboxOnTargetFramework Include="netcoreapp2.0" />
|
||||
<InboxOnTargetFramework Include="uap10.1" />
|
||||
<File Include="$(PlaceholderFile)">
|
||||
<TargetPath>runtimes/aot/lib/uap10.1</TargetPath>
|
||||
</File>
|
||||
<InboxOnTargetFramework Include="MonoAndroid10" />
|
||||
<InboxOnTargetFramework Include="MonoTouch10" />
|
||||
<InboxOnTargetFramework Include="xamarinios10" />
|
||||
|
@@ -3,13 +3,10 @@
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{7DF3C428-AAD6-41C7-98E6-6CACFD5C391E}</ProjectGuid>
|
||||
<!-- UAP10.1 is not yet mapped to netstandard2.0, manually duplicate this ref -->
|
||||
<PackageTargetFramework>netstandard2.0;uap10.1</PackageTargetFramework>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
|
||||
<ItemGroup>
|
||||
<SuppressPackageTargetFrameworkCompatibility Include="uap10.1" />
|
||||
<Compile Include="System.Reflection.DispatchProxy.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
|
@@ -1,7 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<PackageConfigurations>
|
||||
netfx;
|
||||
netstandard;
|
||||
</PackageConfigurations>
|
||||
<BuildConfigurations>
|
||||
$(PackageConfigurations);
|
||||
uapaot-Windows_NT;
|
||||
netcoreapp;
|
||||
uap-Windows_NT;
|
||||
|
@@ -70,4 +70,7 @@
|
||||
<data name="BaseType_Cannot_Be_Abstract" xml:space="preserve">
|
||||
<value>The base type '{0}' cannot be abstract.</value>
|
||||
</data>
|
||||
<data name="PlatformNotSupported_ReflectionDispatchProxy" xml:space="preserve">
|
||||
<value>This operation is not supported on .NET Standard as Reflection.Emit is not available.</value>
|
||||
</data>
|
||||
</root>
|
@@ -6,24 +6,34 @@
|
||||
<AssemblyName>System.Reflection.DispatchProxy</AssemblyName>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'uapaot'">true</IsPartialFacadeAssembly>
|
||||
<!-- this library depends on Ref.Emit which is not available for netstandard -->
|
||||
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetGroup)' == 'netstandard'">SR.PlatformNotSupported_ReflectionDispatchProxy</GeneratePlatformNotSupportedAssemblyMessage>
|
||||
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'uapaot'">None</ResourcesSourceOutputDirectory>
|
||||
</PropertyGroup>
|
||||
<!-- Default configurations to help VS understand the configurations -->
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Windows_NT-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Windows_NT-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uapaot-Windows_NT-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uapaot-Windows_NT-Release|AnyCPU'" />
|
||||
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' != 'true'">
|
||||
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' != 'true' AND '$(TargetGroup)' != 'netstandard'">
|
||||
<Compile Include="System\Reflection\DispatchProxy.cs" />
|
||||
<Compile Include="System\Reflection\DispatchProxyGenerator.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetGroup)' == 'netfx'">
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetGroup)' == 'uapaot'">
|
||||
<ReferenceFromRuntime Include="System.Private.Interop" />
|
||||
<ReferenceFromRuntime Include="System.Private.CoreLib" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' != 'true'">
|
||||
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' != 'true' AND '$(TargetGroup)' != 'netstandard' AND '$(TargetGroup)' != 'netfx'">
|
||||
<Reference Include="System.Collections" />
|
||||
<Reference Include="System.Diagnostics.Debug" />
|
||||
<Reference Include="System.Linq" />
|
||||
|
@@ -781,7 +781,7 @@ namespace System.Reflection
|
||||
}
|
||||
else if (targetTypeInfo.IsAssignableFrom(sourceTypeInfo))
|
||||
{
|
||||
if (sourceTypeInfo.IsValueType)
|
||||
if (sourceTypeInfo.IsValueType || source.IsGenericParameter)
|
||||
{
|
||||
if (isAddress)
|
||||
Ldind(il, source);
|
||||
@@ -793,8 +793,6 @@ namespace System.Reflection
|
||||
Debug.Assert(sourceTypeInfo.IsAssignableFrom(targetTypeInfo) || targetTypeInfo.IsInterface || sourceTypeInfo.IsInterface);
|
||||
if (target.IsGenericParameter)
|
||||
{
|
||||
// T GetProperty<T>() where T : class;
|
||||
Debug.Assert(targetTypeInfo.GenericParameterAttributes == GenericParameterAttributes.ReferenceTypeConstraint);
|
||||
il.Emit(OpCodes.Unbox_Any, target);
|
||||
}
|
||||
else
|
||||
|
@@ -70,7 +70,7 @@ namespace DispatchProxyTests
|
||||
Assert.NotNull(proxy1);
|
||||
Assert.NotNull(proxy2);
|
||||
Assert.False(object.ReferenceEquals(proxy1, proxy2),
|
||||
String.Format("First and second instance of proxy type {0} were the same instance", proxy1.GetType().Name));
|
||||
String.Format("First and second instance of proxy type {0} were the same instance", proxy1.GetType().ToString()));
|
||||
}
|
||||
|
||||
|
||||
@@ -99,27 +99,31 @@ namespace DispatchProxyTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[ActiveIssue("https://github.com/dotnet/corert/issues/3637 - wrong exception thrown from DispatchProxy.Create()", TargetFrameworkMonikers.UapAot)]
|
||||
public static void Create_Using_Concrete_Proxy_Type_Throws_ArgumentException()
|
||||
{
|
||||
Assert.Throws<ArgumentException>("T", () => DispatchProxy.Create<TestType_ConcreteClass, TestDispatchProxy>());
|
||||
AssertExtensions.Throws<ArgumentException>("T", () => DispatchProxy.Create<TestType_ConcreteClass, TestDispatchProxy>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[ActiveIssue("https://github.com/dotnet/corert/issues/3637 - wrong exception thrown from DispatchProxy.Create()", TargetFrameworkMonikers.UapAot)]
|
||||
public static void Create_Using_Sealed_BaseType_Throws_ArgumentException()
|
||||
{
|
||||
Assert.Throws<ArgumentException>("TProxy", () => DispatchProxy.Create<TestType_IHelloService, Sealed_TestDispatchProxy>());
|
||||
AssertExtensions.Throws<ArgumentException>("TProxy", () => DispatchProxy.Create<TestType_IHelloService, Sealed_TestDispatchProxy>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[ActiveIssue("https://github.com/dotnet/corert/issues/3637 - wrong exception thrown from DispatchProxy.Create()", TargetFrameworkMonikers.UapAot)]
|
||||
public static void Create_Using_Abstract_BaseType_Throws_ArgumentException()
|
||||
{
|
||||
Assert.Throws<ArgumentException>("TProxy", () => DispatchProxy.Create<TestType_IHelloService, Abstract_TestDispatchProxy>());
|
||||
AssertExtensions.Throws<ArgumentException>("TProxy", () => DispatchProxy.Create<TestType_IHelloService, Abstract_TestDispatchProxy>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[ActiveIssue("https://github.com/dotnet/corert/issues/3637 - wrong exception thrown from DispatchProxy.Create()", TargetFrameworkMonikers.UapAot)]
|
||||
public static void Create_Using_BaseType_Without_Default_Ctor_Throws_ArgumentException()
|
||||
{
|
||||
Assert.Throws<ArgumentException>("TProxy", () => DispatchProxy.Create<TestType_IHelloService, NoDefaultCtor_TestDispatchProxy>());
|
||||
AssertExtensions.Throws<ArgumentException>("TProxy", () => DispatchProxy.Create<TestType_IHelloService, NoDefaultCtor_TestDispatchProxy>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -390,6 +394,7 @@ namespace DispatchProxyTests
|
||||
|
||||
|
||||
[Fact]
|
||||
[SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Reflection on generated dispatch proxy types not allowed.")]
|
||||
public static void Proxy_Declares_Interface_Properties()
|
||||
{
|
||||
TestType_IPropertyService proxy = DispatchProxy.Create<TestType_IPropertyService, TestDispatchProxy>();
|
||||
@@ -448,6 +453,7 @@ namespace DispatchProxyTests
|
||||
#endif // netcoreapp
|
||||
|
||||
[Fact]
|
||||
[SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Reflection on generated dispatch proxy types not allowed.")]
|
||||
public static void Proxy_Declares_Interface_Events()
|
||||
{
|
||||
TestType_IEventService proxy = DispatchProxy.Create<TestType_IEventService, TestDispatchProxy>();
|
||||
@@ -489,11 +495,40 @@ namespace DispatchProxyTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Reflection on generated dispatch proxy types not allowed.")]
|
||||
public static void Proxy_Declares_Interface_Indexers()
|
||||
{
|
||||
TestType_IIndexerService proxy = DispatchProxy.Create<TestType_IIndexerService, TestDispatchProxy>();
|
||||
PropertyInfo propertyInfo = proxy.GetType().GetTypeInfo().GetDeclaredProperty("Item");
|
||||
Assert.NotNull(propertyInfo);
|
||||
}
|
||||
|
||||
static void testGenericMethodRoundTrip<T>(T testValue)
|
||||
{
|
||||
var proxy = DispatchProxy.Create<TypeType_GenericMethod, TestDispatchProxy>();
|
||||
((TestDispatchProxy)proxy).CallOnInvoke = (mi, a) =>
|
||||
{
|
||||
Assert.True(mi.IsGenericMethod);
|
||||
Assert.False(mi.IsGenericMethodDefinition);
|
||||
Assert.Equal(1, mi.GetParameters().Length);
|
||||
Assert.Equal(typeof(T), mi.GetParameters()[0].ParameterType);
|
||||
Assert.Equal(typeof(T), mi.ReturnType);
|
||||
return a[0];
|
||||
};
|
||||
Assert.Equal(proxy.Echo(testValue), testValue);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void Invoke_Generic_Method()
|
||||
{
|
||||
//string
|
||||
testGenericMethodRoundTrip("asdf");
|
||||
//reference type
|
||||
testGenericMethodRoundTrip(new Version(1, 0, 0, 0));
|
||||
//value type
|
||||
testGenericMethodRoundTrip(42);
|
||||
//enum type
|
||||
testGenericMethodRoundTrip(DayOfWeek.Monday);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -13,6 +13,9 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="DispatchProxyTests.cs" />
|
||||
<Compile Include="TestTypes.cs" />
|
||||
<Compile Include="$(CommonTestPath)\System\AssertExtensions.cs">
|
||||
<Link>Common\System\AssertExtensions.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
@@ -80,6 +80,11 @@ internal interface TestType_PublicInterfaceService_Implements_Internal : TestTyp
|
||||
string Echo2(string message);
|
||||
}
|
||||
|
||||
public interface TypeType_GenericMethod
|
||||
{
|
||||
T Echo<T>(T messages);
|
||||
}
|
||||
|
||||
// Negative -- demonstrates trying to use a class for the interface type for the proxy
|
||||
public class TestType_ConcreteClass
|
||||
{
|
||||
|
Reference in New Issue
Block a user