public void Init() { Isolate.WhenCalled(() => FS.FileSystem).WillReturn(MockFileSystem); Isolate.WhenCalled(() => CommonRegistryConfigurations.Map3RdPartyAssembly("", "")).WillReturn(false); Isolate.WhenCalled(() => CommonRegistryConfigurations.IsErrorTrackingEnabled("")).WillReturn(false); Isolate.WhenCalled(() => CommonRegistryConfigurations.IsLoggingEnabled("")).WillReturn(false); }
private void Create3RdPartyVisualizers() { try { if (!CommonRegistryConfigurations.Map3RdPartyAssembly(SolutionName, VisualStudioVer)) { return; } IEnumerable <string> assemblies = Crawler.FindDependencies(ProjectPath); foreach (string assemblyPath in assemblies) { string assemblyName; try { assemblyName = Path.GetFileNameWithoutExtension(assemblyPath); } catch { continue; //in case it is not a well formed path } //visualizer target name based on visual studio version string targetAssemblyName = VisualizerAssemblyNameFormat.GetTargetVisualizerAssemblyName(VisualStudioVer, assemblyName); string targetInstallationFilePath = Path.Combine(VisualizerDestinationFolder, targetAssemblyName); //no need to recreate the 3rd party assembly all the time if (FS.FileSystem.File.Exists(targetInstallationFilePath)) { continue; } VisualizerAttributeInjector attributeInjector = new VisualizerAttributeInjector(_dynamicVisualizerDllAssemblyPath, VisualStudioVer); attributeInjector.MapTypesFromAssembly(assemblyPath); attributeInjector.SaveDebuggerVisualizer(targetInstallationFilePath); } } catch (Exception e) { const string errorMessage = "Error Mapping 3rd Party Assemblies"; Log.Write(e, errorMessage); BuildWarningEventArgs errorEvent = new BuildWarningEventArgs("Debugger Visualizer Creator", "", "MapperBuildTask", 0, 0, 0, 0, $"There was an error creating custom debugger visualizers for 3rd Party Assemblies. Disable it in Tools->Options->BridgeVs->Map3RdPartyAssembly", "", "LINQBridgeVs"); BuildEngine.LogWarningEvent(errorEvent); e.Capture(VisualStudioVer, message: errorMessage); } }
public void Init() { Isolate.WhenCalled(() => FS.FileSystem).WillReturn(MockFileSystem); object[] args = { AssemblyToInjectLocation, FileMode.Open, FileAccess.ReadWrite, FileShare.Read }; Stream access = FS.FileSystem.File.Open(AssemblyToInjectLocation, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); Isolate.NonPublic.WhenCalled(typeof(ModuleDefinition), "GetFileStream") .WithExactArguments(args) .WillReturn(access); Isolate.WhenCalled(() => CommonRegistryConfigurations.Map3RdPartyAssembly("", "")).WillReturn(false); Isolate.WhenCalled(() => CommonRegistryConfigurations.IsErrorTrackingEnabled("")).WillReturn(false); Isolate.WhenCalled(() => CommonRegistryConfigurations.IsLoggingEnabled("")).WillReturn(false); }