Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling C FMI method fmi3DoStep() results in System.AccessViolationException #8

Open
damian-leporis-se opened this issue Sep 30, 2024 · 1 comment

Comments

@damian-leporis-se
Copy link

damian-leporis-se commented Sep 30, 2024

I am trying to run the provided BouncingBallGif project in the .NET solution.

At Library3.cs:

 public override void Step(IntPtr handle, double currentTime, double step)
 {
   fmi3DoStep(
     handle,
     currentTime,
     step,
     FMI3.fmi3Boolean.fmi3True,
     IntPtr.Zero, 
     IntPtr.Zero, 
     IntPtr.Zero
   );
 }

I am getting error:
System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'

I had a suspicion if the dll is the correct one for my 64bit PC, I checked what private string GetLibPath(IModelVersion version, string coSimulationId) results in, and it does match:
C:\Users\MYUSERNAME\AppData\Local\Temp\Femyou\BouncingBall.fmu\binaries\x86_64-windows\BouncingBall.dll

@damian-leporis-se
Copy link
Author

This problem occurs with Reference-FMUs-0.0.34\3.0\BouncingBall.fmu in https://github.com/modelica/Reference-FMUs/releases/download/v0.0.34/Reference-FMUs-0.0.34.zip not with Reference-FMUs-0.0.34\2.0\BouncingBall.fmu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant