public override void Execute() { var configOptions = new WeaverConfigOptions(Config); var config = new WeaverConfig(configOptions, ModuleDefinition); var context = new ModuleWeavingContext(ModuleDefinition, config); foreach (var type in ModuleDefinition.GetTypes()) { foreach (var method in type.Methods) { try { if (!MethodWeaver.NeedsProcessing(context, method)) { continue; } _log.Debug($"Processing: {method.FullName}"); new MethodWeaver(context, method).Process(); } catch (WeavingException ex) { AddError(ex.Message, ex.SequencePoint); InvalidateMethod(method, ex.Message); } } if (type.IsInlineILTypeUsageDeep(context)) { AddError($"Reference to InlineIL found in type {type.FullName}. InlineIL should not be referenced in attributes/constraints, as its assembly reference will be removed.", null); } } RemoveLibReference(context); }
private static bool ShouldGenerateSequencePoints(WeaverConfigOptions config, ModuleDefinition module) { return(config.SequencePoints switch { WeaverConfigOptions.SequencePointsBehavior.False => false, WeaverConfigOptions.SequencePointsBehavior.True => true, WeaverConfigOptions.SequencePointsBehavior.Debug => module.IsDebugBuild(), WeaverConfigOptions.SequencePointsBehavior.Release => !module.IsDebugBuild(), _ => throw new InvalidOperationException("Invalid sequence points behavior") });
public WeaverLogger(ILogger log, WeaverConfigOptions config) { _log = log; _config = config; }