Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6917615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:45:10+00:00 2026-05-27T09:45:10+00:00

I changed target framework from 3.5 to 4.0, no other changes. A simple ping

  • 0

I changed target framework from 3.5 to 4.0, no other changes. A simple ping which worked with 3.5, now with 4.0 the result gives Canceled=True. Any ideas what may cause this?

Public Sub StartInternetConnectionCheckEvery(ByVal seconds As Integer)
    Dim timer As New Timer()
    timer.Interval = seconds * 1000
    AddHandler timer.Tick, AddressOf CheckIsConnectedToInternet
    timer.Start()
End Sub

Private Sub CheckIsConnectedToInternetByTimer(ByVal sender As Object, ByVal e As System.EventArgs)
    CheckIsConnectedToInternet()
End Sub

Public Sub CheckIsConnectedToInternet()
    Using ping As New System.Net.NetworkInformation.Ping()
        Dim address As String = "www.google.com"

        ping.SendAsync(address, Nothing)
        AddHandler ping.PingCompleted, AddressOf OnPingResult
    End Using
End Sub

Private Sub OnPingResult(ByVal sender As Object, ByVal e As PingCompletedEventArgs)
    If e.Cancelled Then
        Trace.WriteLine("InternetHelper: Ping Cancelled")
        Return
    End If

    IsConnectedToInternet = (e.Reply.Status = IPStatus.Success)
    RaiseEvent InternetPingResult(IsConnectedToInternet)
End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:45:10+00:00Added an answer on May 27, 2026 at 9:45 am
    Using ping As New System.Net.NetworkInformation.Ping()
       '' etc
    End Using
    

    Yes, this is not going to work well. You are disposing the ping object before the asynchronous send can complete. You got away with it before because the Ping class didn’t implement the Dispose() method properly. That got fixed in .NET 4, feedback report is here.

    The fix is simple, remove Using. Disposing it properly is not so easy when you use it asynchronously. Try it in the event or don’t bother.

    Otherwise a nice demonstration how framework bug fixes can break working code 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I changed the target .NET framework of my WPF app from 3.5 to 4.0.
I upgrade a wpf desktop application from .net 3.5 to .net 4.0.(Changed the target
I would like to change the target of symbolic link from within a bash
I changed the folder that my WordPress installation was in. However, this worked fine,
I changed some parameters in a Visual Studio C++ project, and now I don't
I've noticed in Visual C# 2010, whenever you change the target framework version away
Possible Duplicate: Change the Target Framework for all my projects in a Visual Studio
I need to change the .NET Framework Version of my Sharepoint Project from 3.5
Dragging happens from source to target. When the source calls DoDragDrop() with allowedEffects as
I've upgraded from ASP.NET MVC Beta to 1.0 and did the following changes to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.