Click here to Skip to main content
15,901,373 members
Home / Discussions / C#
   

C#

 
AnswerRe: Checkbox in datagrid Pin
Ron.S9-Jul-07 1:04
Ron.S9-Jul-07 1:04 
GeneralRe: Checkbox in datagrid Pin
pmartike9-Jul-07 1:15
pmartike9-Jul-07 1:15 
AnswerRe: Checkbox in datagrid Pin
sam#9-Jul-07 1:57
sam#9-Jul-07 1:57 
GeneralRe: Checkbox in datagrid Pin
pmartike9-Jul-07 2:14
pmartike9-Jul-07 2:14 
GeneralRe: Checkbox in datagrid Pin
sam#9-Jul-07 2:23
sam#9-Jul-07 2:23 
QuestionNunit Testing...?? Pin
Software_Specialist9-Jul-07 0:27
Software_Specialist9-Jul-07 0:27 
AnswerRe: Nunit Testing...?? Pin
Pete O'Hanlon9-Jul-07 0:48
mvePete O'Hanlon9-Jul-07 0:48 
QuestionCross AppDomain Exception Handling. Plugin architecture. [modified] Pin
Abdul Gafoor9-Jul-07 0:25
Abdul Gafoor9-Jul-07 0:25 
Hi all,

I want to handle a unhandled exception thrown by a plugin running in its own appDomain (ie not Defualt appDomain) in defualt appDomain (host appliation), and then unload the culprit appDomain..

Is it really possible to handle this kind of cross appDomain exception. the exception may occur any time during the life time of plugin appdomain ( say some buttton in the plugin throws some unhandled exception..)

please have a look on the sample code given below.. What should i do handle the exception thrown by button1.. I never want to close my host application at any cost. it should continue its execution whatever happens in plugins..

please give me guide lines.


//********************* Plug in *******************************

public class BadPlugin: Form,IPlugin
{
private System.Windows.Forms.Button button1;

public StaffList()
{
InitializeComponent();
}

private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(232, 96);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(176, 48);
this.button1.TabIndex = 1;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// StaffList
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(488, 302);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox1);
this.Name = "StaffList";
this.ResumeLayout(false);

}

private void button1_Click(object sender, System.EventArgs e)
{
throw new Exception("Bad plgin exploded exception");
}

}


//********************* Plug in Interface *******************************


public interface IPlugin
{
void Show();
}


//******************** Plug in Host Application***************************


try
{

AppDomain app = AppDomain.CreateDomain("PluginDomain");
IPlugin plugin = (IPlugin)app.CreateInstanceAndUnwrap("SamplePlugins","SamplePlugins.BadPlugin");

plugin.Show();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}


Thanks and regards
123developer


-- modified at 1:06 Tuesday 10th July, 2007
AnswerRe: Cross AppDomain Exception Handling. Plugin architecture. Pin
originSH9-Jul-07 0:48
originSH9-Jul-07 0:48 
GeneralRe: Cross AppDomain Exception Handling. Plugin architecture. Pin
Abdul Gafoor9-Jul-07 1:18
Abdul Gafoor9-Jul-07 1:18 
GeneralRe: Cross AppDomain Exception Handling. Plugin architecture. Pin
Abdul Gafoor9-Jul-07 19:11
Abdul Gafoor9-Jul-07 19:11 
QuestionI can not run debug to debug a web service Pin
vohongtieng20059-Jul-07 0:24
vohongtieng20059-Jul-07 0:24 
AnswerRe: I can not run debug to debug a web service Pin
Pete O'Hanlon9-Jul-07 0:54
mvePete O'Hanlon9-Jul-07 0:54 
QuestionGet processor No. Pin
Sunshine Always9-Jul-07 0:22
Sunshine Always9-Jul-07 0:22 
AnswerRe: Get processor No. Pin
Christian Graus9-Jul-07 0:56
protectorChristian Graus9-Jul-07 0:56 
GeneralRe: Get processor No. Pin
Sunshine Always9-Jul-07 1:41
Sunshine Always9-Jul-07 1:41 
Questionaccess powers Pin
srinivassam9-Jul-07 0:15
srinivassam9-Jul-07 0:15 
AnswerRe: access powers Pin
Paul Conrad13-Jul-07 12:08
professionalPaul Conrad13-Jul-07 12:08 
QuestionGeneric in ASP.NET 2.0 Pin
adilkazmi8-Jul-07 23:47
adilkazmi8-Jul-07 23:47 
AnswerRe: Generic in ASP.NET 2.0 Pin
Michael Sync9-Jul-07 0:02
Michael Sync9-Jul-07 0:02 
GeneralRe: Generic in ASP.NET 2.0 Pin
adilkazmi9-Jul-07 0:17
adilkazmi9-Jul-07 0:17 
GeneralRe: Generic in ASP.NET 2.0 Pin
DavidNohejl9-Jul-07 0:42
DavidNohejl9-Jul-07 0:42 
QuestionData Set update back to database Pin
Suresh M8-Jul-07 23:09
Suresh M8-Jul-07 23:09 
Questioninstaller package Pin
DKalepu8-Jul-07 22:35
DKalepu8-Jul-07 22:35 
AnswerRe: installer package Pin
originSH8-Jul-07 22:45
originSH8-Jul-07 22:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.