• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

C# and SimConnect problem

Messages
13
Country
armenia
I'm using SimConnect Acceleration version SDK and Visual Studio 2008.

I try to compile some simconnect application with Visual C++, all is ok.

But with Visual C# I have problem. I create simple Visual C# Application Form, clear form compiling good.But when I'm adding SimConnect reference, and writing simple connection with SimConnect, application is not compiling, he say.

Could not load file or assembly 'Microsoft.FlightSimulator.SimConnect, Version=10.0.61242.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

I'm searched in internet and find similiar problems, but I can't find my problem solution. I check my .Net framework, i think all is ok.

Thank you, Tigran
 
Last edited:
This is not the dotNET framework but SimConnect with FSX. Have you added a reference to the managed SimConnect Library to your C# project?
 
Can you see the reference in the Solution Explorer:

Code:
[yourSolution]
   [yourProject]
      [References]
         Microsoft.FlightSimulator.SimConnect
         ...

Cheers,
Thomas
 
OK is this error raised by the compiler (at compile time) or when you try to run your application?
 
I'm using SimConnect Acceleration version SDK and Visual Studio 2008.

I try to compile some simconnect application with Visual C++, all is ok.

But with Visual C# I have problem. I create simple Visual C# Application Form, clear form compiling good.But when I'm adding SimConnect reference, and writing simple connection with SimConnect, application is not compiling, he say.



I'm searched in internet and find similiar problems, but I can't find my problem solution. I check my .Net framework, i think all is ok.

Thank you, Tigran

I'm using SimConnect Acceleration version SDK and Visual Studio 2008.



Could not load file or assembly 'Microsoft.FlightSimulator.SimConnect, Version=10.0.61242.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

--------------------------------------

Just to make sure you appreciate, the Simconnect.dll version that the error message is complaining about is the SP1 dll.
( You say you are compiling for Xpack )

It is my understanding that should be OK, if the clinet running your prpogram has updated to SP1, SP2, or Xpack, in which case the SP1 version of Simconnect.dll should be available.

If however, the clinet is running the original RTM version ( DVD) of FSX, then one would expect this error, as the SP1 simconnect.dll would not be on their system.

Maybe look in C:\Windows\winSxS to see what Flight Simulator files are there.

ie

C:\WINDOWS\WinSxS\x86_Microsoft.FlightSimulator.Si mConnect_67c7c14424d61b5b_10.0.61242.0_x-ww_35e8ee9a
 
ok. In directory I'm search for simconnect word. I found some dirs and files. Please see in attachment.
First Simconnect.dll version is 10.0.60905.0 and locating in x86_Microsoft.FlightSimulator.SimConnect_67c7c14424d61b5b_10.0.60905.0_x-ww_429211E9 directory.
Second Simconnect.dll version is 10.0.61357.0 and locating in directory x86_Microsoft.FlightSimulator.SimConnect_67c7c14424d61b5b_10.0.61242.0_x-ww_35E8EE9A.
Third Simconnect.dll version 10.0.61637.0 is and locating in directory x86_Microsoft.FlightSimulator.SimConnect_67c7c14424d61b5b_10.0.61259.0_x-ww_FB842F5A


P.S. My windows is x64, it's normal that here x86?
 

Attachments

  • screen.JPG
    screen.JPG
    41.7 KB · Views: 1,119
If problem from this. Can anyone upload correct versions?

From your screenshot, you alreadt appear to have all 3 versions of simconnect.dll installed on your PC

RTM (original) 60905,
SP1 61242,
SP2/Xpack 61259

However, if you want to re-install them, it might be better to Re-install the FSX SDKs, rather than getting odd files from others.

You will have to start with the one on the DVD, and then once that is installed, it will allow you to update.

As you go through the updates .. RTM, SP1, SP2/XPACK, the correct simconnect.dll entries will be put on your computer.
 
Last edited:
Hi TokTik,

Did you have any version of the .Net framework installed when you installed the FSX SDK? If not, then the managed client library wasn't installed into the GAC (because it didn't exist at the time). Try rerunning the SimConnect portion of the install: find the SimConnect.msi file under the SDK subdir - don't have one handy to look at, so can't tell you where it is - and double click it, this will reinstall the SimConnect client libraries on your machine - this can also be used to install SimConnect client libs on other machines so you can run SimConnect clients on other networked computers.
 
61242 looks installed in your side by side folder based on your screenshot, yet that version doesn't ring a bell with me as to which release of simconnect that is - perhaps the first service pack?

On your question of x86 on 64 bit vista, there is no 64 bit version of simconnect so you will only see the x86 32 bit side by sides. That is normal, and matches what I have on my Vista 64 box.

Regardless, the error you are getting points to a side by side shared library load error, indicating the client is probably not installed correctly or that the .NET library you are referencing is old. The .NET assembly must match the runtime DLL in the side by side folder as it creates a manifest dependency for it.

Steps I would try:
1) Run the simclient.msi version of the specific target FSX SDK you want your program to run against.
2) Remove the referenced .NET assembly from your project, add it again after you've run the client install.
3) See if dependency walker will load your compiled .exe. That will verify your manifest as well.
4) read my post on simconnect dlls started by Heli on this forum to see if anything in there helps.

Cheers,

Etienne
 
Thanks for advanced reply. I read all... No fixed :( Compiling is go fine. exe is created, but he is not run. I think problem with manifest... How to fix?
 
Last edited:
Ziporama, I'm first time hear about dependecy walker, and I downloaded this programm, now I open my application started. And get some DLLs. You mean this screenshot?
a98bc59c68a3.jpg
 
Last edited:
Very good, looks like your assembly finds all it needs to run.

The next step is to load the simconnect.dll file in Dependency walker and see if it's missing anything.

Also, since you have the SDK, can you run the examples in the SDK, such as, the AI Traffic program? Can you load that in Dependency Walker?

Thanks,

Zip
 
I compile the managed data request example, and I have now other problem.
When compiles finished, he try to execute program and gives this error

Code:
An unhandled exception of type 'System.ComponentModel.Win32Exception' occurred in System.Windows.Forms.dll

Additional information: Error creating window handle.

But when I execute the compiled exe file from explorer, he gives this error. Same error "Could not load file or assembly 'Microsoft.FlightSimulator.SimConnect,....."

Screenshot:
69d523fffc76.jpg


And this is details
Code:
See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.FlightSimulator.SimConnect, Version=10.0.61259.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.FlightSimulator.SimConnect, Version=10.0.61259.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
   at Managed_Data_Request.Form1.DefWndProc(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].



************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
----------------------------------------
Managed Data Request
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20Games/Microsoft%20Flight%20Simulator%20X%20SDK/SDK/Core%20Utilities%20Kit/SimConnect%20SDK/Samples/Managed%20Data%20Request/Managed%20Data%20Request/bin/Release/Managed%20Data%20Request.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

This is dependecy walker screenshot.
4e4a4e210f52.jpg
 
Thanks for the screenshots, this is very odd.

On the win32 handle error, it may simply be that you cannot get a handle to simconnect, which would happen on the first connect call. Because the underlying marshalling expects to get a valid handle, you may get an invalid handle exception if the call fails, that is expected.

I propose a few ideas, in order of testing:

Can you verify that your c:\windows\winsxs folder contains the following folder:

x86_Microsoft.FlightSimulator.SimConnect_67c7c14424d61b5b_10.0.61259.0_x-ww_fb842f5a

Can you also verify that the contents of this folder are:

SimConnect.dll

and if you right-click on this file, its version properties come up as 10.0.61637.0? If you do not see a file in there, something is incorrect about your client installation, and you may have to re-install the client using simconnect.msi provided in the SDK.

Then, load simconnect.dll inside dependency walker, and see if you're missing any of the dependent Microsoft C++ 8.0 libraries (that would be the C++ libraries included with Visual Studio 2005). It may very well be that simmconnect.dll is the right version, but it itself has a dependency on a library you do not have installed. The error would be exactly the same as the outcome is the same - the dll won't load. If that's the problem, you'll need to re-install the VS2005 C++ runtime library on your system. I believe that you can download those from MSDN. The library in question should be msvcr80.dll in dependency walker. Incidentally, that library is also in the side by side windows folder.

The other thing I suspect may be a problem is your GAC. If you open windows explorer, go to the folder c:\windows\assembly, do you see any entries for Simconnect? If so, you can try removing them (delete key) to force the side by side version to be loaded instead.

The reason you may have a problem is that the GAC may interfere with the lookup.

Another thing to try is to locate the simconnect.dll from the winSxS folder, and place a copy in the same folder as your .exe, then use Interop in .NET to call the win32 loadlibrary() function to load the simconnect.dll from a specific location in your process space. When you do this, the .NET layer will know your EXE has already loaded the dll.

I'm running out of ideas if none of these things work :)

Good luck, these dependency issues are annoying!
 
Back
Top