public bool Initialize(string taskName, IDictionary <string, TaskPropertyInfo> parameterGroup, string taskBody, IBuildEngine taskFactoryLoggingHost) { var projectFileDirectory = Path.GetDirectoryName(taskFactoryLoggingHost.ProjectFileOfTaskNode); var thisAssemblyDirectory = Path.GetDirectoryName(this.GetType().Assembly.Location); _assemblyResolver.BeginResolving(thisAssemblyDirectory, projectFileDirectory); try { var engine = Ruby.CreateEngine(); _taskScriptScope = engine.CreateScope(); _taskScriptScope.ExecuteEmbeddedScript(RubyTaskScript); var rubyTaskBody = TaskBodyParser.Parse(taskBody); var scriptFile = projectFileDirectory.CombinePath(rubyTaskBody.Script).ToFullPath(); var scriptContents = _fileSystem.GetFileContent(scriptFile); _taskScriptScope.Execute(scriptContents); _taskClass = engine.Runtime.Globals.GetVariable(taskName); } catch (Exception) { _assemblyResolver.Dispose(); throw; } return(true); }
public void Execute() { ResolveEventHandler assemblyResolve = CurrentDomain_AssemblyResolve; try { SplitUpReferences(); GetSymbolProviders(); assemblyResolver = new AssemblyResolver(Logger, SplitReferences); ReadModule(); AppDomain.CurrentDomain.AssemblyResolve += assemblyResolve; InitialiseWeavers(); ExecuteWeavers(); AddWeavingInfo(); FindStrongNameKey(); WriteModule(); ModuleDefinition?.Dispose(); CleanupTempSymbolsAndAssembly(); ExecuteAfterWeavers(); DisposeWeavers(); } catch (Exception exception) { AppDomain.CurrentDomain.AssemblyResolve -= assemblyResolve; Logger.LogException(exception); } finally { ModuleDefinition?.Dispose(); CleanupTempSymbolsAndAssembly(); assemblyResolver?.Dispose(); } }
protected override void Dispose(bool disposing) { if (m_disposed) { return; } m_assemblyResolver.Dispose(); m_downloadedUris.Dispose(); base.Dispose(disposing); }
public void Execute() { ResolveEventHandler assemblyResolve = CurrentDomain_AssemblyResolve; try { AppDomain.CurrentDomain.AssemblyResolve += assemblyResolve; SplitUpReferences(); GetSymbolProviders(); assemblyResolver = new AssemblyResolver(Logger, SplitReferences); ReadModule(); if (ModuleDefinition.Types.Any(x => x.Name == "ProcessedByFody")) { Logger.LogWarning($"The assembly has already been processed by Fody. Weaving aborted. Path: {AssemblyFilePath} "); return; } TypeCache = new TypeCache(assemblyResolver.Resolve); InitialiseWeavers(); TypeCache.BuildAssembliesToScan(weaverInstances.Select(x => x.Instance)); InitialiseTypeSystem(); ExecuteWeavers(); AddWeavingInfo(); FindStrongNameKey(); WriteModule(); ModuleDefinition?.Dispose(); CleanupTempSymbolsAndAssembly(); ExecuteAfterWeavers(); DisposeWeavers(); } catch (Exception exception) { Logger.LogException(exception); } finally { AppDomain.CurrentDomain.AssemblyResolve -= assemblyResolve; ModuleDefinition?.Dispose(); CleanupTempSymbolsAndAssembly(); assemblyResolver?.Dispose(); } }
public void Dispose() { this.assemblies = null; cachedResolver.Dispose(); }
public void Dispose() { _defaultAssemblyResolver.Dispose(); }
public void Dispose() { _defaultResolver.Dispose(); }