.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

AccessViolationException

Posted By:      Posted Date: September 26, 2010    Points: 0   Category :ASP.Net
 

I am getting this exception on my staging server (IIS6).  The same code runs well in my local Visual Studio's ASP.NET Development Server.  Here is my classes in question.  It looks like the proxy returns null when retrieving the SiteID.  Thanks for your help.

public abstract class ApplicationController : Controller
    {
        private IRepository _Repository = new Repository();
        private Site _currentSite =null;

        // property
        public Repository ApplicaitonRepository
        {
            get { return (Repository)_vetsRepository; }
        }

        public Site CurrentSite
        {
            get { return _currentSite; }
        }

        public ApplicationController()
        {
        &nbs


View Complete Post


More Related Resource Links

Crystal Report gives System.AccessViolationException: Attempted to read or write protected memory. T

  

when a crystal report for same id is opened again at same time or refreshed then it gives the

"System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."


Stack Trace is :-


Stack Trace:

[AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.]
CrystalDecisions.ReportAppServer.Controllers.DatabaseControllerClass.SetConnectionInfos(ConnectionInfos ConnectionInfos) +0
CrystalDecisions.CrystalReports.Engine.Table.ApplyLogOnInfo(TableLogOnInfo logonInfo) +362
CrystalDecisions.CrystalReports.Engine.ReportDocument.SetTableLogon(Tables tables, String user, String password, String server, String database, Boolean ignoreCase) +258
CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDatabaseLogon(String user, String password, String server, String database, Boolean ignoreCase) +204
CrystalDecisions.

pretty often: System.AccessViolationException

  
I really do not know what to do about this. Often, when I run Forms programs with Visual Studio the application crashes with an exception like this "AccessViolationException". I never exerienced any problems with other standard applications like e.g. Word, Excel, Outlook, only self written programs in C# seem to suffer from this. Most of these applications then contain either something like a ToolStrip or a DataGrid which then after an exception like this are only represented by a white rectangle with a red X. The controls itself are standard out of the box.I ran the Microsoft Memory Diagnostic today, but it did not find anything wrong with my memory. Does anybody has an idea what may cause this exception?     See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ************** Exception Text **************System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.   at System.Drawing.SafeNativeMethods.Gdip.GdipDrawLineI(HandleRef graphics, HandleRef pen, Int32 x1, Int32 y1, Int32 x2, Int32 y2)   at System.Drawing.Graphics.DrawLine(Pen pen, Int32 x1, Int32 y1, Int32 x2, Int32 y2)   at System.Windows.Forms.DataGridViewCell.PaintBorder(Graphics graphics, Rectangle clipBounds, Rectangle bounds, DataGridViewCellStyle cellStyle, DataGridViewAdv

'System.AccessViolationException' Unmanaged Dll

  
The situation isn't as clear cut as the previous posts (by other people) make it to be. My case differs because of the following:

I have a C# application calling a Native C++ DLL via PInvoke.
The symptoms of the problem are as follows:
If I run the code, nothing breaks (Press F5).
If I run the code and hitting a breakpoint in the code, subsequently running the code again (Press F5), nothing breaks.

Basically I can always run the code and traverse via F5.

If I run the code and hit a breakpoint in the unmanaged area, when I subseqently step through (press F10, or F11) I get:
First-chance exception at 0x0926f77b in <Program Name>: 0xC0000005: Access violation.
First-chance exception at 0x739a5015 (mscorwks.dll) in <Program Name>: 0xC0000005: Access violation reading location 0x0926f77b.
First-chance exception at 0x739a5015 (mscorwks.dll) in <Program Name>: 0xC0000005: Access violation reading location 0x0926f77b.
The thread 'Win32 Thread' (0x1604) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0xf00) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x12b4) has exited with code 0 (0x0).
A first chance exception of type 'System.AccessViolationException' occurred in <Program Name>

Additional information: Attempted to read or write protect

'System.AccessViolationException' occurred in System.Windows.Forms.dll immediately before entering

  

<p>Win7 64 bit; fully patched VS2008 targeting FW2.0; VB.Net; running in Debug Mode (not tested in Release mode)</p>
<p>I have a resonably complex app which I am refactoring a bit. As part of that, I relocated some code from a subroutine into&nbsp;a Click Event Handler. The Event Handler will, late in the handler, call the, reduced in function, subroutine. The point of this is that all changes to the code occur in the Event Handler and the routine it calls. Simple right?</p>
<p>Now when I click the button associated with the modified Handler I get:</p>

<p>A first chance exception of type 'System.AccessViolationException' occurred in System.Windows.Forms.dll<br />With Error System.AccessViolationException Attempted to read or write protected memory. This is often an indication that other memory is corrupt.</p>
<p>at MusicManager2009.frmMain2.cmdLoadAlbum_Click(Object sender, EventArgs e)</p>
<p>at System.Windows.Forms.Control.OnClick(EventArgs e)</p>
<p>at System.Windows.Forms.Button.OnClick(EventArgs e)</p>
<p>at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)</p>
<p>at System.Windows.Forms.Control.WmMouseUp(Message&amp; m, MouseButtons button, Int32 clicks)</p>
<p>at System.Windows.For

AccessViolationException with C# Ping class

  

I have a "watchdog" program, c# console application, coded with VS 2005. 

Program runs every 3 minutes. And one part of program checks pings to ~20 ip's. I'll give that function code:

static private bool ping(ref String ip) {

bool success = false;

Ping pingSender = new Ping();

if (pingSender.Send(ip).Status.Equals(IPStatus.Success)) {

success = true;

}

else

{

success = false;

}

AccessViolationException when client is terminated

  
Hi,

We have just migrated our client/server application to .Net 2.0. After that we constant get an unhandled AccessViolationException in the server program when the client program is terminated!

The only stack trace I can get is:

at
System.Net.UnsafeNclNativeMethods.OSSOCK.WSAGetOverlappedResult(SafeCloseSocket
socketHandle, IntPtr overlapped, UInt32& bytesTransferred, Boolean wait,
IntPtr ignored)
   at
System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32
errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
   at
System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32
errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)


In the event log on the server the following is logged:

Faulting application MyModule.exe, version 1.1.1.30099, stamp 439eec16, faulting module nl_lsp.dll, version 0.0.0.0, stamp 406ae2c2, debug? 0, fault address 0x000049fd.


The client and server are communication using .Net Remoting, and we do not have any other socket communication. Also, the server does not use any 3rd party code.

Everything worked fine before we migrated.

Thanks for any help you can provide...


Moving from .NET 3.5 to 4.0: A first chance exception of type 'System.AccessViolationException' oc

  

I'm trying to upgrade my web app from 3.5 to the 4.0 Framework but keep seeing this error when trying to build the solution. The problem is with some code that's in my App_Code directory (that runs on Application_Start), and the error tells me that the class in the App_Code directory is pointing to an older version of the Oracle.DataAccess.Dll... however using Process Explorer I can't see any references to the older DataAccess DLL after updating all references to the newer Oracle DLL

Is there some way to assure the code in my App_Code directory is using the newer version of Oracle.DataAccess? Any suggestions are welcomed. Thanks

 


"System.AccessViolationException" exception reason

  

Hi,

I have s .Net application in which occosionally I receive following exception:

"Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Name:<application>.exe
There are no context policies."

I need to know why this exception is raised? 

Thanks


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend