.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan
Asad Ali
Post New Web Links

Error on datafilling in DataTable on background worker

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :Windows Application
 
I have got some error while datafilling from DataTable to Datagridview on BackgroundWorker... I saw some where that "Should not fill datatable while its working in Backgroundworker"... How can I manage this situation? Is there any possible logic to do that? Help me Sir,


View Complete Post


More Related Resource Links

Open dialogue box in background worker

  
Hi, I am getting an error trying to open a dialogue box in background worker. Please help.   Imports System Imports System.Drawing Imports System.Windows.Forms Imports System.IO Public Class Form1 Inherits Form Private folderBrowserDialog1 As FolderBrowserDialog Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click bgw.RunWorkerAsync() End Sub Private Sub BGW_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bgw.DoWork Dim result As DialogResult = folderBrowserDialog1.ShowDialog() End Sub End Class

Background worker - errors in completed event

  
Create a new windows forms project (in using vb.net 2010). Create a button and a background worker on the form. Under the Debug > Exceptions menu, make sure that for 'Common Language Runtime Exceptions' you have 'Thrown' unticked and 'User-unhandled' ticked. Now put the following code in the form's code-behind; Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click BackgroundWorker1.RunWorkerAsync() End Sub Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork Threading.Thread.Sleep(2000) End Sub Private Sub BackgroundWorker1_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted Dim X As Integer X = 5 / X End Sub End Class Why does it not error nicely? It comes up with no helpful stack trace and just says 'Exception has been thrown by the target of an invocation.'. Place the code to cause the error into the Button_Click event and run it and you will see the difference. Why do we not get these 'nice' errors given that the runworkercompleted event is supposed to be running on the main thread?

Help with using a Background worker

  
Hi I am trying to use a background worker in my application.  I basically have a list of items displayed. When a user selects a particular item I have the background worker query the database to get information about the item selected and display it once it is done. (There are quite a few database calls) Since the database queries might take time, I have a UI wait animation displayed while the data is getting fetched. Once the background worker is completed I get rid of the wait animation and display the information fetched. This setup works fine if I do not click on any other item while the UI wait animation is being displayed. My main aim is to cancel the background worker from fetching the previously selected items information when a new item is selected (as the previous information would anyways be overwritten with the new item's information). The problem with such an approach is within the background worker's doWork method i would need to continuously check after each database query if the cancellation is pending and if it is then I can cancel the rest of the queries. I somehow feel this is not the right approach. If anyone has any suggestions about a better way to achieve the required functionality it would be great.. 
tag background   

If there is validation error in input box, then how to change its parent <td> tag background-color?

<td id="td1">
                                    <asp:RequiredFieldValidator ID="rfvtxtName" runat="server" ErrorMessage="Specify your Name."
                                        ControlToValidate="txtName" Display="Dynamic" ValidationGroup="vgSubmit" 
                                        CssClass="fieldError" SetFocusOnError="True"></

WPF 4 with SSRS Report Viewer and long running Background Worker Dispatch task.

  

Hello,

I've recently run into an issue with with WPF 4 and the SSRS viewer control with a batch emailing application. See http://www.jenasysdesign.com.au/dnn/Blogs/tabid/71/EntryId/5/WPF-4-SQL-Server-Reporting-Services-processing-application-Memory-Leak.aspx for details of some performance profiling issues I found with this technology stack.

I've got two issues.

Firstly, I implemented a background worker process to handling looping through the 2,800 reports. I found to run the SSRS report viewer to export the report results in a slow memory leak. See Red-gate Ants memory profiler 6 image in the link above. I'm not sure what I need to do to remove weak references with this combination of technology. Any ideas?

Secondly, the following code runs on the background worker process, designed so the user can monitor the progress of the a large batch of report files getting generated.  The catch here is involves using the SSRS viewer to export a reports results requires the Dispatcher.Invoke method to ensure that ReportViewer.xaml screen gets a UI thread, but in the process it interferes with the background workers report progress methods, so the UI doesn't see the progress.  

WPF 4 with SSRS Report Viewer and long running Background Worker Dispatch task.

  

Hello,

I've recently run into an issue with with WPF 4 and the SSRS viewer control with a batch emailing application. See http://www.jenasysdesign.com.au/dnn/Blogs/tabid/71/EntryId/5/WPF-4-SQL-Server-Reporting-Services-processing-application-Memory-Leak.aspx for details of some performance profiling issues I found with this technology stack.

I've got two issues.

Firstly, I implemented a background worker process to handling looping through the 2,800 reports. I found to run the SSRS report viewer to export the report results in a slow memory leak. See Red-gate Ants memory profiler 6 image in the link above. I'm not sure what I need to do to remove weak references with this combination of technology. Any ideas?

Secondly, the following code runs on the background worker process, designed so the user can monitor the progress of the a large batch of report files getting generated.  The catch here is involves using the SSRS viewer to export a reports results requires the Dispatcher.Invoke method to ensure that ReportViewer.xaml screen gets a UI thread, but in the process it interferes with the background workers report progress methods, so the UI doesn't see the progress.  

Convert IList to datatable Error "Only a single enumeration is supported by this IEnumerable."

  

Hi,

I am working in WCF Data service, in client side i am returning result as IEnumerable as below.

IEnumerable<MTSR> SearchResult = context1.Execute<MTSR>(new Uri(url));

i am converting this enumerable to datatable as below.

public static DataTable ToDataTable<T>(IList<T> data)
        {

            PropertyDescriptorCollection props =
                TypeDescriptor.GetProperties(typeof(T));
            DataTable table = new DataTable();
            for (int i = 0; i < props.Count; i++)
            {
                PropertyDescriptor prop = props[i];
                table.Columns.Add(prop.Name, prop.PropertyType);
            }
            object[] values = new object[props

Error warming up the worker process. - Starting worker process threw - Inner Exception: System.Runti

  

Can anybody guide me how to resolve this on my production server,

 

 

Error warming up the worker process. - Starting worker process threw - Inner Exception: System.Runtime.Remoting.RemotingException: 4 arguments were passed to 'Microsoft.SharePoint.UserCode.ISPUserCodeWorkerProcessProxy::Initialize'. 3 arguments were expected by this method.    Server stack trace:      at System.Runtime.Remoting.Messaging.Message.CoerceArgs(MethodBase mb, Object[] args, ParameterInfo[] pi)     at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)    Exception rethrown at [0]:      at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)     at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)     at Microsoft.SharePoint.UserCode.ISPUserCodeWorkerProcessProxy.Initialize(Int32 appDomainCount, Boolean alwaysRecycleAppDomains, Byte[] salt, Boolean logRequests)     at Microsoft.SharePoint.UserCode.SPUserCodeWorkerProcess.InitializeWorkerProcess(ISPUserCodeWorkerProcessProxy workerProcessProxy, Boolean alwaysRecycleAppDomains, Byte[] saltBytes, Boolean logRequests)     at Microsoft.SharePoint.UserCode.

Error warming up the worker process. - Inner Exception: System.Runtime.Remoting.RemotingException: 4

  
Can anybody guide me how to resolve this,


10/16/2010 01:50:32.39 SPUCHostService.exe (0x0AA4)             0x0D9C SharePoint Foundation         Sandboxed Code Service         fe8d Medium   -  - Error warming up the worker process. - Inner Exception: System.Runtime.Remoting.RemotingException: 4 arguments were passed to 'Microsoft.SharePoint.UserCode.ISPUserCodeWorkerProcessProxy::Initialize'. 3 arguments were expected by this method.    Server stack trace:      at System.Runtime.Remoting.Messaging.Message.CoerceArgs(MethodBase mb, Object[] args, ParameterInfo[] pi)     at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)    Exception rethrown at [0]:      at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)     at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData,

Unable to cast COM object error when calling COM from .NET C# worker thread

  

I'm having an issue calling a COM object function from .NET C# client program. The COM object is written in C++ unmanaged. The problem only appears when I'm calling from a worker thread, it works fine if I call it from the UI thread. This is the error:

Unable to cast COM object of type 'gvAgileFileReaderLib.gvAgileFileReaderClass' to interface type 'gvAgileFileReaderLib.IgvMpiRead'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{616B5C39-C7FB-4C8C-85D4-27559DD83304}' failed due to the following error: Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL)).

I have tried the following methods but all of them fails:

1) Create the COM object on UI thread, and call its function via its interface (IgvMpiRead) in the worker thread

2) Create the COM object on the worker thread & access its function from worker thread

3) Tried with worker thread set to STA & MTA

I need to use the COM function is a worker thread to prevent a long processing from holding up my UI, but it just doesn't work when I try to call the COM function inside the worker thread.

The weird thing is that doing the same from a unmanaged C++ client works fine (I can create the com object on UI, and then call its function from worker thread). Is this problem caused by inter

A query regarding the MSDN library background worker example

  

In the MSDN library article "How to: Use a Background Worker",

(see http://msdn.microsoft.com/en-us/library/cc221403(VS.95).aspx),

the following sample code is presented...


Private Sub bw_DoWork(ByVal sender As Object, ByVal e As DoWorkEventArgs)
    Dim worker As BackgroundWorker = CType(sender, BackgroundWorker)

    For i = 1 To 10
        If bw.CancellationPending = True Then
            e.Cancel = True
            Exit For
        Else
            ' Perform a time consuming operation and report progress.
            System.Threading.Thread.Sleep(500)
            bw.ReportProgress(i * 10)
        End If
    Next
End Sub

For what purpose has the "Dim worker as..." statement been included in this code?

Siggy


How to pause resume Background Worker Thread?

  

We are working on a VB.Net window based application and we are using Visual Studio 2010 Professional.

In our application during the execution process we have used Background Worker thread and user have the option of cancelling the execution only.

Now we came across a situation that if user wants to pause the execution process then how we can pause the background worker thread so that it can be resumed on resuming the execution by the user?

 

Regards,

Premjeet Singh


Regards, Premjeet Singh

ASP.NET Architecture - ASP.NET Worker Process - HTTP Pipleline - Http Modules and Handlers

  
"ASP.NET is a powerful platform for building Web applications, that provides a tremendous amount of flexibility and power for building just about any kind of Web application. Most people are familiar only with the high level frameworks like WebForms and WebServices which sit at the very top level of the ASP.NET hierarchy. In this article I'll describe the lower level aspects of ASP.NET and explain how requests move from Web Server to the ASP.NET runtime and then through the ASP.NET Http Pipeline to process requests.

How to bind GridView and DropDownList controls using DataTable object

  
In .net framework 2.0, you can load a DataTable in memory by consuming a data source using a DataReader. In this version you will find the flexibility in accessing the DataReader means write access code once and use again and again using DataReader. To see the functionality of DataTable consider an example that is created using VS2005.

DataTable - Load from IDataReader - CreateDataReader - ReadXml WriteXml - Free ADO.NET Tutorials

  
The DataTable in ADO.NET 2.0 has been seriously beefed up and I absolutely love it. Not everything we consume deals with multiple resultsets and requires the ever popular DataSet. With the cool new features in the ADO.NET 2.0 DataTable, we can get many of the cool features in the DataSet without all the extra baggage and memory footprint particular to multiple resultsets.

Load DataTable from IDataReader

IsapiModule Error 500 Issue

  

I am about exhausted trying to figure out this error:

HTTP Error 500.0 - Internal Server Error

Description: The page cannot be displayed because an internal server error has occurred.

Error Code: 0x8007007b

Notification: ExecuteRequestHandler

Module: IsapiModule

Requested URL: http://localhost:80/ReportServer

Physical Path: c:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer

When I enable Failed Request Tracing Rules and view the log output I am supposing that the actual problem is in the 2nd call where there are 2 backslashes before the actual filename in the specified path:

ISAPI_START

CALL_ISAPI_EXTENSION DllName="C:\Windows\Microsoft.NET\Framework\v2.0.50727\\aspnet_isapi.dll"

 

Alternating row background for first column of a report

  

is there a way to make the first column of a report use the an alternating background color? 

I have the background color set for the entire row however it does not work for the first column if the color is set to an expression.  If I just set it to a color i.e. red it works just fine. If I insert a dummy column to the left it works just fine (but the dummy column does not work, presumably because it is first??).

In the file below only the textbox for part number does not show an alternating background.  All others work correctly.

<TableRows>
            <TableRow>
              <TableCells>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="PartNumber">
                      <rd:DefaultName>PartNumber</rd:DefaultName>
 

Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend