|
|
I am catching an exception, and attempting to call out to get the exception pointers in a 32-bit space. This always returns IntPtr.Zero.
When running through 64-bit this returns the propers exception pointers.
Has anyone experienced this or have a possible resolution? I have checked MSDN, nothing of value for this particular scenario. I have googled this but have found nothing helpful as of yet. It does appear there may be solutions in other languages, but I am stuck in C# land and cannot use the others.
Thank you all too much
|
|
|
|
|
Hello. I was given a small project which compiles and runs successfully in Windows 7. I also tested the project on Windows 7. But as soon as I tried to run the project on Windows 8.1, it started giving me said exception.
This definitely is not a programming error. This has something to do with system setting which I can not find out. Here is the code in which exception occurs (calling method is fine) . . .
public static void* Alloc(int size)
{
try
{
static int ph = GetProcessHeap();
void* result = HeapAlloc(ph, HEAP_ZERO_MEMORY, size);
if (result == null)
{
throw new OutOfMemoryException();
}
return result;
}
catch(Exception ex)
{ }
return null;
}
[DllImport("kernel32")]
static extern int GetProcessHeap();
[DllImport("kernel32")]
static extern void* HeapAlloc(int hHeap, int flags, int size);
What could be wrong ?? Thanks for any pointer.
modified 6-Jan-15 4:02am.
|
|
|
|
|
Seeing the statement that causes the error might help. Have you tried the debugger?
|
|
|
|
|
Django_Untaken wrote: This definitely is not a programming error. Most likely it is a programming error, but without seeing the code it's impossible to guess where. Please edit your question and show the code extract where the error occurs, along with the values of the variables that are involved.
|
|
|
|
|
Your question is impossible to answer without knowing what the code is supposed to be doing when it explodes and showing the relevant code.
Most likely this IS a programming error because the code is making a certain assumption about what it can get away with doing under Windows 7 and it can't get away with it under Windows 8.x.
|
|
|
|
|
Django_Untaken wrote: What could be wrong ??
What user do you use on 7.1? What user do you use on 8.1?
How do you run it on the different systems? For example do you install it on both using an installer using default values and then run via that?
|
|
|
|
|
The following code is definitely a programming error and will lead to all sorts of complications:
catch (Exception ex)
{ }
return null;
If an exception occurs it is ignored and the method returns null to the caller, which will probably lead to an access violation.
|
|
|
|
|
Exception is occurring in this method NOT the calling method. Same code is running fine on Windows 7. What happens in Windows 8.1? How do I diagnose this problem ?
|
|
|
|
|
Django_Untaken wrote: Exception is occurring in this method Where, and what are the exact details?
Django_Untaken wrote: Same code is running fine on Windows 7 If the above is an example of the code in this application then I suspect there may be any number of bugs waiting to be found.
|
|
|
|
|
The easiest way is to run the code under the debugger on Win8.
|
|
|
|
|
Aside from the obvious problem of catching and ignoring all exceptions, your P/Invoke declarations are wrong. I suspect the computer that's working is 32-bit, the one that's failing is 64-bit, and your application is compiled as "AnyCPU".
The correct declarations should be:
[DllImport("kernel32.dll")]
static extern IntPtr GetProcessHeap();
[DllImport("kernel32.dll")]
static extern void* HeapAlloc(IntPtr hHeap, uint dwFlags, UIntPtr dwBytes);
(Note the use of IntPtr and UIntPtr instead of int .)
http://pinvoke.net/default.aspx/kernel32/GetProcessHeap.html[^]
http://pinvoke.net/default.aspx/kernel32/HeapAlloc.html[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I'm using Visual Studio 2012 , is there any way i could get the metro UI for developing Windows Application using C#.
Please note that i need to create a windows application not Windows store App.
Please guide.
|
|
|
|
|
Well, there are some open-source projects, and some commercial components, that simulate the Metro UI for WinForms: [^].
«A man will be imprisoned in a room with a door that's unlocked and opens inwards ... as long as it does not occur to him to pull rather than push» Wittgenstein
|
|
|
|
|
|
And what's best is the free one is in VB.
/ravi
|
|
|
|
|
Why shouldn't i try that. is there an issue or something.
Coz i thought that we could make our form look much more professional when compared.
|
|
|
|
|
In my humble opinion, Metro isn't professional. I don't know of 2 people in the same room that like it.
|
|
|
|
|
Can u suggest me an alternative method to make my form look profesional.
|
|
|
|
|
|
no other Way other than that..
|
|
|
|
|
Really, how is anyone supposed to answer that question where we know nothing about your app or what your skill set is or what your app even looks like now?
|
|
|
|
|
If you need it looks like professional, you must need a professional to do it. If you really want to do it by yourself, then, third party UI controls like Telerik, Dev Express are the best solution.
|
|
|
|
|
|
I tried that , i think the .dll files in those are missing.
If u come to know any of the working the solution would like to know.
Thank you so much.
|
|
|
|