Esempio n. 1
0
        public void test_ExeCreation_manual()
        {
            var targetMethod = DI.reflection.getMethod(typeof(TestClass), "TestMethod", null);

            Assert.That(targetMethod != null, "targetMethod was null");

            var standAloneExe = StandAloneExe.createMainPointingToMethodInfo(targetMethod);

            Assert.That(File.Exists(standAloneExe), "standAloneExe file didn't exist: " + standAloneExe);

            var createdDirectory = CecilAssemblyDependencies.populateDirectoryWithAllDependenciesOfAssembly(standAloneExe);

            Assert.That(Directory.Exists(createdDirectory), "createdDirectory didn't exist");
            var exeInCreatedDirectory = Path.Combine(createdDirectory, Path.GetFileName(standAloneExe));

            Assert.That(File.Exists(exeInCreatedDirectory), "exeInCreatedDirectory diddnt exit");

            var newDirectoryName = DI.config.getTempFolderInTempDirectory(targetMethod.Name);

            Files.copyFilesFromDirectoryToDirectory(createdDirectory, newDirectoryName);
            Files.deleteFolder(createdDirectory);

            var exeInFinalDirectory = Path.Combine(newDirectoryName, Path.GetFileName(standAloneExe));
            var pdbFile             = IL.createPdb(exeInFinalDirectory, false);

            Assert.That(File.Exists(pdbFile), "pdbFile was not created");

            DI.log.info("New exe and pdb are on directory {0}", newDirectoryName);
        }
Esempio n. 2
0
        public void test_ExeCreation_automatic()
        {
            var targetMethod = DI.reflection.getMethod(typeof(TestClass), "TestMethod", null);

            Assert.That(targetMethod != null, "targetMethod was null");
            var exeInPackagedDirectory = StandAloneExe.createPackagedDirectoryForMethod(targetMethod);

            Assert.That(File.Exists(exeInPackagedDirectory), "exeInPackagedDirectory was not created");

            DI.log.info("New exe and pdb are on directory {0}", Path.GetDirectoryName(exeInPackagedDirectory));
        }
 public static void debugMethod(MethodInfo targetMethod, string loadDllsFrom)
 {
     if (IsDebuggerAvailable() == false)
     {
         DI.log.error("in debugMethod, could not debug method since there is no Debugger Available");
     }
     else
     {
         DI.log.debug("Starting method under debugged: {0}", targetMethod.Name);
         var exeInPackagedDirectory = StandAloneExe.createPackagedDirectoryForMethod(targetMethod, loadDllsFrom);
         startProcessUnderDebugger(exeInPackagedDirectory);
     }
 }