AccessViolationException error

B

Billy B

I have an application in C# with a form that displays webpages. There are 4
web pages with links to each other. I get an error (and not at the same
hyperlink) after navigating all the links numerous times. All the links work
so that is not the problem. The code stops on the line indicated in the code
until the error is thrown then the application has to be shut down to
continue.

namespace NewspaperSearch
{
static class Program
{
[STAThread]
static void Main(string[] args)
{
if (args.Length > 0 && args[0] == "-i")
{
//string mdf_log_Folder = Application.StartupPath;
//if (!DBExists())
// CreateDB(mdf_log_Folder);
//return;
}

Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);


***Stays on this line while navigating links
Application.Run(new frmWelcome());


}

Below is the error message that can occasionally be generated during debug:
AccessVioationException was uhandled
Attempted to read or write protected memory. This is often an indication that
other memory is corrupt.

Hope this makes sense. Thank you.
 
D

DSK Chakravarthy

One basic point that you are missing is that.. when you opening a the form
you are using NEW keyword.. you dont have to do that every time you navigate
there... once a form is created using NEW, it is resident in memory.. tryout
different methods to retrieve the existing memory foot print rather than
creating NEW on every click..

That will solve your problem

HTH
 
W

Willy Denoyette [MVP]

Billy B said:
I have an application in C# with a form that displays webpages. There are 4
web pages with links to each other. I get an error (and not at the same
hyperlink) after navigating all the links numerous times. All the links
work
so that is not the problem. The code stops on the line indicated in the
code
until the error is thrown then the application has to be shut down to
continue.

namespace NewspaperSearch
{
static class Program
{
[STAThread]
static void Main(string[] args)
{
if (args.Length > 0 && args[0] == "-i")
{
//string mdf_log_Folder = Application.StartupPath;
//if (!DBExists())
// CreateDB(mdf_log_Folder);
//return;
}

Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);


***Stays on this line while navigating links
Application.Run(new frmWelcome());


}

Below is the error message that can occasionally be generated during
debug:
AccessVioationException was uhandled
Attempted to read or write protected memory. This is often an indication
that
other memory is corrupt.

Hope this makes sense. Thank you.


The code you posted isn't of any help to point you in the right direction.
What we need is a stack trace.

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top