コード例 #1
0
        public bool Execute()
        {
            Log.VisualStudioVersion = VisualStudioVer;

            if (!CommonRegistryConfigurations.IsSolutionEnabled(SolutionName, VisualStudioVer))
            {
                return(true);
            }

            try
            {
                string snkCertificate = File.Exists(Snk) ? Snk : null;
                using (SInjection sInjection = new SInjection(Assembly, snkCertificate))
                {
                    return(sInjection.Patch());
                }
            }
            catch (Exception e)
            {
                const string errorMessage = "Error Executing MSBuild Task SInjectionBuildTask";
                Log.Write(e, errorMessage);
                e.Capture(VisualStudioVer, message: errorMessage);
                BuildWarningEventArgs errorEvent = new BuildWarningEventArgs("Debugger Visualizer Creator", "", "SInjectionBuildTask", 0, 0, 0, 0, $"There was an error adding the serializable attributes to type of the project {Assembly}. Please change serialization method from Binary to Json or Xml in Tools->Options->BridgeVs->SerializationOption. ", "", "LINQBridgeVs");
                BuildEngine.LogWarningEvent(errorEvent);
            }
            return(true);
        }
コード例 #2
0
        /// <inheritdoc />
        /// <summary>
        ///     Executes an ITask. It creates a DynamicDebuggerVisualizer mapping all the types of a given assembly
        /// </summary>
        /// <returns>
        ///     true if the task executed successfully; otherwise, false.
        /// </returns>
        public bool Execute()
        {
            Log.VisualStudioVersion = VisualStudioVer;

            if (!CommonRegistryConfigurations.IsSolutionEnabled(SolutionName, VisualStudioVer))
            {
                return(true);
            }

            Log.Write($"Visualizer Destination Folder Path {VisualizerDestinationFolder}");


            Create3RdPartyVisualizers();

            //if dot net visualizer exists already don't create it again
            if (!FS.FileSystem.File.Exists(Path.Combine(VisualizerDestinationFolder, DotNetVisualizerAssemblyName)))
            {
                //it creates a mapping for all of the .net types that are worth exporting
                CreateDotNetFrameworkVisualizer();
            }

            CreateDebuggerVisualizer();

            return(true);
        }
コード例 #3
0
 public void Init()
 {
     Isolate.WhenCalled(() => FS.FileSystem).WillReturn(new MockFileSystem());
     Isolate.WhenCalled(() => CommonRegistryConfigurations.IsSolutionEnabled("", "")).WillReturn(true);
     Isolate.WhenCalled(() => CommonRegistryConfigurations.IsErrorTrackingEnabled("")).WillReturn(false);
     Isolate.WhenCalled(() => CommonRegistryConfigurations.IsLoggingEnabled("")).WillReturn(false);
 }
コード例 #4
0
        private CommandStates GetStatus(CommandAction action)
        {
            CommandStates result = CommandStates.Visible;

            bool isBridgeVsConfigured = PackageConfigurator.IsBridgeVsConfigured(_application.Version);

            if (!isBridgeVsConfigured)
            {
                return(result); //just show it as visible
            }
            bool isSolutionEnabled = CommonRegistryConfigurations.IsSolutionEnabled(SolutionName, _application.Version);

            if (isSolutionEnabled && action == CommandAction.Disable || !isSolutionEnabled && action == CommandAction.Enable)
            {
                result |= CommandStates.Enabled;
            }

            return(result);
        }
コード例 #5
0
        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.IsSolutionEnabled("", "")).WillReturn(true);
            Isolate.WhenCalled(() => CommonRegistryConfigurations.Map3RdPartyAssembly("", "")).WillReturn(false);
            Isolate.WhenCalled(() => CommonRegistryConfigurations.IsErrorTrackingEnabled("")).WillReturn(false);
            Isolate.WhenCalled(() => CommonRegistryConfigurations.IsLoggingEnabled("")).WillReturn(false);
        }
コード例 #6
0
        public bool Execute()
        {
            Log.VisualStudioVersion = VisualStudioVer;

            if (!CommonRegistryConfigurations.IsSolutionEnabled(SolutionName, VisualStudioVer))
            {
                return(true);
            }

            try
            {
                string visualizerAssemblyName = VisualizerAssemblyNameFormat.GetTargetVisualizerAssemblyName(VisualStudioVer, Assembly);
                string targetInstallationPath = VisualStudioOption.GetVisualizerDestinationFolder(VisualStudioVer);

                string visualizerFullPath = Path.Combine(targetInstallationPath, visualizerAssemblyName);

                if (FS.FileSystem.File.Exists(visualizerFullPath))
                {
                    FS.FileSystem.File.Delete(visualizerFullPath);
                }

                //check if pdb also exists and delete it
                string visualizerPdbFullPath = Path.ChangeExtension(visualizerFullPath, "pdb");

                if (FS.FileSystem.File.Exists(visualizerPdbFullPath))
                {
                    FS.FileSystem.File.Delete(visualizerPdbFullPath);
                }
            }
            catch (System.Exception exception)
            {
                Log.Write(exception, "Error During cleanup");
                BuildWarningEventArgs errorEvent = new BuildWarningEventArgs("Debugger Visualizer Cleanup", "", "CleanBuildTask", 0, 0, 0, 0, $"There was an error cleaning custom debugger visualizers", "", "LINQBridgeVs");
                BuildEngine.LogWarningEvent(errorEvent);
                exception.Capture(VisualStudioVer, message: "Error during project cleaning");
            }

            return(true);
        }