An access violation (also known as segmentation fault) is generally an attempt to access memory that the CPU cannot physically address. It is often caused when attempting to access a null reference or a reference to memory that has been freed.
Questions tagged [access-violation]
1564 questions
16
votes
5 answers
Getting Segmentation Fault
I saw many questions about getting segmentation fault in C program here in SO, and I thought it would be great to have a reference to those here, a question with some cases that are causing segmentation fault. My answer is posted below.
As written…

MByD
- 135,866
- 28
- 264
- 277
15
votes
2 answers
Randomly occurring AccessViolationException in GDI+
We've got the problem that sometimes an AccessViolationException occurs and a simple group box gets drawn with white background and a red cross on top of it. We can't reproducable this bug reliably, it just occurs from time to time.
We don't do…

Steven
- 161
- 1
- 4
14
votes
1 answer
Weird Access Violation Exception
I'm puzzled with an occurance of AccessViolationException. It's quite impossible (see answer) to have a clean reproduction but here goes the general idea:
class MyClass
{
public List MyMethod(List arg)
{
// BREAKPOINT…

Jacek Gorgoń
- 3,206
- 1
- 26
- 43
13
votes
5 answers
How to solve access violation writing location error?
I have a simple program and I get access violation at *(str + start). Why? I should be able to change it. Right?
void fn()
{
char *str = "Hello wordl!";
int end = strlen(str);
int start = 0;
end--;
while(start < end)
{
…
I pra che
12
votes
4 answers
Determining the cause of AccessViolationException DragDrop.DoDragDrop
I have a WPF application that is crashing on some computers with an AccessViolationException when a drag operation is started.
The difficulty is it is only occurring on builds from our build server, and never crashes when I build locally in Visual…

Sigh
- 659
- 13
- 30
12
votes
7 answers
How to find a dangling interface that causes an AV in Delphi
I've a complex application to which I've just introduced some changes, adding a couple of new classes with interfaces and deleting some others. Functionally it all works but I get an access violation just after the Destroy procedure of a…

Brian Frost
- 13,334
- 11
- 80
- 154
11
votes
4 answers
Attempted to read or write protected memory in Oracle 11g with ODP.NET
I am developing an application that is supposed to run for long periods and make extensive usage of an Oracle (11g) database via ODP.NET.
It happens, though, that once in a while (every 2 or 3 days) a System.AccessViolationException is thrown by…

Andrea
- 884
- 1
- 10
- 23
11
votes
3 answers
Why would vkCreateSwapchainKHR result in an access violation at 0?
I'm trying to learn Vulkan by following the great tutorials from vulkan-tutorial.com but I'm having some trouble at the point where I must create the swap chain. As stated in the title, the vkCreateSwapchainKHR creates the following error: Access…

François Guthmann
- 461
- 1
- 4
- 15
11
votes
1 answer
AccessViolationException when accessing a mustoverride property in a class library
This is a little complex, but I'll try and explain clearly.
I have a class library for common code components; and I tried to make some common ConfigurationHandler base classes, to simplify creating custom configuration sections, collections and…

simonalexander2005
- 4,338
- 4
- 48
- 92
11
votes
6 answers
How to find out who's causing an access violation error?
I'm getting reports that my app is causing a GPF on some Vista machines. The error message is something like this:
access violation at 0x75784062 ( tried to write to 0x00000006)
In order to fix this, I first need to know exactly who is causing this…
Fernando
11
votes
4 answers
Why does CoUninitialize cause an error on exit?
I'm working on a C++ application to read some data from an Excel file. I've got it working, but I'm confused about one part. Here's the code (simplified to read only the first cell).
//Mostly copied from…

John M Gant
- 18,970
- 18
- 64
- 82
11
votes
0 answers
AccessViolationException while stepping through C#-Code in Visual Studio 2013 Update 2
I think i've found a bug in the debugger in Visual Studio 2013 Update 2. When i derive from an abstract class and override an abstract method which accepts a struct with two strings, the debugging session crashes with an…

Matthias
- 948
- 1
- 6
- 25
11
votes
1 answer
Occasional access violation in FastMM4, DebugGetMem
I'm trying to track down an access violation. Reproducibility seems non-deterministic, and rare, so I want to check a few of my assumptions before I go any further.
The access violation is raised in FastMM4, version 4.991, in the function…

Ian Goldby
- 5,609
- 1
- 45
- 81
10
votes
6 answers
Dynamically changing Textbox's AutoComplete List causes AccessViolationException, any advice?
My client wanted to have a textbox in the Customer form of the application, which offers the applicable endings to a started street name. He starts to type a street name and the textbox offers a list of streets which start with the char sequence he…

Qqbt
- 802
- 2
- 8
- 33
10
votes
4 answers
Access violation writing location 0xcccccccc
For the past 2 days I've been stuck on a violation which I can't seem to get to go away.
I've used break points and located where the error is, but I'm just hoping one of you will know what the issue is without me having to copy+paste all my code…

Linky
- 113
- 1
- 1
- 4