Access violation Issue in MultiThreading

Ditutup Dipasang Oct 20, 2008 Dibayar saat pengiriman
Ditutup Dibayar saat pengiriman

**Description:** The Access violation Issue in MultiThreading

Language: VB .NET 2005

Description:

We are creating an instance of webbrowser control object internally in the code, and assign an html text to its “DocumentText?? property. When the [login to view URL] = [login to view URL], we are accessing the parsed html Document object and using it for some operations.

The Webbrowser control is not in the GUI , it is created dynamically and never displayed.

## Deliverables

**Description:** The Access violation Issue in MultiThreading

Language: VB .NET 2005

Description:

We are creating an instance of webbrowser control object internally in the code, and assign an html text to its “DocumentText?? property. When the [login to view URL] = [login to view URL], we are accessing the parsed html Document object and using it for some operations.

The Webbrowser control is not in the GUI , it is created dynamically and never displayed.

We are using multithreading and every thread created does the above process. These threads work independently , and their appartment state is STA ([login to view URL]).

The process in the thread reads HTML tags and parse them using the webbrowser object created.

Problem:

The threads gets created and starts fine. After a few iterations we gets the error

“Attempted to read or write protected memory. This is often an indication that other memory is corrupt.??

And the StackTrace of the Exception was

[login to view URL]()

at System.Windows.Forms.WebBrowser.get_Document()

at System.Windows.Forms.WebBrowser.get_ReadyState()

Tried Fixes:

[login to view URL] the webbrowser object

Shared wbAds As WebBrowser

2. Called [login to view URL]() after every iterations

[login to view URL] the Thread Sleep interval.

This fixes didn’t sloved the problem

Our Code model with threading

Private sub subThreadCaller()

Dim trdAnalysis() as Thread

Dim i,j as int16

J=5

Redim trdAnalysis(j)

For i = 0 To j

trdAnalysis(i) = New Thread(New ThreadStart (AddressOf subProcWeb))

trdAnalysis(i).SetApartmentState([login to view URL])

trdAnalysis(i).Name = "Thread" & i

trdAnalysis(i).IsBackground = True

trdAnalysis(i).Start()

[login to view URL](50)

Next i

End Sub

Private Sub subProcWeb()

Dim wbo As WebBrowser

Dim htmlDoc As HtmlDocument

Dim strHtm as string

Dim i, j as int32

J=1000

For i = 0 to j

strHtml =

wbo = new WebBrowser

[login to view URL] = strHtml

[login to view URL] = True

While Not [login to view URL] = [login to view URL]

[login to view URL]()

[login to view URL](1000)

End While

While [login to view URL] = True

[login to view URL]()

[login to view URL](1000)

End While

htmlDoc= [login to view URL]

... Processing follows...

[login to view URL]()

[login to view URL](100)

Next i

End Sub

Our Requirement is to check our web pages for a certain condition .

For this we read the HTML source of the page and assigin it to a webbrowser object.

Then check the parsed htmldocument.

Since analysising the HTML Document object was most suited for our need than using regular expression on the html source file.

Thanks

.NET Teknik MySQL PHP Perancangan Perangkat Lunak Pengujian Perangkat Lunak Visual Basic

ID Proyek: #3324163

Tentang proyek

2 proposal Proyek online Aktif Nov 11, 2008

2 freelancer rata-rata menawar $106 untuk pekerjaan ini

shawnburt

See private message.

$127.5 USD dalam 14 hari
(120 Ulasan)
6.6
MoonSoftware

See private message.

$85 USD dalam 14 hari
(51 Ulasan)
5.5