This is a migrated thread and some comments may be shown as answers.

Enter Key causes AccessViolationException

4 Answers 81 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 20 Dec 2010, 06:45 PM
Hi,

I have a RadMenuItem that when clicked displays a SaveFileDialog in order for the user to export and save the contents of a RadGridView. If the event handler is called due to the user hitting the Enter key then an AccessViolationException memory exception is thrown attempting to read the DialogResult property:

var saveFileDialog = new SaveFileDialog
            {
                DefaultExt = extension,
                Filter = string.Format("{0} files (*.{1})|*.{1}|All files (*.*)|*.*", format, extension),
                FilterIndex = 1
            };
  
            if (saveFileDialog.ShowDialog() == true)
            {
                using (Stream fileStream = saveFileDialog.OpenFile())
                {
                    this.GridView.Export(fileStream, new GridViewExportOptions
                    {
                        Format = format1,
                        ShowColumnFooters = true,
                        ShowColumnHeaders = true,
                        ShowGroupFooters = false
                    });
                }
            }

The if (saveFileDialog.ShowDialog() == true) produces the following exception:

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

Any ideas why this might be occuring?

Regards,
Chris

4 Answers, 1 is accepted

Sort by
0
Chris
Top achievements
Rank 1
answered on 21 Dec 2010, 03:08 PM
To add to this, it doesn't make any difference how the event handler is registered i.e. CommandBinding or simple Click handler, this behaviour is consistent and will always throw the AccessViolationException.

It does not appear this error can be handled and will always crash the application.

A fix or workaround would be greatly appreciated.

Regards,
Chris
0
George
Telerik team
answered on 23 Dec 2010, 04:26 PM
Hi Chris,

We are not aware of such issue with RadContextMenu control. Could you please give us the callstack? Also, we will greatly appreciate a sample project of yours. It will definitely help us in further pinpointing and resolving the problem. Can you attach the sample project to the support ticket?

I am glad to assist you further.

Regards,
George
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Chris
Top achievements
Rank 1
answered on 23 Dec 2010, 04:29 PM
Hi George,

We have raised a support ticket regarding this issue and I have just attached a sample project to the support ticket. I have attached it here also.

Kind Regards,
Chris

Just tried to attach, but zip files are not allowed in the forums. Please see the support ticket raised under the account for Simon Allen for the sample project.
0
Kaloyan
Telerik team
answered on 27 Dec 2010, 03:19 PM
Hi Chris,

Thanks for the cooperation and sending the project as well.

Kind regards,
Kaloyan
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
Menu
Asked by
Chris
Top achievements
Rank 1
Answers by
Chris
Top achievements
Rank 1
George
Telerik team
Kaloyan
Telerik team
Share this question
or