locked
JIT Debugging RRS feed

  • Question

  • Hi,

    I am getting a prompt cannot be converted to string exception from JIT debugging.

    This error occurs at the creation of the streamwriter.

    However, I did not meet such exception when I was running from my development station (debug mode from VS).

    It happened at a pc where I installed the program in (from an installer built from VS).

    Does anyone know why is it so and provide ways to get rid of this exception?

    Thank you.
    Thursday, December 11, 2008 1:25 AM

Answers

  • Hmm, I restarted the pc, and now the JIT debugging exception does not appear any more.

    I wonder what went wrong (@_@)
    • Proposed as answer by konikula Thursday, December 11, 2008 2:04 PM
    • Marked as answer by Martin Xie - MSFT Tuesday, December 16, 2008 9:51 AM
    Thursday, December 11, 2008 5:31 AM
  • Thank you konikula for your friendly help. 

    Hi masuda,

    Here is one document for you to check:

    How to: Break on User-Unhandled Exceptions
    http://msdn.microsoft.com/en-us/library/038tzxdw.aspx

    To break when an exception is not handled by My Code

    1. On the Debug menu, click Exceptions.

    2. In the Exceptions dialog box, select User-unhandled for an entire category of exceptions, for example, Common Language Runtime Exceptions.

      -or-

      Expand the node for a category of exceptions, for example, Common Language Runtime Exceptions, and select User-unhandled for a specific exception within that category.

    3. Click OK.

    Related thread:
    http://social.msdn.microsoft.com/forums/en-US/vbgeneral/thread/f9a03214-c17b-44d0-bacb-346c7aa62b9b


    Best regards,
    Martin Xie
    • Marked as answer by masuda0916 Wednesday, December 17, 2008 1:02 AM
    Tuesday, December 16, 2008 10:08 AM

All replies

  • Can you show portion of code (4 lines back and few ahead) where you declare your streamWriter? Probably it is late binding? Or using CType from object?
    Posting you abusive right now, and all of your posts!
    Thursday, December 11, 2008 2:52 AM
  • Hi konikula,

    Thank you for your response.

    Below is the code,

    Const AllowIP_List As String = "Grant.txt"

     Try
                If My.Computer.FileSystem.FileExists(SiteLocationTextBox.Text + "\" + AllowIP_List) = False Then
                    Dim fs As FileStream = New FileStream(SiteLocationTextBox.Text + "\" + AllowIP_List, FileMode.CreateNew)
                    fs.Close()
                End If

                Dim writer As StreamWriter = New StreamWriter(SiteLocationTextBox.Text + "\" + AllowIP_List, False)

                Dim obj As String
                For Each obj In AccessGrantedList.Items
                    MsgBox(obj.ToString)
                    writer.WriteLine(Trim(obj.ToString))
                Next
                writer.Flush()
                writer.Close()
       
    Catch ex As Exception
               MsgBox(ex)
    End Try


    Hope to hear from you soon.

    Thursday, December 11, 2008 3:00 AM
  • Hmm, I restarted the pc, and now the JIT debugging exception does not appear any more.

    I wonder what went wrong (@_@)
    • Proposed as answer by konikula Thursday, December 11, 2008 2:04 PM
    • Marked as answer by Martin Xie - MSFT Tuesday, December 16, 2008 9:51 AM
    Thursday, December 11, 2008 5:31 AM
  •  :) Yeah, sometimes a parrot talks.
    Posting you abusive right now, and all of your posts!
    Thursday, December 11, 2008 2:02 PM
  • Probably try to replace your create file with IO.File.Create method...? It could eliminate errors also in "wrong system conditions"... but who knows.
    Posting you abusive right now, and all of your posts!
    • Proposed as answer by konikula Friday, December 12, 2008 8:37 AM
    • Unproposed as answer by Martin Xie - MSFT Tuesday, December 16, 2008 9:54 AM
    Thursday, December 11, 2008 2:07 PM
  • Hi konikula,

    Ok! Sure. Thank you for your suggestion.

    However, the error occured at the stream writer if it doesn't enter the if block.
    Thursday, December 11, 2008 11:51 PM
  • :) em, and probably also dispose writer after closing... There is nothing else what could be enchanced ;)
    I hope it will occure no more.
    best wishes, konikula
    Posting you abusive right now, and all of your posts!
    • Proposed as answer by konikula Friday, December 12, 2008 8:37 AM
    • Unproposed as answer by Martin Xie - MSFT Tuesday, December 16, 2008 9:54 AM
    Friday, December 12, 2008 3:56 AM
  • I see. I hope so too.

    Thank you (^^)

    Friday, December 12, 2008 4:06 AM
  • Thank you konikula for your friendly help. 

    Hi masuda,

    Here is one document for you to check:

    How to: Break on User-Unhandled Exceptions
    http://msdn.microsoft.com/en-us/library/038tzxdw.aspx

    To break when an exception is not handled by My Code

    1. On the Debug menu, click Exceptions.

    2. In the Exceptions dialog box, select User-unhandled for an entire category of exceptions, for example, Common Language Runtime Exceptions.

      -or-

      Expand the node for a category of exceptions, for example, Common Language Runtime Exceptions, and select User-unhandled for a specific exception within that category.

    3. Click OK.

    Related thread:
    http://social.msdn.microsoft.com/forums/en-US/vbgeneral/thread/f9a03214-c17b-44d0-bacb-346c7aa62b9b


    Best regards,
    Martin Xie
    • Marked as answer by masuda0916 Wednesday, December 17, 2008 1:02 AM
    Tuesday, December 16, 2008 10:08 AM
  • Hi Martin,

    Thank you for the follow-up.

    I will refer back to the links if the problem should occur again.
    Wednesday, December 17, 2008 1:01 AM