Skip to main content

Microsoft Silverlight

Answered Question Alert message show excepton RSS Feed

(0)

satyajit.appot
satyajit...

Member

Member

85 points

40 Posts

Alert message show excepton

hello Friends

   Can any body tell me the reason :

   In silverlight 2.0 when we press enter above any Alert message or MessageBox.Show then it would be sometime show excepton

   The Exception is : "Exception of type 'System.ExecutionEngineException' was thrown."

   How to solve this Problem ?

  Thanks

 

HarshBardhan
HarshBar...

Star

Star

9908 points

1,719 Posts

Re: Alert message show excepton

 Can you provide code to reproduce this issue.

Mark as answer if this post answered your question.

Harsh Bardhan

Jonathan Shen – MSFT
Jonathan...

All-Star

All-Star

24939 points

2,425 Posts

Microsoft
Answered Question

Re: Alert message show excepton

Hi Satyajit,

I guess you call this on its KeyDown event.   Please take a look at this thread.  Please use the below code snippet and have a try.

Dispatcher.BeginInvoke(new AsyncDelete(deleteFunction), new object[]{ids});
public delegate void AsyncDelete(object obj);
public void deleteFunction(object obj)
{
HtmlPage.Window.Invoke("DeleteAnnotationsById", (string)obj);
}
If it doesn't work, please feel free to let me know with a tiny repro.

Best regards,

Jonathan

 

Jonathan Shen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

satyajit.appot
satyajit...

Member

Member

85 points

40 Posts

Re: Alert message show excepton

 

hello Jonathan

                  The error is arise for

                        MessageBox.Show(strMsg);

When someone press enter more than two time when this messagebox show message

It show the exception .

We are handle the exception by focus on other controls for any keydown event.

thank you for your suggestion

 

satyajit.appot
satyajit...

Member

Member

85 points

40 Posts

Re: Alert message show excepton

Jonathan Shen – MSFT
Jonathan...

All-Star

All-Star

24939 points

2,425 Posts

Microsoft

Re: Alert message show excepton

Hi Satyajit,

I got your empty reply.  Did your problem persist there?   How about add your MessageBox to deleteFunction block.

public void deleteFunction(object obj)
{

     MessageBox.Show(strMsg);
}

If it doesn't work, please share a tiny repro here.

Best regards,

Jonathan

Jonathan Shen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

jpark18
jpark18

Member

Member

6 points

3 Posts

Re: Alert message show excepton

Jonathan,

Here's your repro....

<UserControl

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

x:Class="TestSilverlight.Page"

Width="640" Height="480">

<Grid x:Name="LayoutRoot" Background="White">

<Button HorizontalAlignment="Center" VerticalAlignment="Center" Content="Click Me!!!" Click="Button_Click" x:Name="btnTest"/>

</Grid>

</UserControl>

 ***Code Behind***

using System;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Documents;

using System.Windows.Ink;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Animation;

using System.Windows.Shapes;

using System.Windows.Browser;

namespace TestSilverlight

{

public partial class Page : UserControl

{

public Page()

{

// Required to initialize variables

InitializeComponent();

}

private void Button_Click(object sender, RoutedEventArgs e)

{

HtmlPage.Window.Alert("close me");

}

}

}

 

If you want you can replace the HtmlPage.Window.Alert to Messagebox.Show  It doesn't happen as consistently, but it does happen if you continue to press the enter button.

Steps to reproduce:

launch app

click button

dismiss modal popup by pressing the enter key

press enter again

repeat pressing the enter key until exception is thrown.

 

Jonathan Shen – MSFT
Jonathan...

All-Star

All-Star

24939 points

2,425 Posts

Microsoft
Answered Question

Re: Alert message show excepton

Hi Jpark,

This is a known issue and has been fixed on Silverlight 3 RTW.   I have tested it on a internal siverlight 3 version. 

Best regards,

Jonathan

Jonathan Shen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities