-
Notifications
You must be signed in to change notification settings - Fork 4.9k
MetadataLoadContext feature #33201
MetadataLoadContext feature #33201
Changes from all commits
3612154
54c6c3e
9b98394
d099dba
947b62e
04455cb
b27b3cc
6de021f
8de56a0
b863df6
8ea03b4
cbf7178
142b1ec
a4aae33
9bffef1
e6cf41b
ccac044
74018ff
b0004fb
b8aca09
386280d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="..\Directory.Build.props" /> | ||
<PropertyGroup> | ||
<AssemblyVersion>4.0.0.0</AssemblyVersion> | ||
<AssemblyKey>OPEN</AssemblyKey> | ||
</PropertyGroup> | ||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.27213.1 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Reflection.MetadataLoadContext.Tests", "tests\System.Reflection.MetadataLoadContext.Tests.csproj", "{443B7659-B3FA-4B32-88BA-3A0517E21018}" | ||
ProjectSection(ProjectDependencies) = postProject | ||
{DBB18588-DD89-4F41-9852-484FD4726F0F} = {DBB18588-DD89-4F41-9852-484FD4726F0F} | ||
EndProjectSection | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Reflection.MetadataLoadContext", "src\System.Reflection.MetadataLoadContext.csproj", "{DBB18588-DD89-4F41-9852-484FD4726F0F}" | ||
ProjectSection(ProjectDependencies) = postProject | ||
{EC84D608-71BC-4FE4-86C8-CA30F3B0CC7D} = {EC84D608-71BC-4FE4-86C8-CA30F3B0CC7D} | ||
EndProjectSection | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Reflection.MetadataLoadContext", "ref\System.Reflection.MetadataLoadContext.csproj", "{EC84D608-71BC-4FE4-86C8-CA30F3B0CC7D}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{1A2F9F4A-A032-433E-B914-ADD5992BB178}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E107E9C1-E893-4E87-987E-04EF0DCEAEFD}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{2E666815-2EDB-464B-9DF6-380BF4789AD4}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{443B7659-B3FA-4B32-88BA-3A0517E21018}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU | ||
{443B7659-B3FA-4B32-88BA-3A0517E21018}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU | ||
{443B7659-B3FA-4B32-88BA-3A0517E21018}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU | ||
{443B7659-B3FA-4B32-88BA-3A0517E21018}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU | ||
{DBB18588-DD89-4F41-9852-484FD4726F0F}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU | ||
{DBB18588-DD89-4F41-9852-484FD4726F0F}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU | ||
{DBB18588-DD89-4F41-9852-484FD4726F0F}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU | ||
{DBB18588-DD89-4F41-9852-484FD4726F0F}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU | ||
{EC84D608-71BC-4FE4-86C8-CA30F3B0CC7D}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU | ||
{EC84D608-71BC-4FE4-86C8-CA30F3B0CC7D}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU | ||
{EC84D608-71BC-4FE4-86C8-CA30F3B0CC7D}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU | ||
{EC84D608-71BC-4FE4-86C8-CA30F3B0CC7D}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(NestedProjects) = preSolution | ||
{443B7659-B3FA-4B32-88BA-3A0517E21018} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} | ||
{DBB18588-DD89-4F41-9852-484FD4726F0F} = {E107E9C1-E893-4E87-987E-04EF0DCEAEFD} | ||
{EC84D608-71BC-4FE4-86C8-CA30F3B0CC7D} = {2E666815-2EDB-464B-9DF6-380BF4789AD4} | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {34BA9CE0-95B8-42D8-B2E1-84D1EB36A8DD} | ||
EndGlobalSection | ||
EndGlobal |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" /> | ||
<ItemGroup> | ||
<ProjectReference Include="..\ref\System.Reflection.MetadataLoadContext.csproj"> | ||
<SupportedFramework>uap10.0.16299;net461;netcoreapp2.0;$(AllXamarinFrameworks)</SupportedFramework> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this particular version of uap? Should it instead of UAPvNextTFM? cc @joperezr There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed the literal and now using the variable |
||
</ProjectReference> | ||
<ProjectReference Include="..\src\System.Reflection.MetadataLoadContext.csproj" /> | ||
steveharter marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</ItemGroup> | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: remove extra line |
||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" /> | ||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<BuildConfigurations> | ||
netstandard; | ||
</BuildConfigurations> | ||
</PropertyGroup> | ||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
// ------------------------------------------------------------------------------ | ||
// Changes to this file must follow the http://aka.ms/api-review process. | ||
// ------------------------------------------------------------------------------ | ||
|
||
using System.Collections.Generic; | ||
|
||
namespace System.Reflection | ||
{ | ||
public abstract class MetadataAssemblyResolver | ||
{ | ||
public abstract Assembly Resolve(MetadataLoadContext context, AssemblyName assemblyName = null); | ||
} | ||
|
||
public sealed partial class MetadataLoadContext : System.IDisposable | ||
{ | ||
public MetadataLoadContext(MetadataAssemblyResolver resolver, string coreAssemblyName = null) { } | ||
public Assembly CoreAssembly { get { throw null; } } | ||
public void Dispose() { } | ||
public IEnumerable<Assembly> GetAssemblies() { throw null; } | ||
public Assembly LoadFromAssemblyName(AssemblyName assemblyName) { throw null; } | ||
public Assembly LoadFromAssemblyName(string assemblyName) { throw null; } | ||
public Assembly LoadFromAssemblyPath(string assemblyPath) { throw null; } | ||
public Assembly LoadFromByteArray(byte[] assembly) { throw null; } | ||
public Assembly LoadFromStream(System.IO.Stream assembly) { throw null; } | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<ProjectGuid>{EC84D608-71BC-4FE4-86C8-CA30F3B0CC7D}</ProjectGuid> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is unsafe about the reference assembly? I don't think we need this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed it |
||
<CLSCompliant>false</CLSCompliant> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is it not compliant? What API(s) required this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed it |
||
<Configurations>netstandard-Debug;netstandard-Release</Configurations> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="System.Reflection.MetadataLoadContext.cs" /> | ||
</ItemGroup> | ||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
steveharter marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<BuildConfigurations> | ||
netstandard; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the review we said we'd make a netstandard ref assembly but implement net4x and netcoreapp with netstandard implementation throwing platformnotsupported. This would eliminate the type delegator hack. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That said, if the hack works, I don't really have an issue with it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The hack does work, although not as efficient from directly deriving from TypeInfo because of an extra (unused) field in TypeDelegator. IMO keeping it in netstandard would be simpler. If we change netstandard in the future to expose a protected ctor on TypeInfo that would also address this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ericstj is a netstandard assembly preferred (in general) when we only have scenarios for using it with netfx, or does it make sense just to target netfx instead? In this case, targeting netfx makes a case for removing a hack that is present in netstandard, but not sure what we would be giving up by not also supporting netstandard or making that a PNS assembly. For example, a third party assembly or tooling like Xamarin may only want to target netstandard for simplicity. I suppose we could support all three (netcoreapp, standard and netfx) if we had to. |
||
netcoreapp | ||
steveharter marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing semi-colon? |
||
</BuildConfigurations> | ||
</PropertyGroup> | ||
</Project> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be
<StrongNameKeyId>Open</StrongNameKeyId>
?We don't use AssemblyKey anywhere else in the repo.
cc @ericstj
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears AssemblyKey was renamed to StrongNameKeyId about 5 weeks ago, so I will change it.