Post by siwik75 on Jan 30, 2004 12:02:46 GMT -5
I suddenly encountered a very strange problem with my code, and i can't figure out the reason.
I'm trying to report an extraction of the significant code that show the structure of my appbr]
------------------------------------------------------------------------------------------------------------------
[ from DbPoller.cs ]
public delegate void dlgNotify(DataSet ds, string commandName);
...
abstract public class Poller : IServiceHandler
{
protected System.Timers.Timer inTimer;
#region
#endregion
//
// ================= DELEGATI ===================
//
public dlgNotify Notify;
public dlgCommandWaking CmdStartReport;
}
...
in class DbPoller: Poller
...
if ( base.Notify != null )
{
base.Notify(detail_result, currentCommand.CommandName);
}
...
[ from CtrlForm.cs - which is a Form ]
in costructorbr] DbPoller pollerObject = new DbPoller(5000);
pollerObject.Notify += new dlgNotify(this.notifyByEMail);
...
private void notifyByEMail(DataSet ds, string commandName)
{
....
HERE IT FAILS!!! WHATEVER IS IN.
---------------------------------------------------------------------------------------------------------------
First, i have to say that before it worked fine, and after a few adds that apparently didn't affect the delegate situation and global structure something didn't worked anymore.
In few words the form instantiate a DbPoller and add the local method notifyByEMail to the delegate to handle the notification type. In DbPoller class there's the check for delegate initialization (if ( base.Notify != null ) )
the check is true so the delegate is called and the filled dataset is passed over.
HEREAFTER, when it enters the notifyByEmail, i noticed the dataset were populated only in part: the datasetname property was set and the Tables object was not accessible. The program exits with the exception "The Thread has been stop" or "[Object reference not set to an instance of an object." alternatively. I tried also to stop, to run alone the exe, to restart the pc and whatever is possible to an human mind to think.
Let's say i don't use threading... and i did not change any of the code involved with delegates assignment and calling.
What kind of problem may i have to face with? Could you give me any help?
thank you in advance
Simone
Italy
I'm trying to report an extraction of the significant code that show the structure of my appbr]
------------------------------------------------------------------------------------------------------------------
[ from DbPoller.cs ]
public delegate void dlgNotify(DataSet ds, string commandName);
...
abstract public class Poller : IServiceHandler
{
protected System.Timers.Timer inTimer;
#region
#endregion
//
// ================= DELEGATI ===================
//
public dlgNotify Notify;
public dlgCommandWaking CmdStartReport;
}
...
in class DbPoller: Poller
...
if ( base.Notify != null )
{
base.Notify(detail_result, currentCommand.CommandName);
}
...
[ from CtrlForm.cs - which is a Form ]
in costructorbr] DbPoller pollerObject = new DbPoller(5000);
pollerObject.Notify += new dlgNotify(this.notifyByEMail);
...
private void notifyByEMail(DataSet ds, string commandName)
{
....
HERE IT FAILS!!! WHATEVER IS IN.
---------------------------------------------------------------------------------------------------------------
First, i have to say that before it worked fine, and after a few adds that apparently didn't affect the delegate situation and global structure something didn't worked anymore.
In few words the form instantiate a DbPoller and add the local method notifyByEMail to the delegate to handle the notification type. In DbPoller class there's the check for delegate initialization (if ( base.Notify != null ) )
the check is true so the delegate is called and the filled dataset is passed over.
HEREAFTER, when it enters the notifyByEmail, i noticed the dataset were populated only in part: the datasetname property was set and the Tables object was not accessible. The program exits with the exception "The Thread has been stop" or "[Object reference not set to an instance of an object." alternatively. I tried also to stop, to run alone the exe, to restart the pc and whatever is possible to an human mind to think.
Let's say i don't use threading... and i did not change any of the code involved with delegates assignment and calling.
What kind of problem may i have to face with? Could you give me any help?
thank you in advance
Simone
Italy