Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Monitor.TryEnter Error

Status
Not open for further replies.

jayy66

Programmer
Aug 21, 2006
56
0
0
US
I keep getting the following error in my applictaion:
"Object synchronization method was called from an unsynchronized block of code."

Heres the part of code the error is occurring at:
Code:
Public SuccessFax As New SuccessFaxCheck

If Monitor.TryEnter(SuccessFax, 1000) = True Then
                    If aServer.Equals(faxSvr1) Then '1.18
                        'check if there has been at least one successful fax sent
                        If SuccessFax.Svr1Success = True Then
                            If DateDiff(DateInterval.Minute, SuccessFax.sFax1, Now()) > basMod.IntervalBetweenSuccesses Then
                                basMod.SendAlertMail(6, aServer)
                                SuccessFax.Svr1SuccessReceived = False
                                WriteToXML(1, faxSvr1) 'set settings variable to false
                                success = False
                            Else
                                success = True
                            End If
                        Else
                            success = True
                        End If
                    ElseIf aServer.Equals(faxSvr2) Then '10.5
                        'check if there has been at least one successful fax sent
                        If SuccessFax.Svr2Success = True Then
                            If DateDiff(DateInterval.Minute, SuccessFax.sFax2, Now()) > basMod.IntervalBetweenSuccesses Then
                                basMod.SendAlertMail(6, aServer)
                                SuccessFax.Svr2SuccessReceived = False
                                WriteToXML(1, faxSvr2) 'set settings variable to false
                                success = False
                            Else  '<--ERROR OCCURS HERE
                                success = True
                            End If
                        Else
                            success = True
                        End If
                    End If
                    Monitor.Exit(SuccessFax)
                End If

Does anybody see the error of my ways?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top