Can't add assembly (FileLoadException)

SyntaxEditor .NET Languages Add-on for WPF Forum

Posted 7 years ago by Jake Pearson - Software Developer, Alion Science and Technology
Avatar
Hi,
I'm porting an application from SyntaxEditor for WinForms to SyntaxEditor for WPF. I got all the compiler errors taken care of. During startup, I call this function:
        public static void Startup(IEnumerable<string> extraReferences)
        {
            AmbientParseRequestDispatcherProvider.Dispatcher = new ThreadedParseRequestDispatcher();

            var appDataPath = Path.Combine(UserInterfaceHelper.UserDataPath + "\\Assembly Repository");
            AmbientAssemblyRepositoryProvider.Repository = new FileBasedAssemblyRepository(appDataPath);

            var project = StaticLanguage.GetService<IProjectAssembly>();
            var assemblyLoader = new BackgroundWorker();
            assemblyLoader.DoWork += (sender, e) =>
            {
                project.AssemblyReferences.AddMsCorLib();  // MsCorLib should always be added at a minimum
                foreach (var reference in extraReferences)
                {
                    project.AssemblyReferences.Add(reference);
                }
            };
            assemblyLoader.RunWorkerAsync();
        }
It crashes on project.AssemblyReferences.Add when it tries to add in one of my dlls. It is able to get through system dlls. Here is the stack trace:
     mscorlib.dll!System.Reflection.AssemblyName.AssemblyName(string assemblyName) + 0x51 bytes    
     ActiproSoftware.Text.Addons.DotNet.Wpf.dll!#Grc.#8rc.#BFc(string assemblyName) + 0xc0 bytes    
     ActiproSoftware.Text.Addons.DotNet.Wpf.dll!ActiproSoftware.Text.Languages.DotNet.Reflection.Implementation.AssemblyRepositoryBase.Load(string fullName) + 0x60 bytes    
     ActiproSoftware.Text.Addons.DotNet.Wpf.dll!#Grc.#tsc.Add(string fullName) + 0x4f bytes    
>    MAAD.Utilities.CodeEditor.dll!MAAD.Utilities.CodeEditor.CSharpEditorWPF.Startup.AnonymousMethod__0(object sender, System.ComponentModel.DoWorkEventArgs e) Line 156 + 0x1b bytes    C#
     System.dll!System.ComponentModel.BackgroundWorker.OnDoWork(System.ComponentModel.DoWorkEventArgs e) + 0x7b bytes    
     System.dll!System.ComponentModel.BackgroundWorker.WorkerThreadStart(object argument) + 0x50 bytes    
Please let me know if you need more information:

thanks,
Jake

[Modified at 02/17/2012 10:19 AM]

Comments (1)

Posted 7 years ago by Jake Pearson - Software Developer, Alion Science and Technology
Avatar
I figured it out, I need to call AddFile for files outside of the GAC and Add for ones inside.

thanks,
Jake
The latest build of this product (v2018.1 build 0675) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.