Results 1 to 7 of 7

Thread: VS 2010 IDE crashes using this class

  1. #1

    Thread Starter
    Lively Member Blupig's Avatar
    Join Date
    Apr 2008
    Posts
    118

    Thumbs down VS 2010 IDE crashes using this class

    This class, along with a few others prominent in my projects, crashes the VS IDE:

    Code:
    Public Class IO
    Public Shared Function OpenString(ByVal FilePath As String) As String
            Try
                Dim objReader As New System.IO.StreamReader(FilePath)
                Dim ret As String = objReader.ReadToEnd
                objReader.Close()
                Return ret
            Catch ex As Exception
                Return Nothing
            End Try
        End Function
    
        Public Shared Sub SaveString(ByVal FilePath As String, ByVal SourceString As String)
            On Error Resume Next
            FileIO.FileSystem.WriteAllText(FilePath, SourceString, False)
        End Sub
    
        Public Shared Function FolderExists(ByVal FolderPath As String) As Boolean
    
            Dim f As New System.IO.DirectoryInfo(FolderPath)
            Return f.Exists
    
        End Function
    
        Public Shared Sub LoadList(ByRef ListObject As Object, ByVal FilePath As String)
            Dim r As System.IO.StreamReader
            r = New System.IO.StreamReader(FilePath)
            While (r.Peek() > -1)
                ListObject.Items.Add(r.ReadLine)
            End While
            r.Close()
    
        End Sub
    
        Public Shared Sub SaveList(ByVal ListObject As Object, ByVal FilePath As String)
    
            Dim w As System.IO.StreamWriter
            Dim i As Integer
            w = New System.IO.StreamWriter(FilePath)
            For i = 0 To ListObject.Items.Count - 1
                w.WriteLine(ListObject.Items.Item(i))
            Next
            w.Close()
    
        End Sub
    
        Public Shared Sub ListFiles(ByRef L As Object, ByVal folderpath As String, Optional ByVal extension As String = "*.dll")
    
            Try
                Dim DirInfo As New DirectoryInfo(folderpath)
                Dim FileInfoArray() As FileInfo = DirInfo.GetFiles(extension)
                Dim FileInfo As FileInfo
    
                Dim FileCount As Integer = 0
                For Each FileInfo In FileInfoArray
                    FileCount = FileCount + 1
                    L.Items.Add(FileInfo.Name)
    
                Next
            Catch ex As Exception
                ErrMsg()
            End Try
    
        End Sub
    
    End Class
    What the hell is wrong? I've tried just about everything from compatibility mode to admin to a couple registry edits...I've even reinstalled and am seriously considering a reformat. It does the same on my friend's VS. Apparently it's LoadList that does it in this particular class, but as I said before, a couple of my modules/classes in various other projects also pose the same issue, even without LoadList.

    Sorry if this is the wrong section.

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: VS 2010 IDE crashes using this class

    It's your class name... at least that's the first thing that jumped out at me. It maybe conflicting with the built-in IO namespace that's already part of the .NET Framework.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Lively Member Blupig's Avatar
    Join Date
    Apr 2008
    Posts
    118

    Re: VS 2010 IDE crashes using this class

    Quote Originally Posted by techgnome View Post
    It's your class name... at least that's the first thing that jumped out at me. It maybe conflicting with the built-in IO namespace that's already part of the .NET Framework.

    -tg
    A friend and I have actually resolved it, it's a pretty big bug in the IDE. Sometimes (note: not always) when trying to view a class with a direct-object as an argument in a method, the IDE crashes. So, in this specific class, I had to change the Object argument in the LoadList method to an IList object.

    Thanks for replying, though

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: VS 2010 IDE crashes using this class

    "Sometimes (note: not always) when trying to view a class with a direct-object as an argument in a method, the IDE crashes." -- uuuuh... WHAT? I didn't follow... what do you mean "direct object"...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: VS 2010 IDE crashes using this class

    FYI - I copied your code.... changing only two lines, I got it to compile just fine... so I'm not sure what you're doing that's causing the crash.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  6. #6
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: VS 2010 IDE crashes using this class

    Quote Originally Posted by techgnome View Post
    FYI - I copied your code.... changing only two lines, I got it to compile just fine... so I'm not sure what you're doing that's causing the crash.

    -tg
    Maybe you should tell us which two lines you changed in the original code?
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  7. #7
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: VS 2010 IDE crashes using this class

    I imported the IO namespace... and commented out the call to the ErrMsg() function as it wasn't in the code. That's it.

    Now, I said it compiled... didn't actually make any calls to it... since I'm not sure how it was being called or used...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width