Exception: "Value cannot be null. Parameter name:s"

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chris Herring

    Exception: "Value cannot be null. Parameter name:s"

    Hi there: Well, let me start off by saying that I am a Visual Studio drag
    and drop weenie, not a real programmer. So I tend to get confused when
    things do not look like the instructions said they were going to look :) .
    Here is my current dilemma:

    I am having a strange problem with my ASP.NET application. I am building the
    application using Visual Basic .Net in Visual Studio.NET 2003. Lately, I
    have frequently been getting the following exception (see below) when I
    debug the application. If I step through my code and determine what is
    actually broken (the exception is not very informative), I find that the
    error has nothing whatsoever to do with the exception that is thrown. The
    really, really strange thing is this: When I get this error, the "real"
    exception always seems to be thrown from my code contained in a .vb class
    file. If I create a new .vb file, and cut-and-paste the code into the new
    file, delete the old file, and then re-run the application (with no actual
    changes to the code whatsoever), then I get the "real" exception instead of
    the "value cannot be null" exception. I have dozens and dozens of .vb class
    files.. so far have gone through this process on about 10 files. This is
    getting annoying. Has anyone experienced anything like this? I searched
    newsgroups and ms knowledgebase, but I did not find anything resembling my
    problem.
    -----------------------
    The exception:

    Value cannot be null. Parameter name: s
    Description: An unhandled exception occurred during the execution of the
    current web request. Please review the stack trace for more information
    about the error and where it originated in the code.

    Exception Details: System.Argument NullException: Value cannot be null.
    Parameter name: s

    Source Error:

    An unhandled exception was generated during the execution of the current web
    request. Information regarding the origin and location of the exception can
    be identified using the exception stack trace below.

    Stack Trace:

    [ArgumentNullExc eption: Value cannot be null.
    Parameter name: s]
    System.IO.Strin gReader..ctor(S tring s) +78
    System.Web.Form atterWithFileIn fo.GetSourceFil eLines(String fileName,
    Encoding encoding, String sourceCode, Int32 lineNumber)
    System.Web.Unha ndledErrorForma tter.get_Colore dSquareContent( )
    System.Web.Erro rFormatter.GetH tmlErrorMessage (Boolean
    dontShowSensiti veInfo)
    System.Web.Http Response.WriteE rrorMessage(Exc eption e, Boolean
    dontShowSensiti veErrors)
    System.Web.Http Response.Report RuntimeError(Ex ception e, Boolean canThrow)
    System.Web.Http Runtime.FinishR equest(HttpWork erRequest wr, HttpContext
    context, Exception e)

    ----------------------

    Regards,

    Chris Herring


  • Dennis Redfield

    #2
    Re: Exception: "Value cannot be null. Parameter name:s"

    Dear Weenie,
    without getting too deep into it....
    your stack dump shows:
    System.IO.Strin gReader..ctor(S tring s) +78
    where s is (presumably) the parameter it is complaining about beging null.
    A quick look in the docs shows the the consrtuctor (ctor) wants to have a
    non-null string
    since StringReader sits below things like TextReader. Are you passing a
    null string when you should be providing a file name??????????

    hope this helps.

    dlr



    "Chris Herring" <cherring32_n_o _s_p_a_m_@comca st.net> wrote in message
    news:fdadncg7qb IC44PdRVn-gQ@comcast.com. ..[color=blue]
    > Hi there: Well, let me start off by saying that I am a Visual Studio drag
    > and drop weenie, not a real programmer. So I tend to get confused when
    > things do not look like the instructions said they were going to look :) .
    > Here is my current dilemma:
    >
    > I am having a strange problem with my ASP.NET application. I am building[/color]
    the[color=blue]
    > application using Visual Basic .Net in Visual Studio.NET 2003. Lately, I
    > have frequently been getting the following exception (see below) when I
    > debug the application. If I step through my code and determine what is
    > actually broken (the exception is not very informative), I find that the
    > error has nothing whatsoever to do with the exception that is thrown. The
    > really, really strange thing is this: When I get this error, the "real"
    > exception always seems to be thrown from my code contained in a .vb class
    > file. If I create a new .vb file, and cut-and-paste the code into the new
    > file, delete the old file, and then re-run the application (with no actual
    > changes to the code whatsoever), then I get the "real" exception instead[/color]
    of[color=blue]
    > the "value cannot be null" exception. I have dozens and dozens of .vb[/color]
    class[color=blue]
    > files.. so far have gone through this process on about 10 files. This is
    > getting annoying. Has anyone experienced anything like this? I searched
    > newsgroups and ms knowledgebase, but I did not find anything resembling my
    > problem.
    > -----------------------
    > The exception:
    >
    > Value cannot be null. Parameter name: s
    > Description: An unhandled exception occurred during the execution of the
    > current web request. Please review the stack trace for more information
    > about the error and where it originated in the code.
    >
    > Exception Details: System.Argument NullException: Value cannot be null.
    > Parameter name: s
    >
    > Source Error:
    >
    > An unhandled exception was generated during the execution of the current[/color]
    web[color=blue]
    > request. Information regarding the origin and location of the exception[/color]
    can[color=blue]
    > be identified using the exception stack trace below.
    >
    > Stack Trace:
    >
    > [ArgumentNullExc eption: Value cannot be null.
    > Parameter name: s]
    > System.IO.Strin gReader..ctor(S tring s) +78
    > System.Web.Form atterWithFileIn fo.GetSourceFil eLines(String fileName,
    > Encoding encoding, String sourceCode, Int32 lineNumber)
    > System.Web.Unha ndledErrorForma tter.get_Colore dSquareContent( )
    > System.Web.Erro rFormatter.GetH tmlErrorMessage (Boolean
    > dontShowSensiti veInfo)
    > System.Web.Http Response.WriteE rrorMessage(Exc eption e, Boolean
    > dontShowSensiti veErrors)
    > System.Web.Http Response.Report RuntimeError(Ex ception e, Boolean[/color]
    canThrow)[color=blue]
    > System.Web.Http Runtime.FinishR equest(HttpWork erRequest wr, HttpContext
    > context, Exception e)
    >
    > ----------------------
    >
    > Regards,
    >
    > Chris Herring
    >
    >[/color]


    Comment

    • Chris Herring

      #3
      Re: Exception: &quot;Value cannot be null. Parameter name:s&quot;

      Dennis:

      Thanks for your reply.

      I think I have figured out what was happening. The second line in the stack
      trace:

      System.Web.Form atterWithFileIn fo.GetSourceFil eLines

      made me wonder if perhaps the debugger could not access the source file to
      display the stack trace for the "real" exception. Sure enough.. when I
      checked the priveleges on the source files the ASP.NET process did not have
      access to the files. I gave asp.net read access to the source files and the
      problem went away.

      Best regards,

      Weenie

      "Dennis Redfield" <dennis.redfiel d@acadia-ins.com> wrote in message
      news:Ond3lbb6DH A.1804@TK2MSFTN GP12.phx.gbl...[color=blue]
      > Dear Weenie,
      > without getting too deep into it....
      > your stack dump shows:
      > System.IO.Strin gReader..ctor(S tring s) +78
      > where s is (presumably) the parameter it is complaining about beging null.
      > A quick look in the docs shows the the consrtuctor (ctor) wants to have a
      > non-null string
      > since StringReader sits below things like TextReader. Are you passing a
      > null string when you should be providing a file name??????????
      >
      > hope this helps.
      >
      > dlr
      >
      >
      >
      > "Chris Herring" <cherring32_n_o _s_p_a_m_@comca st.net> wrote in message
      > news:fdadncg7qb IC44PdRVn-gQ@comcast.com. ..[color=green]
      > > Hi there: Well, let me start off by saying that I am a Visual Studio[/color][/color]
      drag[color=blue][color=green]
      > > and drop weenie, not a real programmer. So I tend to get confused when
      > > things do not look like the instructions said they were going to look :)[/color][/color]
      ..[color=blue][color=green]
      > > Here is my current dilemma:
      > >
      > > I am having a strange problem with my ASP.NET application. I am building[/color]
      > the[color=green]
      > > application using Visual Basic .Net in Visual Studio.NET 2003. Lately, I
      > > have frequently been getting the following exception (see below) when I
      > > debug the application. If I step through my code and determine what is
      > > actually broken (the exception is not very informative), I find that the
      > > error has nothing whatsoever to do with the exception that is thrown.[/color][/color]
      The[color=blue][color=green]
      > > really, really strange thing is this: When I get this error, the "real"
      > > exception always seems to be thrown from my code contained in a .vb[/color][/color]
      class[color=blue][color=green]
      > > file. If I create a new .vb file, and cut-and-paste the code into the[/color][/color]
      new[color=blue][color=green]
      > > file, delete the old file, and then re-run the application (with no[/color][/color]
      actual[color=blue][color=green]
      > > changes to the code whatsoever), then I get the "real" exception instead[/color]
      > of[color=green]
      > > the "value cannot be null" exception. I have dozens and dozens of .vb[/color]
      > class[color=green]
      > > files.. so far have gone through this process on about 10 files. This is
      > > getting annoying. Has anyone experienced anything like this? I searched
      > > newsgroups and ms knowledgebase, but I did not find anything resembling[/color][/color]
      my[color=blue][color=green]
      > > problem.
      > > -----------------------
      > > The exception:
      > >
      > > Value cannot be null. Parameter name: s
      > > Description: An unhandled exception occurred during the execution of the
      > > current web request. Please review the stack trace for more information
      > > about the error and where it originated in the code.
      > >
      > > Exception Details: System.Argument NullException: Value cannot be null.
      > > Parameter name: s
      > >
      > > Source Error:
      > >
      > > An unhandled exception was generated during the execution of the current[/color]
      > web[color=green]
      > > request. Information regarding the origin and location of the exception[/color]
      > can[color=green]
      > > be identified using the exception stack trace below.
      > >
      > > Stack Trace:
      > >
      > > [ArgumentNullExc eption: Value cannot be null.
      > > Parameter name: s]
      > > System.IO.Strin gReader..ctor(S tring s) +78
      > > System.Web.Form atterWithFileIn fo.GetSourceFil eLines(String fileName,
      > > Encoding encoding, String sourceCode, Int32 lineNumber)
      > > System.Web.Unha ndledErrorForma tter.get_Colore dSquareContent( )
      > > System.Web.Erro rFormatter.GetH tmlErrorMessage (Boolean
      > > dontShowSensiti veInfo)
      > > System.Web.Http Response.WriteE rrorMessage(Exc eption e, Boolean
      > > dontShowSensiti veErrors)
      > > System.Web.Http Response.Report RuntimeError(Ex ception e, Boolean[/color]
      > canThrow)[color=green]
      > > System.Web.Http Runtime.FinishR equest(HttpWork erRequest wr,[/color][/color]
      HttpContext[color=blue][color=green]
      > > context, Exception e)
      > >
      > > ----------------------
      > >
      > > Regards,
      > >
      > > Chris Herring
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...