[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

BackgroundWorker in different OS

antarikshv

5/23/2008 7:59:00 AM

Hello All,
I had written a piece of code for working with the
BackgroundWorker.Following is the code for the same:

BackgroundWorker ^ defReportWorker = gcnew BackgroundWorker();
defReportWorker->WorkerReportsProgress = true;
defReportWorker->WorkerSupportsCancellation = true;
defReportWorker->DoWork += gcnew DoWorkEventHandler(this,
&Form1::GenerateDefaultReport);
defReportWorker->ProgressChanged += gcnew
ProgressChangedEventHandler(this, &Form1::updateProgress);
defReportWorker->RunWorkerCompleted += gcnew
RunWorkerCompletedEventHandler(this, &Form1::DefEndWorker);

GenerateDefaultReport is the function which i need to execute
DefEndWorker is the function which will be called upon completion of
the GenerateDefaultReport function.

The client was a german client and we were developing the code on the
german OS machines in our company. The problem we faced in this code
was that the function "GenerateDefaultReport" was not called when the
code compiled on the German OS machine was executed on the English OS
machine. but the code compiled on the English OS machine was executing
properly and the said function was called on the German OS machine.

German compiled - german execution - running
German compiled - English execution - not running
English compiled - English execution - running
English compiled - german execution - running.

Can any one please help in this?
8 Answers

Peter Duniho

5/23/2008 5:01:00 PM

0

On Fri, 23 May 2008 00:59:11 -0700, antarikshv <antarikshv@gmail.com>
wrote:

> [...]
> The client was a german client and we were developing the code on the
> german OS machines in our company. The problem we faced in this code
> was that the function "GenerateDefaultReport" was not called when the
> code compiled on the German OS machine was executed on the English OS
> machine. but the code compiled on the English OS machine was executing
> properly and the said function was called on the German OS machine.

I find it highly unlikely that you've posted the code that actually causes
the problem.

You will likely need to post a concise-but-complete code sample that
reliably demonstrates the problem. Even then, for a really reliably
response, you'll have to hope for someone with access to installation
similar to your own. However, there's a chance that whatever
culture-dependent error you've got, someone who's familiar with
localization issues will note it, even if they aren't able to run and
reproduce the problem.

The code you posted does not appear to have anything in it that would
explain why you're seeing the behavior you're seeing.

Pete

Patrice

5/26/2008 9:51:00 AM

0

I would be really suprising to have a method called or not depending on the
language. My guess would be rather that you have something that fails inside
this method preventing to see the result this method is supposed to produce
and making things looks as if it were not called.

What if you intentioanly raise an exception in your code. Is it seen on your
English dev machine or does it fail silently ?
--
Patrice

"antarikshv" <antarikshv@gmail.com> a écrit dans le message de groupe de
discussion :
124d3c3d-6f15-4ecc-8d08-c8f78ab8d1a6@y18g2000pre.googlegroups.com...
> Hello All,
> I had written a piece of code for working with the
> BackgroundWorker.Following is the code for the same:
>
> BackgroundWorker ^ defReportWorker = gcnew BackgroundWorker();
> defReportWorker->WorkerReportsProgress = true;
> defReportWorker->WorkerSupportsCancellation = true;
> defReportWorker->DoWork += gcnew DoWorkEventHandler(this,
> &Form1::GenerateDefaultReport);
> defReportWorker->ProgressChanged += gcnew
> ProgressChangedEventHandler(this, &Form1::updateProgress);
> defReportWorker->RunWorkerCompleted += gcnew
> RunWorkerCompletedEventHandler(this, &Form1::DefEndWorker);
>
> GenerateDefaultReport is the function which i need to execute
> DefEndWorker is the function which will be called upon completion of
> the GenerateDefaultReport function.
>
> The client was a german client and we were developing the code on the
> german OS machines in our company. The problem we faced in this code
> was that the function "GenerateDefaultReport" was not called when the
> code compiled on the German OS machine was executed on the English OS
> machine. but the code compiled on the English OS machine was executing
> properly and the said function was called on the German OS machine.
>
> German compiled - german execution - running
> German compiled - English execution - not running
> English compiled - English execution - running
> English compiled - german execution - running.
>
> Can any one please help in this?


antarikshv

5/26/2008 11:39:00 AM

0


> I find it highly unlikely that you've posted the code that actually causes
> the problem.

---
This is the dilema. The code is the same. The solution which worked
was just to recompile the code on the English OS machine.
I had checked whether the control enters the said function or not.
When i had run the code compiled on German machine the control did not
enter the function.
But for the English OS compiled code, the control entered the
function.

> The code you posted does not appear to have anything in it that would
> explain why you're seeing the behavior you're seeing.

Thats precisely the problem i am facing.

antarikshv

5/26/2008 11:47:00 AM

0

>My guess would be rather that you have something that fails inside
> this method preventing to see the result this method is supposed to produce
> and making things looks as if it were not called.

I had written MessageBox::Show as the first statement to be executed
in the called function, but the function wasnt called. So i am pretty
sure the control does not go to the function. I have even debugged the
code. The solution i found was just by luck. Solution is to just
recompile on English machine.

> What if you intentioanly raise an exception in your code. Is it seen on your
> English dev machine or does it fail silently ?
What kind of exception should i raise? What benefit will be possible
with this exception raising? (I mean which all points should be
monitored while these exceptions are being raised?)

Patrice

5/26/2008 12:09:00 PM

0

This was just to check that if an error happens inside this function, you
have some kind of report rather than nothing produced....

It is really really weird that a function could be called or not depending
on the OS language which would make me really think the real souirce is
another problem.

Similarly and just for testing one of my moves would be to to call the
GenerateDefautlReport on the main thread...

My goal for now is not to correct the problem but to make things simpler to
find out what could go wrong...

--
Patrice

"antarikshv" <antarikshv@gmail.com> a écrit dans le message de groupe de
discussion :
24b76ae6-08c9-4e35-b7ee-4343d5a06a5b@w4g2000prd.googlegroups.com...
>>My guess would be rather that you have something that fails inside
>> this method preventing to see the result this method is supposed to
>> produce
>> and making things looks as if it were not called.
>
> I had written MessageBox::Show as the first statement to be executed
> in the called function, but the function wasnt called. So i am pretty
> sure the control does not go to the function. I have even debugged the
> code. The solution i found was just by luck. Solution is to just
> recompile on English machine.
>
>> What if you intentioanly raise an exception in your code. Is it seen on
>> your
>> English dev machine or does it fail silently ?
> What kind of exception should i raise? What benefit will be possible
> with this exception raising? (I mean which all points should be
> monitored while these exceptions are being raised?)


antarikshv

5/26/2008 1:35:00 PM

0

> It is really really weird that a function could be called or not depending
> on the OS language which would make me really think the real souirce is
> another problem.
---Same astonishment is with me.


> Similarly and just for testing one of my moves would be to to call the
> GenerateDefautlReport on the main thread...
---The function works properly, so any particular reason as to why to
check running on main thread?



> My goal for now is not to correct the problem but to make things simpler to
> find out what could go wrong...
---What kind of simplicity is the suggestion?

Peter Duniho

5/26/2008 5:13:00 PM

0

On Mon, 26 May 2008 04:38:35 -0700, antarikshv <antarikshv@gmail.com>
wrote:

>
>> I find it highly unlikely that you've posted the code that actually
>> causes
>> the problem.
>
> ---
> This is the dilema. The code is the same.

Since you didn't post a complete code sample, it is trivial to prove that
it's not the same.

Without a _complete_ code sample, there's no way to know what else is
going on that would explain the issue. The part of the code you posted
isn't susceptible to language differences, so whatever the issue is, it
exists in the code you didn't post.

Of course, without a _concise_ code sample, it's hard to get anyone to
look at it. So both characteristics are required for the purpose of
getting good advice.

Pete

Patrice

5/27/2008 7:51:00 AM

0

>> It is really really weird that a function could be called or not
>> depending
>> on the OS language which would make me really think the real souirce is
>> another problem.
> ---Same astonishment is with me.

This is why I think this is more likely not the real problem but only how it
looks like...

>
o>
>> Similarly and just for testing one of my moves would be to to call the
>> GenerateDefautlReport on the main thread...
> ---The function works properly, so any particular reason as to why to
> check running on main thread?

Because we don't know for now what is the exact problem. So I would like to
take threading out of the equation (it it realy doens"t run, does run when
threading is not used, else could it be something related to threading that
makes your code fails)

>> My goal for now is not to correct the problem but to make things simpler
>> to
>> find out what could go wrong...
> ---What kind of simplicity is the suggestion?

Also you could perhaps simplify the function body. Obviously if you do a
bare bone sample with a body that doesn't do much it should work. So IMO it
fails either because of the code you have inside GenerateDefaultReport (my
first thought would be still that it fails for some reason wihtout reporting
any error) or perhaps because of the code that surrounds this call. Have you
checked that the code that calls GenerateDefaultReport really runs on the
Spanish os ?

Finally as said Peter, at this tep it's really hard to imagine what in your
code could cause this issue in particular as it's more likely not something
such as code being called because of a language change. Your best bet is
more likely to simplify your code as much as possible so that :
- either a change make finally this work. So it's likely it will give an
essential clue to the problem (for example if you call something much
simpler than GenerateDefaultReport and it works, it should validate that the
problem is in the code inside GenerateDefaultReport)
- either it still doesn't work but then you should be able to post the
*minimal amount* of code that shows the problem allowing other to have a
look

--
Patrice