Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
3612154
Copy from corefxlab (Atsushi Kanamori)
steveharter Sep 14, 2018
54c6c3e
Add tests; initial hookup to corefx
steveharter Sep 21, 2018
9b98394
Build changes
steveharter Sep 25, 2018
d099dba
Project changes for OOB
steveharter Oct 24, 2018
947b62e
Use a policy class instead of func
steveharter Oct 26, 2018
04455cb
Rename from TypeLoader to MetadataLoadContext
steveharter Oct 29, 2018
b27b3cc
PathAssemblyResolver and resx support
steveharter Oct 31, 2018
6de021f
Misc formatting and renaming
steveharter Nov 1, 2018
8de56a0
Misc cleanup
steveharter Nov 1, 2018
b863df6
Make CoreAssemblyName setter private and move core assembly binding p…
steveharter Nov 1, 2018
8ea03b4
Project ref changes and misc refactoring
steveharter Nov 1, 2018
cbf7178
Revert formatting of packageIndex.json
steveharter Nov 1, 2018
142b1ec
Add System.Runtime to list of core assemblies to look for
steveharter Nov 1, 2018
a4aae33
Replace CoreAssemblyName property with CoreAssembly and address misc …
steveharter Nov 2, 2018
9bffef1
Have MetadataLoadContext throw immediately on missing core assembly
steveharter Nov 5, 2018
e6cf41b
Move the FromCoreRT files to standard locations and other misc review…
steveharter Nov 6, 2018
ccac044
Address test issues
steveharter Nov 7, 2018
74018ff
Remove stable version from PackageIndex and misc comment changes
steveharter Nov 7, 2018
b0004fb
Address build feedback
steveharter Nov 7, 2018
b8aca09
Remove PathAssemblyResolver and other feedback
steveharter Nov 8, 2018
386280d
Fix packaging
steveharter Nov 8, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pkg/Microsoft.Private.PackageBaseline/packageIndex.json
Original file line number Diff line number Diff line change
Expand Up @@ -3465,6 +3465,12 @@
"1.4.4.0": "1.7.0"
}
},
"System.Reflection.MetadataLoadContext": {
"InboxOn": {},
"AssemblyVersionInPackageVersion": {
"4.0.0.0": "4.6.0"
}
},
"System.Reflection.Primitives": {
"StableVersions": [
"4.0.0",
Expand Down
8 changes: 8 additions & 0 deletions pkg/descriptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -1389,6 +1389,14 @@
"System.Reflection.PortableExecutable.ManagedPEBuilder"
]
},
{
"Name": "System.Reflection.MetadataLoadContext",
"Description": "Provides read-only reflection on assemblies in an isolated context with support for assemblies that have different architectures and runtimes.",
"CommonTypes": [
"System.Reflection.MetadataLoadContext",
"System.Reflection.MetadataAssemblyResolver"
]
},
{
"Name": "System.Reflection.Primitives",
"Description": "Provides common enumerations for reflection-based libraries.",
Expand Down
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>

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

Copy link
Contributor Author

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.

</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>

Choose a reason for hiding this comment

The 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

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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" />
</ItemGroup>

Choose a reason for hiding this comment

The 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>

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed it

<CLSCompliant>false</CLSCompliant>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it not compliant? What API(s) required this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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>
<BuildConfigurations>
netstandard;
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

@steveharter steveharter Nov 6, 2018

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing semi-colon?

</BuildConfigurations>
</PropertyGroup>
</Project>
Loading