Double.MaxValue crashes mixed Native/C# application -
we have problem application crashing when calls method uses double.maxvalue
. true running in debugger in release version, , happens under 32-bit xp under 64-bit win 7.
if in debugger have breakpoint on line calling method using double.maxvalue
, attempt execute method (f11, f10, f5) stop application friendly windows message has caused problem , needs terminated.
replacing double.maxvalue 9999999999 - ok our application - makes problem go away. looking @ il, literally changes constant.
the c# classes being called native code via little c++ mixed mode bridge has native , managed part. our first idea native part might have destroyed managed memory areas - after replacing maxvalue 9999999999 application runs fine, , happily jumps , forth between native , managed part.
we don't deliver trial & error software customer, , love hear ideas going on??
--edit--
here cut-down version of bridge still crashes:
#include <stdio.h> #include <tchar.h> #include <vcclr.h> // ------------------------------------------------------------- // managed // ------------------------------------------------------------- #pragma managed using namespace system; using namespace ourcompany::tools; // action move text window __int32 aktiontextfenstermove (__int32 i32hncteil, __int32 i32ansicht, void* pvoid) { return guemanagedwrapper::textfensterverschieben (i32hncteil, i32ansicht, nullptr); } // ------------------------------------------------------------- // native // ------------------------------------------------------------- #pragma unmanaged #define dllexport __declspec(dllexport) extern "c" { // action move text window dllexport __int32 guenmbridgetextfenstermove (__int32 i32hncteil, __int32 i32ansicht, void* pvoid) { return aktiontextfenstermove (i32hncteil, i32ansicht, pvoid);
} }
---edit 2---
...and here c# code:
public static class guemanagedwrapper { public static int32 textfensterverschieben (int32 i32hncteil, int32 i32ansicht, fizzbuzz fzzbzz) { fzzbzz= new fizzbuzz(); fzzbzz.fd = double.maxvalue; return 0; } } public class fizzbuzz { public double fd; }
this crashes; replacing double.maxvalue
9999999999 fixes crash.
i had same problem. visual express 2010 c#
double afunction() { console.writeline("afunction called"); if (condition) { return somedoublevalue; } .... if (condition) { return double.maxvalue; } return 0; }
crashed stackoverflow, whenever afunction() called (before console message). replacing double.maxvalue double literal solved problem
Comments
Post a Comment