Hi Carlo,
I performed a test on this issue. The following is the walkthrough.
1. Create a Windows Control Library project named
'BackgroundWorkerInUserControl' .
2. Copy the code in the MSDN sample for BackgroundWorker component (you may
get this sample at
http://msdn2.microsoft.com/en-us/library/system.componentmodel.backgroundwor ker.aspx ) into the UserControl1.
3. Build the project.
4. Create a folder, e.g 'c:\virtual path\backgroundworker' and copy the
project output file BackgroundWorkerInUserControl.dll into the folder.
Create an html file named test.html. The content in this html file is like
below.
<html>
<head>
<title>IE Hosted UserControl</title>
</head>
<body>
<object id="myControl" name="myControl" width="400" height="400"
classid="BackgroundWorkerInUserControl.dll#BackgroundWorkerInUserControl.Use
rControl1">
</object>
</body>
</html>
5. Open IIS Manager and create a new virtual directory named
'backgroundworker' which refers to the directory 'c:\virtual
path\backgroundworker'. Ensure to set the 'Execute permissions' of the
virtual directory to 'Scripts only'. To do this, right-click on the virtual
directory and choose Properties. In the Properties window, switch to
'Virtual Directory' tab. Select 'Scripts only' in the 'Execute permissions'
combobox. This ensures the usercontrol hosted in the web page to be loaded
correctly.
6. Open IE and type the url 'http://localhost/backgroundworker/test.html'
in the address bar and press Enter. The usercontrol is loaded in the web
page correctly. When I set the value in the numericUpDown control to 35 and
click the 'Start Async' button, the usercontrol begins to compute and the
progress of the process is displayed in the progressbar. All works fine.
Is there any difference between your walkthrough and mine?
[quoted text, click to view] >The SincronizationContext is null in the RunWorkerCompleted when the
RunWorkerAsync is called outside the constructor.
Could you tell me what the 'SincronizationContext' is? What problem do you
have when you call the RunWorkerAsync outside the constructor?
You may perform a test based on the MSDN sample I mention above and see if
the problem exists in the sample. If the problem is still not solved in
your project, you may send me your sample project and html page hosting the
usercontrol. To get my actual email address, remove 'online' from my
displayed email address.
I look forward to your reply.
Sincerely,
Linda Liu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx. ==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.