GhostDoc VisualStudio extension Load exception - c#

I've formatted my harddrive to reinstall Windows 8 x64.
After installing VisualStudio 2013 and then GhostDoc extension, in the moment that I try to run the VS IDE (an VB/C# project of any kind), it throws an exception related to GhostDoc that I would like to solve:
The English translation of the error message above (that is in Spanish) is this:
Exception Source: mscorlib
Exception Type: System.IO.FileLoadException
Exception Message: Loading this assembly would produce a different grant set from other instances. (Exception from
HRESULT: 0x80131401)
I never had this problem until now.
The exception happens in GhostDoc version 4.8 and 4.9, the error seems not to be critical 'cause I'm still able to use GhostDoc after accepting the ErrorDialog, but anyways I would like to solve this 'cause I have other kind of problems, I need to install 3rd party controls/extensions silently and if I run the IDE and I get this error then just I can't install nothing 'cause it stops the execution of the IDE, so at the moment what I've did to avoid this error is editing the LoadBehavior property in the GhostDocPro.AddIn XML file, to disable the automatic loading of the extension:
<LoadBehavior>0</LoadBehavior>
Then now every time that I want to use GhostDoc I need to load it manually (see first image above), and of course I'm having the same exception, I need to solve this bug.
This is the Exception:
Detailed error information follows: Date and Time: 26/03/2014 11:55:17
IP Address: {0} OS Platform: Win32NT Processor: AMD64 OS version:
6.2.9200.0 Current user role: Administrator; User;
Allocated Memory: 51 Mb Available Physical Memory: 4096 Mb Available
Virtual Memory: 3255 Mb Total Physical Memory: 4096 Mb Total Virtual
Memory: 4096 Mb Percentage of physical memory In use: 44 %
Application Domain: DefaultDomain Product Version: 4.9.14064.0
Assembly Codebase: file:///C:/Program Files (x86)/Microsoft Visual
Studio
12.0/Common7/IDE/Extensions/SubMain/GhostDoc/1.0/SubMain.GhostDoc.Core.DLL
Assembly Version: 2.2.0.0 Assembly Build Date: 05/03/2014 1:39:38
Assembly Full Name: SubMain.GhostDoc.Core, Version=2.2.0.0,
Culture=neutral, PublicKeyToken=94c677ee32cc1929
Exception Source: mscorlib Exception Type: System.IO.FileLoadException
Exception Message: Si se carga este ensamblado, se generará un
conjunto de permisos diferente de otras instancias. (Excepción de
HRESULT: 0x80131401) Exception Target Site: CreateInstance
---- Stack Trace ---- System.AppDomain.nCreateDomain(friendlyName As String, setup As AppDomainSetup, providedSecurityInfo As Evidence,
creatorsSecurityInfo As Evidence, parentSecurityDescriptor As IntPtr)
SubMain.GhostDoc.Core.DLL: N 00000
System.AppDomainManager.CreateDomainHelper(friendlyName As String,
securityInfo As Evidence, appDomainInfo As AppDomainSetup)
SubMain.GhostDoc.Core.DLL: N 00283
System.AppDomainManager.CreateDomain(friendlyName As String,
securityInfo As Evidence, appDomainInfo As AppDomainSetup)
SubMain.GhostDoc.Core.DLL: N 00014
System.AppDomain.InternalCreateDomain(friendlyName As String,
securityInfo As Evidence, info As AppDomainSetup)
SubMain.GhostDoc.Core.DLL: N 10814956
System.AppDomain.CreateDomain(friendlyName As String, securityInfo As
Evidence, info As AppDomainSetup) SubMain.GhostDoc.Core.DLL: N 00039
A.c112f74fdd78a5b016f03ca0edba39a26.c9495450a44f85fef6ae7cb241984a67a(
As String, As Evidence, As AppDomainSetup)
SubMain.GhostDoc.Core.DLL: N 00023
SubMain.Core.Utils.RemoteLoader.cc3c5bc8929eea714ac8c7a330d95ac0b( As
String) SubMain.GhostDoc.Core.DLL: N 00142
Loaded assemblies: Assembly Name: mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089 Assembly Location:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll
More info ...
( The full stack trace is here )
Any ideas about the System.IO.FileLoadException exception that I'm facing?
PS: If someone is thinking why I'm posting this issue here in StackOverflow instead of contacting to GhostDoc team, well I've sent the bug to GhostDoc Developers but I remember that they didn't wanted to helped me in other StackOverFlow post (that was not related to any bug, was a very simple question about how to uninstall their product in X circunstances), so I really don't expect any help from GhostDoc team to solve this in StackOverflow and maybe (only maybe) I could have more choices to solve this issue with the help of other users that maybe has the same issue.

Try the following:
To add an assembly to the fully trusted assembly list (taken from here)
In the .NET Framework 1.0 and 1.1, at the command line, type
%Systemroot%\Microsoft.NET\Framework\versionNumber\Mscorcfg.msc. In
the .NET Framework 2.0, start the SDK Command Prompt and type
mscorcfg.msc.
The user interface for the tool is displayed.
Expand the Runtime Security Policy node.
Expand the node for the policy level you want to add the new assembly to.
Right-click Policy Assemblies and choose Add.
Select the assembly name from the list that appears. These are the assemblies that are in the global assembly cache.
Click Select.

Related

Could not load file or assembly 'WebDriver, Version=2.53.1.0 when using coded UI Testing

Since today I get the following new Error message:
System.IO.FileLoadException: Could not load file or assembly 'WebDriver, Version=2.53.1.0, Culture=neutral, PublicKeyToken=1c2bd1631853048f' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044) ---> System.IO.FileLoadException: A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)
Everything worked fine until yesterday and now I lost 6 out of my 7 test VMs to this error.
I read every documentation I could find and tried to compare the non working VMs with the the non working version and could not find a difference.
Suspicious is the Version=2.53.1.0 as the current WebDriver DLL is 4.4.0. Where could the reference to this potential old DLL come from?
Is there a debug or logging option I could activate? A way to see which DLLs are loaded?
Needless to say that with only 1 out of 7 Testmachines we will not be able to meet the deadline.
Got it. It's the other way around. I must not use a new version. I must use an old 2.53 version.
The update must have slipped in because I can't remember updating them consciously.
For those who have similar problems: Extract the content of selenium-dotnet-strongnamed-2.53.1.zip into C:\Program Files (x86)\Common Files\microsoft shared\VSTT\Cross Browser Selenium Components\
Adjust destination directory if you have an unusual Windows installation.

Make an installer for my own version of missionplanner (open source project in win form)

I am making my own version of an open source project call Mission Planner (it's an app that allows to control many types of drone so I configured it to be more effictient for my drones). I am now trying to build an installer for my new app but I am struggling with some aspects.
Here's what I did so far.
Create a new setup project in the same solution, in the app folder I had a project output (the assembly appears on it's own), i created two shortcuts, on for the desktop and the other for the programs menu. Then i modified the different parameters (name, url, manufacturer etc...). Then I cleaned the solution, built the installer (everything was ok) and then I right-clicked and selected the "install". Everything was okay, I had my shortcut on the desktop and program menu.
BUT
When I try to execute the app it does not work, here is the error I have in the output window :
System.TypeInitializationException: The type initializer for
'MissionPlanner.MainV2' threw an exception. --->
System.BadImageFormatException: Could not load file or assembly
'System.ValueTuple, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. Reference
assemblies should not be loaded for execution. They can only be
loaded in the Reflection-only loader context. (Exception from HRESULT:
0x80131058) ---> System.BadImageFormatException: Cannot load a
reference assembly for execution. --- End of inner exception stack
trace --- at MissionPlanner.MAVLinkInterface..ctor() at
MissionPlanner.MainV2..cctor() --- End of inner exception stack
trace --- at MissionPlanner.MainV2..ctor() at
MissionPlanner.Program.Start(String[] args)
So if anyone knows what this means I would be glad to know what is going on and if there's any solution to fix this.
BadImageFormatException occurs if you try to load a 64 bit DLL into a 32 bit process or vice versa. Make sure you ship 64 DLLs only or 32 bit DLLs only.
The name of the exception has nothing to do with pictures. Microsoft calls PE (Portable Executable) files images.

BadImageFormat Exception at Microsoft.CSharp library

I'm having little problem running my C# application after switching to Windows 8.1 from 8.
The problem is that I get this exception from title and there's not much help online. I tried to pinpoint the problem and it seems like my x64 application is trying to call x86 CSharp library. The reference in project leads to a DLL file, that upon calling x64 dumpbin program with /headers parameter outputs:
Dump of file Microsoft.CSharp.dll
PE signature found
File Type: DLL
FILE HEADER VALUES
14C machine (x86)
3 number of sections
4FFA5C64 time date stamp Mon Jul 09 06:21:56 2012
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
2022 characteristics
Executable
Application can handle large (>2GB) addresses
DLL
Notice the machine is x86, while the application is running in x64 (checked with Environment.Is64BitProcess). This might be the problem I'm facing, however I can't find way to solve it - there seems to be no x64 .Net libraries installed. The only ones I have found are at: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework. Or maybe I'm completely off and there's some other problem. Anyway the exception occurs at startup in one of constructors and full detail is:
Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
"Could not load file or assembly 'Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The module was expected to contain an assembly manifest."
Edit:
While still panicking, I solved this by downloading CSharp.dll and replacing the dummy 0-byte file in path shown in answer by it.
The module was expected to contain an assembly manifest
You've been looking at a reference assembly, it is not the one that's actually loaded when you run your program. Microsoft.CSharp.dll is stored in the GAC, put there by the .NET installer. You can see the file by navigating to c:\windows\microsoft.net\assembly\gac_msil\microsoft.csharp. Keep clicking until you get to the file.
The exception message is a very unhealthy one, it doesn't recognize the DLL as a .NET assembly. There are few decent explanations for that, other than the file being corrupted. File corruption is always bad news, a strong hint that your hard-disk is failing. You'll need to get it fixed, follow-up if necessary at superuser.com

Why can't my application find a dependent dll in the same directory?

I have a simple console test application, ConsoleApplication1.exe, which references another assembly clipper.dll.
On 3 machines that I've tested it on, it is possible to place both files in e.g. c:\test\, and execute ConsoleApplication1.exe.
On one other machine, which happens to be a client machine, running ConsoleApplication1.exe results in a program crash and the following being printed to the console:
C:\test>dir
Volume in drive C has no label.
Volume Serial Number is 7C46-414F
Directory of C:\test
07/12/2010 06:08 PM <DIR> .
07/12/2010 06:08 PM <DIR> ..
07/12/2010 05:13 PM 11,776 ClassLibrary1.dll
07/12/2010 05:13 PM 30,208 ClassLibrary1.pdb
07/12/2010 04:55 PM 3,572 ClassLibrary1.tlb
19/11/2010 02:46 PM 235,008 clipper.dll
19/11/2010 02:46 PM 1,534,976 clipper.pdb
07/12/2010 05:13 PM 6,144 ConsoleApplication1.exe
07/12/2010 05:13 PM 11,776 ConsoleApplication1.pdb
01/08/2010 12:52 PM 139,264 nunit.core.dll
01/08/2010 06:41 AM 57,344 nunit.core.interfaces.dll
01/08/2010 06:41 AM 135,168 nunit.framework.dll
01/08/2010 06:41 AM 547,262 nunit.framework.xml
11 File(s) 2,712,498 bytes
2 Dir(s) 477,821,784,064 bytes free
C:\test>ConsoleApplication1.exe
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass
embly 'clipper.dll' or one of its dependencies. The specified module could not b
e found.
at ConsoleApplication1.Program.Main(String[] args)
This is a odd to me, although I don't understand dll load rules comprehensively I thought it would search the CWD for the specified file. And the fact this same setup works on the various other computers I've tried is also odd.
Curiously, on a working computer if I remove clipper.dll and then run it:
C:\Temp>ConsoleApplication1.exe
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass
embly 'clipper, Version=1.0.3975.26584, Culture=neutral, PublicKeyToken=null' or
one of its dependencies. The system cannot find the file specified.
at ConsoleApplication1.Program.Main(String[] args)
The unhandled exception is slightly different, with a full assembly name.
Both ConsoleApplication1.exe and clipper.dll are built for .NET 4.
All machines have the .NET 4 runtime installed. The problem machine does not have the .NET sdk
clipper.dll is a combination of ummanaged c++ code and C++/CLI. It is a suspicious character because it is basically the first C++/CLI .NET assembly I have created and much fumbling was involved. It seems to load in reflector fine.
These efforts came about when I was trying to figure out why I was unable to successfully utilise a COM object (call it foo.dll) which also referenced clipper.dll - all also on the same problem machine. After several hours of regasm hell I was able to further isolate it to this.
or one of its dependencies
Did you deploy the CRT runtime DLLs on that machine? Make sure to deploy the Release build of your assembly. The debug version of the CRT is not redistributable.
I don't know why it happed to u, but if you will copy the dll to system32 directory it will lead to 2 option
1) It will work
2) It won't work and that way you will know it doesn't relate to the dll path
Make sure to include the C++ runtime Libraries (CRT) on your client machine.
Well , there may be lot of reasons
These efforts came about when I was trying to figure out why I was unable to successfully utilise a COM object (call it foo.dll) which also referenced clipper.dll - all also on the same problem machine. After several hours of regasm hell I was able to further isolate it to this.
is the COM object (foo.dll) registered on the troubled computer?
Please remove pdbs from the installation folder also.
Are your application files downloaded from the internet? I once had the same problem where my program was downloaded in a zip file, and then extracted on the client machine. Once extracted I was getting exactly the same error message "The specified module could not b
e found."
It turned out to be Windows security policy for files downloaded from the internet. Windows will "block" downloaded files, and they need to be unblocked manually. In my case, I needed to right click on the file, select properties and then select "unblock", my application was then able to load the assembly as normal.
http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=mpe&DownloadId=163767
Alternatively you can unblock the zip file before extracting it, and then all extracted files will also be unblocked.

FileNotFoundException thrown when calling Assembly.GetExportedTypes()

I'm getting this error when running a .net 2.0 app on a stripped-down XP SP3 x86 virtual machine, even if .net 2.0 framework runtime has already been installed prior to installing the app.
Exception Source: mscorlib
Exception Type: System.IO.FileNotFoundException
Exception Message: Could not load file or assembly 'WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Exception Target Site: GetExportedTypes
---- Stack Trace ----
System.Reflection.Assembly.GetExportedTypes()
XSplit.Core.exe: N 00000
XSplit.Core.Capture.ChannelAddinManager.#Dm( As String)
XSplit.Core.exe: N 00105
XSplit.Core.Capture.ChannelAddinManager.#Cm()
XSplit.Core.exe: N 00265
XSplit.Core.Capture.ChannelAddinManager.Init(path As String, host As IAddinHost)
XSplit.Core.exe: N 00104
XSplit.Core.frmLogin.InitializeAddinComponent()
XSplit.Core.exe: N 00534
XSplit.Core.frmLogin..ctor(args As String[])
XSplit.Core.exe: N 01263
The related code that spawns this error is this
var assembly = Assembly.LoadFrom(dllFile);
var assemblyTypes = assembly.GetExportedTypes();
Even after installing framework 2.0 sp2, this error is still thrown.
You guys got any clue on why this is?
The WindowsBase assembly didn't become available until .NET 3.0. If you want to run this code without an exception then you'll need to install 3.0 on the machine, 2.0 isn't good enough. Check the build settings for the add-in project and make sure that it doesn't reference any WPF assemblies.

Categories