shabbirh / elmah

Automatically exported from code.google.com/p/elmah
Apache License 2.0
0 stars 0 forks source link

System.ArgumentException JSON view #308

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I have an error with System.NullReferenceException
2. I want to see it in JSON

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

What is the expected output? What do you see instead?
Expected output:
Raw/Source data in JSON.

I see instead: 
Server Error in '/' Application.
________________________________________
Exception of type 'System.ArgumentException' was thrown.
Parameter name: name
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.ArgumentException: Exception of type 
'System.ArgumentException' was thrown.
Parameter name: name

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: 

[ArgumentException: Exception of type 'System.ArgumentException' was thrown.
Parameter name: name]
   Elmah.JsonTextWriter.Member(String name) +130
   Elmah.ErrorJson.Member(JsonTextWriter writer, String name, NameValueCollection collection) +267
   Elmah.ErrorJson.Encode(Error error, JsonTextWriter writer) +417
   Elmah.ErrorJson.EncodeEnclosed(Error error, JsonTextWriter writer) +28
   Elmah.ErrorJson.Encode(Error error, TextWriter writer) +49
   Elmah.ErrorJsonHandler.ProcessRequest(HttpContext context) +117
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

________________________________________
Version Information: Microsoft .NET Framework Version:2.0.50727.5456; ASP.NET 
Version:2.0.50727.5456

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

What version of the product are you using? On what operating system?
Elmah v=1.2.2(NuGet), v=1.2.14706.0(properties in solution explorer); Windows 7

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

Please provide any additional information below.
View in XML looks fine.

I think the problem occurs because JSON can’t create an ‘empty’ key.
XML part that I think causes the error for JSON:
<queryString>
<item name="">
<value string="fb_xd_fragment"/>
<value string=""/>
</item>
</queryString>
Rest of the view in XML looks fine.
And query string is: "(...)default.aspx?fb_xd_fragment&"

Original issue reported on code.google.com by tom.k...@gmail.com on 15 Aug 2012 at 2:48

GoogleCodeExporter commented 9 years ago

Original comment by azizatif on 1 Sep 2013 at 5:51

GoogleCodeExporter commented 9 years ago
Could you elaborate on the steps to reproduce this bug? I'm not sure what you 
mean.

Original comment by thomasar...@gmail.com on 1 Sep 2013 at 6:24

GoogleCodeExporter commented 9 years ago
@thomasardal: I think I understand what the problem might be. If the error is 
logged during an HTTP request where the query string portion in the URL has an 
unnamed key (e.g. http://www.example.com/foo?bar) then recalling the JSON for 
that error breaks.

Original comment by azizatif on 1 Sep 2013 at 6:46

GoogleCodeExporter commented 9 years ago
@thomasardal: I just tried and managed to reproduce the issue. Assuming a 
domain like www.example.com and ELMAH handler configured at /elmah.axd, log a 
test error using the URL http://www.example.com/elmah.axd/test?foo. The bug can 
then be provoked by visiting the error log page, going to the detail page of 
the logged error and asking for the JSON format.

Original comment by azizatif on 1 Sep 2013 at 6:59

GoogleCodeExporter commented 9 years ago
Thanks! I will look into it.

Original comment by thomasar...@gmail.com on 1 Sep 2013 at 7:10

GoogleCodeExporter commented 9 years ago
There's a fix for this issue here: 
https://bitbucket.org/raboof/elmah/pull-request/1/fixed-issue-308/diff

Original comment by thomasar...@gmail.com on 10 Sep 2013 at 2:46

GoogleCodeExporter commented 9 years ago
This issue was closed by revision bee042968522.

Original comment by thomasar...@gmail.com on 17 Oct 2013 at 8:50