cancel
Showing results for 
Search instead for 
Did you mean: 

How to ignore "Object reference not set" with OnMouseMove?

Former Member
0 Kudos

I know that there are other threads for this problem (). But I have this error and need to make my application running.

I found where exceptions occurs in my code and I would like to suppress it. I use:

Catch ex As NullReferenceException When ex.TargetSite.Name = "OnMouseMove" And ex.TargetSite.ReflectedType.FullName = "CrystalDecisions.Windows.Forms.PageControl"

Is it specific enough? Is it safe?

Full code is (wpf DoEvents see http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher.pushframe.aspx 😞

Public Shared Sub DoEvents()

        Dim frame As New DispatcherFrame()

        Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, New DispatcherOperationCallback(AddressOf ExitFrame), frame)

        Try

      Dispatcher.PushFrame(frame)

   Catch ex As NullReferenceException When ex.TargetSite.Name = "OnMouseMove" And ex.TargetSite.ReflectedType.FullName =                          "CrystalDecisions.Windows.Forms.PageControl"

        End Try

    End Sub

Public Shared Function ExitFrame(ByVal f As Object) As Object

        CType(f, DispatcherFrame).Continue = False

        Return Nothing

End Function

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

This issue was resolved in Service Pack 2. Latest SP is SP 3 now, so I'd recommend updating your install with that:

http://scn.sap.com/docs/DOC-7824

- Ludek

Former Member
0 Kudos

I'll try it. But it needs some time to reproduce and repeat again with servicepack.

I am not able to reproduce the since I have asked.  I will install servicepack and let it be.

Answers (0)