public static MyTypeFinder Create(OpenedFile file)
        {
            MyTypeFinder f = new MyTypeFinder();

            f.file = file;
            f.ImportFrom(CreateWpfTypeFinder());

            // DO NOT USE Assembly.LoadFrom!
            // use the special handling logic defined in TypeResolutionService!
            var compilation = SD.ParserService.GetCompilationForFile(file.FileName);

            foreach (var referencedAssembly in compilation.ReferencedAssemblies)
            {
                try {
                    var assembly = f.typeResolutionService.LoadAssembly(referencedAssembly);
                    if (assembly != null)
                    {
                        f.RegisterAssembly(assembly);
                    }
                } catch (Exception ex) {
                    ICSharpCode.Core.LoggingService.Warn("Error loading Assembly : " + referencedAssembly.FullAssemblyName, ex);
                }
            }
            return(f);
        }
Exemple #2
0
        public static MyTypeFinder Create(OpenedFile file)
        {
            MyTypeFinder f = new MyTypeFinder();

            f.file = file;
            f.ImportFrom(CreateWpfTypeFinder());

            var pc = MyTypeFinder.GetProjectContent(file);

            foreach (var referencedProjectContent in pc.ThreadSafeGetReferencedContents())
            {
                string fileName = null;
                try{
                    if (referencedProjectContent is ParseProjectContent)
                    {
                        var prj = ((ParseProjectContent)referencedProjectContent).Project as AbstractProject;
                        if (prj != null)
                        {
                            fileName = prj.OutputAssemblyFullPath;
                        }
                    }
                    else if (referencedProjectContent is ReflectionProjectContent)
                    {
                        fileName = ((ReflectionProjectContent)referencedProjectContent).AssemblyLocation;
                    }
                    var assembly = Assembly.LoadFrom(fileName);
                    f.RegisterAssembly(assembly);
                }
                catch (Exception ex) {
                    ICSharpCode.Core.LoggingService.Warn("Error loading Assembly : " + (fileName ?? ""), ex);
                }
            }
            return(f);
        }
Exemple #3
0
		public static MyTypeFinder Create(OpenedFile file)
		{
			MyTypeFinder f = new MyTypeFinder();
			f.file = file;
			f.ImportFrom(CreateWpfTypeFinder());
			
			var pc = MyTypeFinder.GetProjectContent(file);
			foreach (var referencedProjectContent in pc.ThreadSafeGetReferencedContents()) {
				string fileName = null;
				try{
					if (referencedProjectContent is ParseProjectContent)
					{
						var prj = ((ParseProjectContent)referencedProjectContent).Project as AbstractProject;
						if (prj != null)
							fileName = prj.OutputAssemblyFullPath;
					}
					else if (referencedProjectContent is ReflectionProjectContent)
					{
						fileName = ((ReflectionProjectContent) referencedProjectContent).AssemblyLocation;
					}
					var assembly = Assembly.LoadFrom(fileName);
					f.RegisterAssembly(assembly);
				}
				catch (Exception ex) {
					ICSharpCode.Core.LoggingService.Warn("Error loading Assembly : "+ (fileName ?? ""), ex);
				}
			}
			return f;
		}
Exemple #4
0
		public static MyTypeFinder Create(OpenedFile file)
		{
			MyTypeFinder f = new MyTypeFinder();
			f.file = file;
			f.ImportFrom(CreateWpfTypeFinder());
			
			var compilation = SD.ParserService.GetCompilationForFile(file.FileName);
			foreach (var referencedAssembly in compilation.ReferencedAssemblies) {
				try {
					var assembly = Assembly.LoadFrom(referencedAssembly.GetReferenceAssemblyLocation());
					f.RegisterAssembly(assembly);
				} catch (Exception ex) {
					ICSharpCode.Core.LoggingService.Warn("Error loading Assembly : " + referencedAssembly.FullAssemblyName, ex);
				}
			}
			return f;
		}
Exemple #5
0
		public static MyTypeFinder Create(OpenedFile file)
		{
			MyTypeFinder f = new MyTypeFinder();
			f.file = file;
			f.ImportFrom(CreateWpfTypeFinder());
			
			// DO NOT USE Assembly.LoadFrom!
			// use the special handling logic defined in TypeResolutionService!
			var compilation = SD.ParserService.GetCompilationForFile(file.FileName);
			foreach (var referencedAssembly in compilation.ReferencedAssemblies) {
				try {
					var assembly = f.typeResolutionService.LoadAssembly(referencedAssembly);
					if (assembly != null)
						f.RegisterAssembly(assembly);
				} catch (Exception ex) {
					ICSharpCode.Core.LoggingService.Warn("Error loading Assembly : " + referencedAssembly.FullAssemblyName, ex);
				}
			}
			return f;
		}