access-violation

AccessViolationException from System.Windows.Forms, using WinFormsHost in WPF

落爺英雄遲暮 提交于 2019-12-23 16:27:22
问题 I'm facing a nasty issue when developing a WPF/WinForms interop application. I've been trying to resolve this issue for three days, but I'm unable to make any headway. I doubt I can provide enough information to get a resolution, but I'm looking for anyone who could explain what on earth is going on here? The component I am using is AxMapControl (ESRI ArcGIS Engine 9.3.1 SP2), which as far as I know is COM-wrapped native code, exposed as a WinForms control. The component is embedded in our

Access violation exception when deleting an array

别来无恙 提交于 2019-12-23 16:00:11
问题 I'm getting "Access violation reading location" exception when deleting the allocated memory as follow. I have a native dll compiled against Visual Studio 2010(toolset: v100) C++ compiler.I have a managed dll wrapper for it which is compiled against toolset v90 as I want to target .net 2.0. The managed wrapper passes the reference to pointer (double *&myArray) to one of the native dll function call, which internally creates a dynamic array and initializes the data. However, when managed

libpng crashes on png_read_info()

。_饼干妹妹 提交于 2019-12-23 10:05:11
问题 I'm trying to read a png file using libpng 1.2.10 in vs2013. I downloaded the latest zlib and compiled pnglib, which worked fine. Now I'm trying to load a file: int *w = &width; int *h = &height; const char* name = file.c_str(); FILE *png_file = fopen(name, "rb"); if (!png_file) { std::cerr << "Could not open " + file << std::endl; return; } unsigned char header[PNG_SIG_BYTES]; fread(header, 1, PNG_SIG_BYTES, png_file); if (png_sig_cmp(header, 0, PNG_SIG_BYTES)) { std::cerr << "PNG signature

Inserting in a binary search tree access violation error

风格不统一 提交于 2019-12-23 04:35:36
问题 I am trying to insert node in a binary search tree, I am getting an access voilation error at line if(ptr->data== item) in searchNode() function. How can I remove it. I am new to debugging. I am first trying to insert few nodes and then display them using display function. During insertion the program searches for the appropriate position of the node to be inserted and then inserts it. Program simply returns if node already exists. #include<stdio.h> #include<conio.h> #include<stdlib.h> struct

c - Access violation when reading array

佐手、 提交于 2019-12-23 02:18:37
问题 I am trying to read an array of data and receiving an access violation. I can read the data from the array within the function that the array was allocated using: AllCurrentData[newLineCount].data[tabCount] = malloc(length + 1); strcpy( AllCurrentData[newLineCount].data[tabCount], buffer ); printf("%s", AllCurrentData[newLineCount].data[tabCount]); But can't read it outside of the function. This is where I get the access violation, looks like it is trying to read a null location. How can I

Gracefully handling corrupted state exceptions in .NET Core

℡╲_俬逩灬. 提交于 2019-12-22 13:49:10
问题 I have basically a duplicate question but for .NET Core. I have Core console app: class Program { static void DoSomeAccessViolation() { // if you have any questions about why this throws, // the answer is "42", of course var ptr = new IntPtr(42); Marshal.StructureToPtr(42, ptr, true); } [SecurityCritical] [HandleProcessCorruptedStateExceptions] static void Main(string[] args) { try { DoSomeAccessViolation(); } catch (Exception ex) { Console.Error.WriteLine(ex); } } } I've tried to add a

Access violation exception when use method Marshal.PtrToStructure in a loop

落爺英雄遲暮 提交于 2019-12-22 12:40:42
问题 In my program (C#), i used method Marshal.PtrToStructure to convert object add a memory address to structure in a loop. At the first element, this work normal. But at the second element, the access violation exception occurs. The access violation exception only occurs on win 7 (64 bits), it does not occur on win xp (32 bits). I don't know cause and solution for it. Please help me. Note: I use .NET Framework 3.5. Code as bellow: [StructLayout(LayoutKind.Sequential)] public struct gpc_vertex {

Tracking down a AccessViolationException in WPF

旧城冷巷雨未停 提交于 2019-12-22 11:16:27
问题 I've written a WPF application that uses many Frame controls to view camera feeds. When deployed, it crashes pretty randomly (anywhere from 2 hours to 16+ hours), and I see these in the event log, consecutively: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System

Access violation after catching dll exception

蹲街弑〆低调 提交于 2019-12-22 09:48:55
问题 I have to load modules as dlls dynamically at runtime as they are not known ahead of time, just that they conform to a class interface. What I noticed is that after I catch an exception thrown by the dll (in the main program in the main thread), the right destructors are called and the modules destroyed and dll's unloaded, but then as the } at the end of the catch block is reached by the Visual Studio C++ debugger when stepping line by line, I get another exception which crashes the program

AccessViolationException from a combo: Attempted to read or write protected memory

廉价感情. 提交于 2019-12-22 08:27:57
问题 Users are occassionally getting the above error when using our application (VB.Net, Winforms, using v2 of the framework). I'm not able to reproduce it. The callstack is as follows: : System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at System.Windows.Forms.NativeWindow.DefWndProc