Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Created attachment 4773 [details]
Source code that shows the bug
I have a program that works correctly under .Net 3.5. However, under Mono valid values in a function call become zero in the called routine. An example of the failure is attached.
In the example, the function test.Function takes 7 parameters. The first 3 and last 1 retain their value correctly after the call. However, the other three (IntPtr, int, int) all become zero.
This works for me with mono master and 3.2.1 and 2.10.9. Maybe it's architecture specific. Could you provide more details?
I'm running on a Centos 6.3 system with Mono 3.2.1 and Monodevelop 4.0.12. Is there a difference between Mono and Mono Master?
What is the output of mono --version ?
What is the complete output of mono --version ? I.e. architecture, used gc, etc. ?
[root@PER720-CENTOS-1 ~]# mono --version
Mono JIT compiler version 3.2.1 (tarball Wed Aug 21 01:39:24 PDT 2013)
Copyright (C) 2002-2012 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
LLVM: supported, not enabled.
How does the testcase fail ? Does the Marshal.FreeHGlobal () line throw a NullReferenceException ?
No. It's not a null refernce. All parameters are passed by value and the values become zero. So the function just doesn't work. What I did was set a breakpoint at the call and verify that all parameter values were correct. Then I stepped into the function and checked the values again. Some of them were wrong. I could then go back and fourth in the stack to the calling and called functions. Parameters were still correct when calling, but still incorrect when receiving.
So this only happens when running under the debugger ?
Perhaps that's the case. I'll run some tests and cancel the bug report if it works outside of the debugger.
The issue turned out to be a problem in Monodevelop. Even in the debugger, if I don't stop and query the variables, the program works.