Hi,

I have problem with simple application to log firebird traces.
Main form contains 2 buttons to stop/start logging ant textbox for writting Trace Session ID (only for testing).

Problem: program hangs after clicking stop button.
When I close session via fbsrvcmgr program wrote that cannot find trace session id and return error that is nothing attached to trace.start() (it's correct because I switch off manually session)

Code of main class:
Code:
namespace fbTest
{      
public partial class Form1 : Form { Thread oThread; loger log; FbTrace trace = new FbTrace(); public Form1()
{
InitializeComponent(); log = new loger(); oThread = new Thread(new ThreadStart(log.startTrace));
}
private void button1_Click(object sender, EventArgs e) {
log.logTraceApi(); oThread.Start();
}
private void button2_Click(object sender, EventArgs e) {
log.stopTrace(Int32.Parse(textBox1.Text));
}
} }
and loger class:

Code:
namespace fbTest  
{      
public class loger      
{            
FbTrace trace = new FbTrace(); public void stopTrace(int sID) { try
{
trace.Stop(sID);
}
catch (Exception eX)
{
MessageBox.Show(eX.ToString());
}
} public void startTrace() {
try {
trace.Start("session1");
} catch (Exception eX) {
MessageBox.Show(eX.ToString());
}
} public void logTraceApi() {
try {
trace.ConnectionString = "database=192.168.1.10:\"c:\\_test\\slave.fdb\";user=sysdba;password=masterkey;"; trace.ServiceOutput += (object tsender, ServiceOutputEventArgs t) = { Console.WriteLine(t.Message); }; trace.DatabasesConfigurations.Add( new FbDatabaseTraceConfiguration() { DatabaseName = string.Empty, Enabled = true, Events = FbDatabaseTraceEvents.StatementStart });
} catch (Exception eX) {
MessageBox.Show(eX.ToString());
}
} }
}
What's wrong? I tried different synchronization method but without success.

THX for help!