0

I currently am having trouble troubleshooting this line of code. I want to catch the exception, but it keeps running. Therefore, it's obviously an exception that isn't within System. I tried these other system exceptions (and random ones just to see) but once I hit F10, it instead keeps going in the code and not the next line! Obviously something is wrong but I can't catch it.

Any ideas?

Here's the code:

Try
    Dim txtRecord As New Bonjour.TXTRecord
    m_async = m_socket.BeginReceive(m_buffer, 0, m_buffer.Length, SocketFlags.Partial, New AsyncCallback(AddressOf OnReceive), Me)
    m_registrar = m_service.Register(0, 0, Environment.UserName, "_axis-video._tcp", "local", vbNullString, m_port, txtRecord, MyEventManager)
Catch ex As Exception

End Try

I'm using Bonjour in vb.net to try and use a mDNS service. Despite having breakpoints, the "catch" is never reached, and instead the window pops up with out any of these following services or code lines called.

EDIT: After taking after the very helpful comments (mentioned below!), I was able to catch it by calling the function by a non-load function. When that happened the expection was caught (socket exception).

Kat
  • 2,460
  • 2
  • 36
  • 70
  • Please don't add language tags (c#) if your code does not involve the language. – gunr2171 Jul 16 '14 at 14:58
  • do you have a break-point set in the callback OnReceive? – Ric Jul 16 '14 at 14:58
  • Whoops, sorry about the C#. No I don't, and I'll try that break point. – Kat Jul 16 '14 at 14:59
  • 2
    Did you have this code in a win7 64bit under a Form.Load event and running inside VS? See http://stackoverflow.com/questions/4933958/vs2010-does-not-show-unhandled-exception-message-in-a-winforms-application-on-a – Steve Jul 16 '14 at 15:00
  • where is this code located? – Ňɏssa Pøngjǣrdenlarp Jul 16 '14 at 15:00
  • I don't have it under a load event, I actually have it (with same behavior) in a public function and in a New() instance of the class. I did it differently to see what would happen – Kat Jul 16 '14 at 15:01
  • but if that function is called from Form Load or the form's constructor the same thing happens. we have no context. you also did not answer Steve regarding Win 64bit – Ňɏssa Pøngjǣrdenlarp Jul 16 '14 at 15:04
  • 1
    Ah, the original call is from a form load event. That might be it. – Kat Jul 16 '14 at 15:05
  • I have some dlls that are platform specific. Is there another way to fix besides changing the compile version's target cpu? – Kat Jul 16 '14 at 15:10
  • I have tried changing the target CPU to any, adding the unhandled exception in the load event, and nothing catches it. – Kat Jul 16 '14 at 15:28

0 Answers0