BLUE SCREEN OF DEATH occurs when running PING in Parallel.For

rhoaste

Member
Joined
Jun 16, 2010
Messages
19
Programming Experience
10+
Hi,

I would really appreciate some help please with the code below. I created a new project, added a button to a form and put the code below in the click event. When I run it and click the button, after a short while my computer crashes with the Blue Screen Of Death. I have no idea why this should occur.

Initially I thought the default degree of parallelism (no maximum) may have been the issue, however, as you can see with the following code, the maximum parallelism is set to 1. This does not make any difference on whether the machine crashes which blows my suspicion out of the water.

I am running VS2010 on Windows 7 64bit. The program was compiled under .Net Framework 4.0.

VB.NET:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim ParallelOptions As New ParallelOptions
        ParallelOptions.MaxDegreeOfParallelism = 1

        Parallel.For(1, 254, ParallelOptions, Sub(x)

                                                  Dim Addr As String = "10.1.1." & x.ToString
                                                  Dim Result As String
                                                  If My.Computer.Network.Ping(Addr) Then
                                                      Result = "Alive"
                                                  Else
                                                      Result = "Dead"
                                                  End If

                                                  Console.WriteLine(Addr & " " & Result)

                                              End Sub)


    End Sub

I would be grateful for your comments and thoughts please.

Kind regards.
 
Last edited:
Which BSOD do you actually get? TBH BSOD's under Win7 usually indicates either a hardware problem (CPU fan working ok?) or a virus. In any case it's impossible to know without the actual type of error.
 
Back
Top