static void InitializeExportedType(ExportedType exportedType, LinkContext context, AssemblyDefinition assembly) { if (!context.Annotations.IsMarked(exportedType)) { return; } if (!context.Annotations.TryGetPreservedMembers(exportedType, out TypePreserveMembers members)) { return; } TypeDefinition type = exportedType.Resolve(); if (type == null) { if (!context.IgnoreUnresolved) { context.LogError(null, DiagnosticId.ExportedTypeCannotBeResolved, exportedType.Name); } return; } context.Annotations.Mark(type, new DependencyInfo(DependencyKind.ExportedType, exportedType), new MessageOrigin(assembly)); context.Annotations.SetMembersPreserve(type, members); }
static void InitializeExportedType(ExportedType exportedType, LinkContext context) { if (!context.Annotations.IsMarked(exportedType)) { return; } if (!context.Annotations.TryGetPreservedMembers(exportedType, out TypePreserveMembers members)) { return; } TypeDefinition type = exportedType.Resolve(); if (type == null) { if (!context.IgnoreUnresolved) { context.LogError($"Exported type '{exportedType.Name}' cannot be resolved.", 1038); } return; } context.Annotations.Mark(type, new DependencyInfo(DependencyKind.ExportedType, exportedType)); context.Annotations.SetMembersPreserve(type, members); }
public static TypeDefinition TryResolve(this ExportedType exportedType) { try { return(exportedType.Resolve()); } catch (AssemblyResolutionException) { } return(null); }
void MatchExportedType(ExportedType exportedType, ModuleDefinition module, Regex regex, XPathNavigator nav) { if (regex.Match(exportedType.FullName).Success) { MarkingHelpers.MarkExportedType(exportedType, module, new DependencyInfo(DependencyKind.XmlDescriptor, _xmlDocumentLocation)); TypeDefinition type = exportedType.Resolve(); if (type != null) { ProcessType(type, nav); } } }
void MatchExportedType(ExportedType exportedType, ModuleDefinition module, Regex regex, XPathNavigator nav) { if (regex.Match(exportedType.FullName).Success) { MarkingHelpers.MarkExportedType(exportedType, module); TypeDefinition type = exportedType.Resolve(); if (type != null) { ProcessType(type, nav); } } }
void MatchExportedType(ExportedType exportedType, ModuleDefinition module, Regex regex, XPathNavigator nav) { if (regex.Match(exportedType.FullName).Success) { Annotations.Mark(exportedType); Annotations.Mark(module); var type = exportedType.Resolve(); if (type != null) { ProcessType(type, nav); } } }
private static TypeDefinition ResolveRequiredType(this ExportedType exportedType) { TypeDefinition typeDef; try { typeDef = exportedType.Resolve(); } catch (Exception ex) { throw new WeavingException($"Could not resolve type {exportedType.FullName}: {ex.Message}"); } return(typeDef ?? throw new WeavingException($"Could not resolve type {exportedType.FullName}")); }
void MatchExportedType(ExportedType exportedType, ModuleDefinition module, Regex regex, XPathNavigator nav) { if (regex.Match(exportedType.FullName).Success) { Annotations.Mark(exportedType); Annotations.Mark(module); TypeDefinition type = null; try { type = exportedType.Resolve(); } catch (AssemblyResolutionException) { } if (type != null) { ProcessType(type, nav); } } }
protected virtual TypeDefinition ProcessExportedType(ExportedType exported, AssemblyDefinition assembly) => exported.Resolve();