public void Uninitialize() { this.PropertyInspectorModel.Dispose(); this.PropertyInspectorModel = null; this.ResourceManager.Unload(); this.ResourceManager = null; this.BreadcrumbBarModel.Dispose(); this.BreadcrumbBarModel = null; this.SelectionManager.Dispose(); this.SelectionManager = null; this.ViewUpdateManager = null; this.PlatformContextChanger.Dispose(); this.PlatformContextChanger = null; this.PropertyManager.Dispose(); this.PropertyManager = null; this.PlatformConverter = null; this.AmbientPropertyManager.Dispose(); this.AmbientPropertyManager = null; this.AssetLibrary.Dispose(); this.AssetLibrary = null; this.ThemeContentProvider = null; this.SnappingEngine = null; this.CodeAidProvider = null; this.ViewOptionsModel = null; this.UnitsOptionsModel = null; this.AnnotationsOptionsModel = null; this.referenceChecker.Unhook(); this.referenceChecker = null; this.ToolContext = null; this.ToolManager.Dispose(); this.ToolManager = null; this.GradientToolSelectionService = null; }
// Throws an exception at the end of analysis if there is a problem // with types or references. public bool RunCheck() { var success = true; success &= new ReferenceChecker(this).RunCheck(); success &= new TypeChecker(this).RunCheck(); return success; }
public void Check_Returns_True_With_Partial_Matches() { var checker = new ReferenceChecker(); var actual = checker.DoesAReferenceB("ArrowAsserts.Tests", "nunit.fram"); Assert.That(actual, Is.True); }
public void Check_Returns_False() { var checker = new ReferenceChecker(); var actual = checker.DoesAReferenceB("ArrowAsserts", "ArrowAsserts.Tests"); Assert.That(actual, Is.False); }
public static Dictionary <IntPtr, string> Snapshot() { var sluaSvrGameObject = GameObject.Find("LuaStateProxy_0"); if (sluaSvrGameObject == null) { ReferenceChecker.DisplayWarningDialog("lua 虚拟机还未运行,请先运行工程"); return(new Dictionary <IntPtr, string>()); } IntPtr luaState = sluaSvrGameObject.GetComponent <LuaSvrGameObject>().state.L; LuaDLL.pua_gc(luaState, LuaGCOptions.LUA_GCCOLLECT, 0); IntPtr dumpLuaState = LuaDLL.puaL_newstate(); for (int i = 0; i < MARK; i++) { LuaDLL.pua_newtable(dumpLuaState); } LuaDLL.pua_pushvalue(luaState, LuaIndexes.LUA_REGISTRYINDEX); MarkTable(luaState, dumpLuaState, IntPtr.Zero, "[registry]"); GenResult(luaState, dumpLuaState); LuaDLL.pua_close(dumpLuaState); _snapshot = GetSnapshot(luaState); return(_snapshot); }
public override bool Execute() { //Neue AppDomain erstellen, um das Sperren der Assemblies zu vermeiden AppDomainSetup setup = new AppDomainSetup(); setup.ApplicationBase = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); AppDomain domain = AppDomain.CreateDomain("RefCheckDomain", null, setup); try { string assembly = typeof(ReferenceChecker).Assembly.Location; string className = typeof(ReferenceChecker).FullName; Log.LogMessage("ReferenceChecker: Assembly: {0}, Class: {1}", assembly, className); ReferenceChecker checker = (ReferenceChecker)domain.CreateInstanceFromAndUnwrap(assembly, className); checker.RootPath = Path; checker.IgnoreVersions = IgnoreAssemblyVersions; if (Excludes != null) { foreach (ITaskItem item in Excludes) { checker.AddExclude(new AssemblyName(item.ItemSpec)); } } if (Assemblies != null) { foreach (var item in Assemblies) { checker.AddAssembly(item.ItemSpec); } } checker.Check(); MissingReference[] reportedAssemblies = checker.GetReportedAssemblies(); if (reportedAssemblies != null && reportedAssemblies.Length > 0) { Log.LogMessage("Following references were not found:"); foreach (var name in reportedAssemblies) { Log.LogError("[MISSING REFERENCE ({2})] {0} referenced by {1}", name.MissingAssembly.FullName, name.ReferencesBy.Name, MessageInfo); } Log.LogMessage(MessageImportance.High, "Copy & Paste friendly list of assemblies: \r\n{0}", string.Join(";\r\n", reportedAssemblies.Select(ra => ra.MissingAssembly.Name + ".dll"))); return(false); } else { return(true); } } finally { AppDomain.Unload(domain); } }
public void SetupFixture() { //_checker = new ReferenceChecker(new SolutionLoader(true, // @"C:\Projects2\phonixx\trunk\", // new List<string>{"precompiledwebs", "applications"})); //ignore these subfolders of solution root _checker = new ReferenceChecker(new SolutionLoader()); }
public void CheckShouldReturnOneWarning() { var solution = new Solution(); solution.Load(TestSettings.SolutionFileName); var checker = new ReferenceChecker(solution); checker.Check(); Assert.AreEqual(1, solution.Warnings.Count); }
public DesignerContext(IServiceProvider serviceProvider) { this.serviceProvider = serviceProvider; this.Services = this.serviceProvider as IServices; if (this.Services == null) { this.Services = (IServices)serviceProvider.GetService(typeof(IServices)); } this.ExpressionInformationService = (IExpressionInformationService)this.serviceProvider.GetService(typeof(IExpressionInformationService)); this.MessageLoggingService = (IMessageLoggingService)this.serviceProvider.GetService(typeof(IMessageLoggingService)); this.ErrorManager = (IErrorService)this.serviceProvider.GetService(typeof(IErrorService)); this.PathEditorTargetMap = new ElementToPathEditorTargetMap(); this.referenceChecker = new ReferenceChecker(this); }
/// <summary> /// set reference number /// </summary> /// <param name="reference"> reference number (in domestic format) </param> public override void SetReference(string reference) { // convert reference number from domestic to international format reference = ReferenceChecker.ConvertToISO11649(reference); reference = reference.Substring(2); while (reference.Length < 23) { // fill leading zeros reference = reference.Insert(2, "0"); } this._reference = reference; }
private void AddReferences(string fileName, HashSet <string> resultFileNames, HashSet <string> visited) { if (Path.GetFileName(fileName).Equals("mscorlib.dll", StringComparison.OrdinalIgnoreCase)) { return; } if (visited.Contains(fileName)) { return; } visited.Add(fileName); if (!resultFileNames.Contains(fileName)) { resultFileNames.Add(fileName); } Assembly assembly = TryLoadAssembly(fileName); if (assembly != null) { var referencedAssemblies = assembly.GetReferencedAssemblies(); foreach (var assemblyName in referencedAssemblies) { if (!ReferenceChecker.IsFrameworkAssembly(assemblyName)) { string referencedFileName = GetAssemblyFileName(assemblyName); if (!string.IsNullOrEmpty(referencedFileName)) { AddReferences(referencedFileName, resultFileNames, visited); } } } } }
public TestRepository(GenericInfrastructureContext context) : base(context) { ReferenceChecker.RegisterReferences(new Reference <Account, long>(account => account.UserId)); }
public static IEnumerable <EcsFile> Run(MethodReference entryPoint) { var usedTypes = GetUsedTypesOrdered(entryPoint).ToList(); var moduleParameter = new ModuleParameters { Kind = ModuleKind.Dll, AssemblyResolver = entryPoint.Module.AssemblyResolver }; var mod = ModuleDefinition.CreateModule("test", moduleParameter); // copy search path from old assembly // todo move to new transform, discovery transform? foreach (var t in usedTypes) { t.IsNestedPrivate = false; } foreach (var t in usedTypes) { mod.Types.Add(t); } (new NewobjTransform()).TransformIL(usedTypes); //(new ArrayTransform()).TransformIL(usedTypes); (new FinalizerOptimization()).TransformIL(usedTypes); (new VirtualCallOptimization()).TransformIL(usedTypes); (new MainNoReturnCodeTransform()).TransformIL(usedTypes); RenameTransform.Rename(usedTypes); (new ThisParameterTransform()).TransformIL(usedTypes); (new DelegateTransform()).TransformIL(usedTypes); (new StringLiteralOptimization()).GlobalOptimization(usedTypes); (new ValueTypeOptimization()).TransformIL(usedTypes); (new IsInstanceOptimization()).TransformIL(usedTypes); // has to be before Interface Optimization (IsInterface is set to false there) (new InterfaceOptimization()).TransformIL(usedTypes); (new FinalizerImplementationOptimization()).TransformIL(usedTypes); (new ExceptionTransform()).TransformIL(usedTypes); (new StripExternalAnnotations()).TransformIL(usedTypes); //(new StripTryCatch()).TransformIL(usedTypes); // do this after ExceptionTransform as it will create default values. (new PrimitiveDefaultValues()).TransformIL(usedTypes); ILAstDebugPrinter.ClearLogs(); ReferenceImportHelper.ImportReferences(mod); mod.Write(@"logs\compacted.dll"); File.Copy("ESharpCore.dll", @"logs\ESharpCore.dll"); // todo, just disabled temporarly because of poiter types resolving to null?? Should this happen? ReferenceChecker.CheckReferences(mod); var files = (new DecompilerService()).Generate(usedTypes, @"logs\compacted.dll").ToList(); // file optimization var fileOptimizationContext = new FileOptimizationContext { UsedTypes = usedTypes }; TypeEnumGenerator.FileOptimization(files, fileOptimizationContext); IncludeCFiles.Run(files); var mergedFiles = CMerger.MergeIntoSingleFile(files); return(mergedFiles); }