Click here to Skip to main content
15,887,415 members
Home / Discussions / C#
   

C#

 
QuestionGet mouse coordinates relative to control in separate application... Pin
Edmundisme6-May-08 10:40
Edmundisme6-May-08 10:40 
AnswerRe: Get mouse coordinates relative to control in separate application... Pin
Christian Graus6-May-08 11:37
protectorChristian Graus6-May-08 11:37 
GeneralRe: Get mouse coordinates relative to control in separate application... Pin
Edmundisme7-May-08 8:21
Edmundisme7-May-08 8:21 
QuestionWindows Service - Service Thread Not Starting Pin
ooten146-May-08 10:03
ooten146-May-08 10:03 
AnswerRe: Windows Service - Service Thread Not Starting Pin
PIEBALDconsult6-May-08 13:45
mvePIEBALDconsult6-May-08 13:45 
GeneralRe: Windows Service - Service Thread Not Starting Pin
ooten147-May-08 9:16
ooten147-May-08 9:16 
GeneralRe: Windows Service - Service Thread Not Starting Pin
PIEBALDconsult7-May-08 13:07
mvePIEBALDconsult7-May-08 13:07 
QuestionA problem unloading Application Domains Pin
Togakangaroo6-May-08 8:30
Togakangaroo6-May-08 8:30 
Alright, so I have an application that is in constant communication with the database. As happens in the real world, sometimes (devilishly often in this case actually) the line goes down. When this happens, the application needs to be restored to its initial state. A similar thing will need to happen when the user allows the application to time out. Someone suggested on the ALT.NET list that I simply unload the application domain. After poking around online for what this actually means this seems like a great idea. I am having trouble however getting my test program to work and I fear that I must be missing something.

My test has two components
ApplicationDomainChild - a simple windows form with a label displaying a number and a button that when you press increments the number. I've compiled this to an .exe.
ApplicationDomainParent - another windows form with a single button and the following:
<br />
public partial class Form1 : Form {<br />
  private AppDomain _second_domain = null;<br />
  private string _second_assembly_path = @"ApplicationDomainChild.exe";<br />
<br />
  private void Form1_Load(object sender, EventArgs e) {<br />
    _second_domain = AppDomain.CreateDomain("Second Domain");<br />
    _second_domain.ExecuteAssembly(_second_assembly_path);<br />
  }<br />
  private void button1_Click(object sender, EventArgs e) {<br />
    try {<br />
      AppDomain.Unload(_second_domain);<br />
      _second_domain = AppDomain.CreateDomain("Second Domain");<br />
      _second_domain.ExecuteAssembly(_second_assembly_path);<br />
    }<br />
    catch (Exception ex) {<br />
      System.Diagnostics.Debug.WriteLine(ex);<br />
    }<br />
  }<br />
}<br />


What I expect to happen is for both forms to open at the same time, me to be able to increment the values in ApplicationDomainChild as much as I want by pressing the button and then be able to press the button on ApplicationDomainParent and have that shut down and restart the ApplicationDomainChild.

What happens however is that first ONLY ApplicationDomainChild runs. After 'X' out of the window ApplicationDomainParent runs. When I press the restart domain button the child program starts up again and I can interact with it, but if I attempt to click the restart button again I get a ThreadAbortException followed by an AppDomainUnloadException (or something like that). Can someone tell me what I'm doing wrong?
AnswerRe: A problem unloading Application Domains Pin
Togakangaroo7-May-08 8:11
Togakangaroo7-May-08 8:11 
QuestionHow to make chm file help in windows application? Pin
Eng Mohammed Osman6-May-08 7:58
Eng Mohammed Osman6-May-08 7:58 
AnswerRe: How to make chm file help in windows application? Pin
Thomas Stockwell6-May-08 8:10
professionalThomas Stockwell6-May-08 8:10 
QuestionStill Stuck: How to intercept rapidshare download in WebBrowser control using Http POST Pin
Anindya Chatterjee6-May-08 7:03
Anindya Chatterjee6-May-08 7:03 
AnswerRe: Still Stuck: How to intercept rapidshare download in WebBrowser control using Http POST Pin
led mike6-May-08 8:19
led mike6-May-08 8:19 
GeneralRe: Still Stuck: How to intercept rapidshare download in WebBrowser control using Http POST Pin
Anindya Chatterjee6-May-08 10:36
Anindya Chatterjee6-May-08 10:36 
GeneralRe: Still Stuck: How to intercept rapidshare download in WebBrowser control using Http POST Pin
led mike6-May-08 11:40
led mike6-May-08 11:40 
GeneralRe: Still Stuck: How to intercept rapidshare download in WebBrowser control using Http POST Pin
Anindya Chatterjee6-May-08 17:51
Anindya Chatterjee6-May-08 17:51 
AnswerRe: Still Stuck: How to intercept rapidshare download in WebBrowser control using Http POST Pin
Spacix One7-May-08 2:34
Spacix One7-May-08 2:34 
GeneralRe: Still Stuck: How to intercept rapidshare download in WebBrowser control using Http POST Pin
Anindya Chatterjee7-May-08 2:38
Anindya Chatterjee7-May-08 2:38 
GeneralRe: Still Stuck: How to intercept rapidshare download in WebBrowser control using Http POST Pin
Spacix One7-May-08 2:47
Spacix One7-May-08 2:47 
RantRe: Still Stuck: How to intercept rapidshare download in WebBrowser control using Http POST Pin
Spacix One6-May-08 10:16
Spacix One6-May-08 10:16 
JokeRe: Still Stuck: How to intercept rapidshare download in WebBrowser control using Http POST Pin
That Asian Guy6-May-08 11:02
That Asian Guy6-May-08 11:02 
GeneralRe: Still Stuck: How to intercept rapidshare download in WebBrowser control using Http POST Pin
Anthony Mushrow6-May-08 11:22
professionalAnthony Mushrow6-May-08 11:22 
RantRe: Still Stuck: How to intercept rapidshare download in WebBrowser control using Http POST Pin
Spacix One6-May-08 11:30
Spacix One6-May-08 11:30 
GeneralRe: Still Stuck: How to intercept rapidshare download in WebBrowser control using Http POST Pin
led mike6-May-08 11:36
led mike6-May-08 11:36 
JokeRe: Still Stuck: How to intercept rapidshare download in WebBrowser control using Http POST Pin
Spacix One7-May-08 2:37
Spacix One7-May-08 2:37 

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.