Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@
<Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimePropertyInfo.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\TypeNameParser.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Metadata\RuntimeTypeMetadataUpdateHandler.cs" />
<Compile Include="$(BclSourcesRoot)\System\Resources\ManifestBasedResourceGroveler.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\CastHelpers.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\ICastableHelpers.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\RuntimeHelpers.CoreCLR.cs" />
Expand Down Expand Up @@ -231,7 +230,6 @@
<Compile Include="$(BclSourcesRoot)\System\RuntimeHandles.cs" />
<Compile Include="$(BclSourcesRoot)\System\RuntimeType.ActivatorCache.cs" />
<Compile Include="$(BclSourcesRoot)\System\RuntimeType.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\Security\DynamicSecurityMethodAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\StartupHookProvider.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\String.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\StubHelpers.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -645,27 +645,29 @@ public override Assembly GetSatelliteAssembly(CultureInfo culture, Version? vers
{
ArgumentNullException.ThrowIfNull(culture);

return InternalGetSatelliteAssembly(culture, version, throwOnFileNotFound: true)!;
return InternalGetSatelliteAssembly(this, culture, version, throwOnFileNotFound: true)!;
}

[DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
internal Assembly? InternalGetSatelliteAssembly(CultureInfo culture,
internal static Assembly? InternalGetSatelliteAssembly(Assembly assembly,
CultureInfo culture,
Version? version,
bool throwOnFileNotFound)
{
var an = new AssemblyName();
an.SetPublicKey(GetPublicKey());
an.Flags = GetFlags() | AssemblyNameFlags.PublicKey;
an.Version = version ?? GetVersion();
RuntimeAssembly runtimeAssembly = (RuntimeAssembly)assembly;
Copy link
Member

Choose a reason for hiding this comment

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

It may look better to keep this as an instance method and do the RuntimeAssembly cast on this in the one or two places that needs it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've matched mono and nativeaot signature and used it in libraries. Other two do not require an instance method.

an.SetPublicKey(runtimeAssembly.GetPublicKey());
an.Flags = runtimeAssembly.GetFlags() | AssemblyNameFlags.PublicKey;
an.Version = version ?? runtimeAssembly.GetVersion();
an.CultureInfo = culture;
an.Name = GetSimpleName() + ".resources";
an.Name = runtimeAssembly.GetSimpleName() + ".resources";

// This stack crawl mark is never used because the requesting assembly is explicitly specified,
// so the value could be anything.
StackCrawlMark unused = default;
RuntimeAssembly? retAssembly = InternalLoad(an, ref unused, requestingAssembly: this, throwOnFileNotFound: throwOnFileNotFound);
RuntimeAssembly? retAssembly = InternalLoad(an, ref unused, requestingAssembly: runtimeAssembly, throwOnFileNotFound: throwOnFileNotFound);

if (retAssembly == this)
if (retAssembly == runtimeAssembly)
{
retAssembly = null;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@
<Compile Include="System\Math.NativeAot.cs" />
<Compile Include="System\MathF.NativeAot.cs" />
<Compile Include="System\Object.NativeAot.cs" />
<Compile Include="System\Resources\ManifestBasedResourceGroveler.NativeAot.cs" />
<Compile Include="System\RuntimeArgumentHandle.cs" />
<Compile Include="System\RuntimeType.cs" />
<Compile Include="System\Runtime\ControlledExecution.NativeAot.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Globalization;

using Internal.Reflection.Augments;

namespace System.Reflection
{
// Base class for runtime implemented Assembly
public abstract class RuntimeAssembly : Assembly
{
internal static Assembly? InternalGetSatelliteAssembly(Assembly mainAssembly, CultureInfo culture, Version? version, bool throwOnFileNotFound)
{
AssemblyName mainAssemblyAn = mainAssembly.GetName();
AssemblyName an = new AssemblyName();

an.CultureInfo = culture;
an.Name = mainAssemblyAn.Name + ".resources";
an.SetPublicKeyToken(mainAssemblyAn.GetPublicKeyToken());
an.Flags = mainAssemblyAn.Flags;
an.Version = version ?? mainAssemblyAn.Version;

Assembly? retAssembly = ReflectionAugments.ReflectionCoreCallbacks.Load(an, throwOnFileNotFound);

if (retAssembly == mainAssembly)
{
retAssembly = null;
}

return retAssembly;
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,7 @@
<Compile Include="$(MSBuildThisFileDirectory)System\SByte.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Security\AllowPartiallyTrustedCallersAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Security\CryptographicException.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Security\DynamicSecurityMethodAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Security\IPermission.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Security\ISecurityEncodable.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Security\IStackWalk.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,11 @@ internal ResourceSet CreateResourceSet(Stream store, Assembly assembly)
}
}

private static Assembly? InternalGetSatelliteAssembly(Assembly mainAssembly, CultureInfo culture, Version? version)
{
return RuntimeAssembly.InternalGetSatelliteAssembly(mainAssembly, culture, version, throwOnFileNotFound: false);
}

[RequiresUnreferencedCode("The CustomResourceTypesSupport feature switch has been enabled for this app which is being trimmed. " +
"Custom readers as well as custom objects on the resources file are not observable by the trimmer and so required assemblies, types and members may be removed.")]
private static ResourceSet InternalGetResourceSetFromSerializedData(Stream store, string readerTypeName, string? resSetTypeName, ResourceManager.ResourceManagerMediator mediator)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@
<Compile Include="$(BclSourcesRoot)\System\Reflection\Metadata\AssemblyExtensions.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Metadata\MetadataUpdater.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\TypeNameParser.Mono.cs" />
<Compile Include="$(BclSourcesRoot)\System\Resources\ManifestBasedResourceGroveler.Mono.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\ControlledExecution.Mono.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\DependentHandle.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\GCFrameRegistration.Mono.cs" />
Expand All @@ -264,7 +263,6 @@
Condition="'$(FeatureObjCMarshal)' == 'true'"/>
<Compile Include="$(BclSourcesRoot)\System\Runtime\Intrinsics\X86\X86Base.Mono.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\Loader\AssemblyLoadContext.Mono.cs" />
<Compile Include="$(BclSourcesRoot)\System\Security\DynamicSecurityMethodAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\Threading\Interlocked.Mono.cs" />
<Compile Include="$(BclSourcesRoot)\System\Threading\Monitor.Mono.cs" />
<Compile Include="$(BclSourcesRoot)\System\Threading\ObjectHeader.Mono.cs" />
Expand Down

This file was deleted.

This file was deleted.