Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / May 2008

Tip: Looking for answers? Try searching our database.

BackgroundWorker in different OS

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
antarikshv - 23 May 2008 08:59 GMT
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?
Peter Duniho - 23 May 2008 18:00 GMT
> [...]
> The client was a german client and we were developing the code on the
[quoted text clipped - 3 lines]
> 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
antarikshv - 26 May 2008 12:38 GMT
> 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.
Peter Duniho - 26 May 2008 18:12 GMT
>> 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 - 26 May 2008 10:50 GMT
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
[quoted text clipped - 27 lines]
>
> Can any one please help in this?
antarikshv - 26 May 2008 12:46 GMT
>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 - 26 May 2008 13:08 GMT
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
[quoted text clipped - 13 lines]
> with this exception raising? (I mean which all points should be
> monitored while these exceptions are being raised?)
antarikshv - 26 May 2008 14:34 GMT
> 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?
Patrice - 27 May 2008 08:50 GMT
>> 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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.