Find Jobs
Hire Freelancers

Access violation Issue in MultiThreading

$100-500 USD

Closed
Posted over 15 years ago

$100-500 USD

Paid on delivery
**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
Project ID: 3324163

About the project

2 proposals
Remote project
Active 15 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
2 freelancers are bidding on average $106 USD for this job
User Avatar
See private message.
$127.50 USD in 14 days
5.0 (120 reviews)
6.6
6.6
User Avatar
See private message.
$85 USD in 14 days
5.0 (51 reviews)
5.5
5.5

About the client

Flag of KUWAIT
Kuwait, Kuwait
0.0
0
Member since Jan 19, 2009

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.