List – A first chance exception of type ‘System.NullReferenceException’ occurred …

Posted in dotnet, vb, vb.net | No Comments »

Hi I have a function

 

public string foo(List<MyClass> someList)
        {
            foreach(MyClass item in someList) {
                Console.WriteLine("It doesn't get here");
            }

        }

 

 

When this function is executed the code exits before it reaches Console.Writeline, and generates

A first chance exception of type 'System.NullReferenceException' occurred in myProject.

 

Have I missed something really simple??? I'm guessing my tiredness is preventing spotting something really obvious

 

Thanks

Thomas

dp.SyntaxHighlighter.ClipboardSwf = ‘/dp.SyntaxHighlighter/Scripts/clipboard.swf’
dp.SyntaxHighlighter.HighlightAll(’1178ec577cd94bb3af41931982f0778d’)

Similar:

  1. A first chance exception of type ‘System.Data.Odbc.OdbcException’ occurred in System. Hi I have been trying to get the data display on the datagrid after selecting a customer. With the same connection it populates the selection...
  2. A first chance exception of type ‘System.OutOfMemoryException’ occurred in System.Xml.dll Error Hi, I am trying to read few xml files in a directory using fileinfo class.          Dim di As New IO.DirectoryInfo(Server.MapPath("OniFiles"))        Dim aryFi As IO.FileInfo()...
  3. ComboBox value’s This seems so stupid to me, but I do most of my coding in asp.net and never had this issue. Normally to add a item...
  4. Is it OK to declare variables “As New” in VB.NET In VB6 the advice was not to declare variables "As New" but to separate the declaration and initiation onto separate statements as in: Dim myForm...
  5. N-Tier DAL question. In my Data Access layer for my asp.net site I'm trying to get the connection string from the web.config file. I followed what was on...

Leave a Reply