-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
API use in F# raises System.InvalidCastException #1882
Comments
Follow up; running in FSI I can (partially) reproduce this issue with #r "../platform/z3/bin/Microsoft.Z3.dll" The last line gives
If i substitute the variable "name" for a string I get the same error. |
This is a known bug in 4.7.1. It affects .NET APIs. |
Please could you point to a commit where this is fixed? I've pulled 8431a54 and I'm still seeing the issue. I found it whilst investigating another issue, so it would be useful if I could find a working version to see if the second problem still exists in the most recent version |
Is this a 64bit or 32bit version? C:\z3\build>fsc bh.fs /r:Microsoft.Z3.dll C:\z3\build>bh.exe |
It was a really nasty bug that got in when moving to <stdbool.h>. They use 8 bits on some platforms, but the managed wrappers expected more bits and started reading uninitialized memory. |
I've retested and I think I made a mistake in my testing due to not having recompiled Microsoft.Z3.dll. With both recompiled libz3 and the dotnet bindings I no longer see the error with either 32 or 64 bit. Sorry! |
Using both the most recent release (4.7.1) and latest build the function
let make_z3_int_var (name : string) (z : Context) = z.MkIntConst(z.MkSymbol(name))
Raises the following exception
Unhandled Exception: System.InvalidCastException: Unable to cast object of type 'Microsoft.Z3.AlgebraicNum' to type 'Microsoft.Z3.IntExpr'.
Visual studio does not flag any type errors via intellisense or in compilation.
Older versions (4.6.0) do not raise this error. Git bisect reveals the first bad commit is 76dec85
The text was updated successfully, but these errors were encountered: