Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/linker
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2017-08-23 01:44:47 +0300
committerMarek Safar <marek.safar@gmail.com>2017-08-23 02:00:23 +0300
commit07b07ef75fa1858253af45af6fe30812a5a1655c (patch)
treef417adca5c0835b87634a1c236fe1f1ef6c917a5 /linker
parent1823bc3aa353319892d2d4c7dc0c543b11b204ed (diff)
Don't crash on any wrong type forwader reference
Diffstat (limited to 'linker')
-rw-r--r--linker/Mono.Linker.Steps/ResolveFromAssemblyStep.cs27
1 files changed, 17 insertions, 10 deletions
diff --git a/linker/Mono.Linker.Steps/ResolveFromAssemblyStep.cs b/linker/Mono.Linker.Steps/ResolveFromAssemblyStep.cs
index b7a4d44e8..6595b826d 100644
--- a/linker/Mono.Linker.Steps/ResolveFromAssemblyStep.cs
+++ b/linker/Mono.Linker.Steps/ResolveFromAssemblyStep.cs
@@ -123,17 +123,24 @@ namespace Mono.Linker.Steps
} catch (AssemblyResolutionException) {
continue;
}
+
if (resolvedExportedType == null) {
- // we ignore the nested forwarders here as a workaround for older csc bug,
- // where it was adding nested forwarders to exported types, even when the nested type was not public
- // see https://bugzilla.xamarin.com/show_bug.cgi?id=57645#c13
- if (exported.DeclaringType != null) {
- if (context.LogInternalExceptions)
- System.Console.WriteLine ($"warning: unable to resolve exported nested type: {exported} (declaring type: {exported.DeclaringType}) from the assembly: {assembly}");
-
- continue;
- }
- throw new LoadException ($"unable to resolve exported forwarded type: {exported} from the assembly: {assembly}");
+ //
+ // It's quite common for assemblies to have broken exported types
+ //
+ // One source of them is from native csc which added all nested types of
+ // type-forwarded types automatically including private ones.
+ //
+ // Next source of broken type-forwarders is from custom metadata writers which
+ // simply write bogus information.
+ //
+ // Both cases are bugs not on our end but we still want to link all assemblies
+ // especially when such types cannot be used anyway
+ //
+ if (context.LogInternalExceptions)
+ System.Console.WriteLine ($"Cannot find declaration of exported type '{exported}' from the assembly '{assembly}'");
+
+ continue;
}
context.Resolve (resolvedExportedType.Scope);