Closed GoogleCodeExporter closed 8 years ago
This updated regular expression for ErrorDetailPage seems to work. I haven't
tested it in the ELMAH code yet but I've tried it in an online regex tester
(RegexHero) and it seems to work with both Microsoft stack traces and Mono
stack traces:
^
\s*
\w+ \s+
(?<type> .+ ) \.
(?<method> .+? )
(?<params> \( (?<params> .*? ) \) )
(
(?# Microsoft .NET stack traces )
( \s+
\w+ \s+
(?<file> [a-z] \: .+? )
\: \w+ \s+
(?<line> [0-9]+ ) \p{P}? )
|
(?# Mono stack traces )
( \s+
\[0x\d+\] \s in \s
<(?<file> [^>]+ )>
:(?<line> [0-9]+ )
)
)?
\s*
$
Original comment by daniel@d15.biz
on 15 Dec 2012 at 11:34
Thanks for reporting and helping out with a Regex that works for both
platforms. Just curious, how are you getting double parentheses in your second,
Microsoft .NET, stack trace?
IExecutionStep.Execute(())
Original comment by azizatif
on 16 Dec 2012 at 3:35
To be honest, I have no idea. I just copied the message straight from ELMAH.
Original comment by daniel@d15.biz
on 16 Dec 2012 at 9:55
That's strange... I tried replicating the double parentheses and it's not
happening any more? I deleted the old database while doing some other dev work
so don't have a copy of the data with the double parentheses. Oh well.
Original comment by daniel@d15.biz
on 17 Dec 2012 at 11:04
Here's one I got today that was highlighted weirdly:
System.Exception: Couldn't get social share count for Twitter --->
System.Net.WebException: libMonoPosixHelper.so --->
System.DllNotFoundException: libMonoPosixHelper.so
at (wrapper managed-to-native) System.IO.Compression.DeflateStream:CreateZStream ((System.IO.Compression.CompressionModeboolSystem.IO.Compression.DeflateStream/UnmanagedReadOrWriteintptr))
at System.IO.Compression.DeflateStream..ctor (System.IO.Stream compressedStream, CompressionMode mode, Boolean leaveOpen, Boolean gzip) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.IO.Compression.DeflateStream:.ctor ((System.IO.StreamSystem.IO.Compression.CompressionModeboolbool))
at System.IO.Compression.GZipStream..ctor (System.IO.Stream compressedStream, CompressionMode mode, Boolean leaveOpen) [0x00000] in <filename unknown>:0
at System.IO.Compression.GZipStream..ctor (System.IO.Stream compressedStream, CompressionMode mode) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.IO.Compression.GZipStream:.ctor ((System.IO.StreamSystem.IO.Compression.CompressionMode))
at System.Net.HttpWebResponse..ctor (System.Uri uri, System.String method, System.Net.WebConnectionData data, System.Net.CookieContainer container) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.Net.HttpWebResponse:.ctor ((System.UristringSystem.Net.WebConnectionDataSystem.Net.CookieContainer))
at System.Net.HttpWebRequest.SetResponseData (System.Net.WebConnectionData data) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0
at ServiceStack.Text.WebRequestExtensions.GetStringFromUrl (System.String url, System.String acceptContentType, System.Action`1 responseFilter) [0x00000] in <filename unknown>:0
at ServiceStack.Text.WebRequestExtensions.GetJsonFromUrl (System.String url, System.Action`1 responseFilter) [0x00000] in <filename unknown>:0
at Daniel15.Web.Services.Social.Twitter.GetShareCount (Daniel15.Web.Models.Blog.PostSummaryModel post, System.String url, System.String shortUrl) [0x00000] in <filename unknown>:0
at Daniel15.Web.Services.Social.SocialManager.ShareCounts (Daniel15.Web.Models.Blog.PostSummaryModel post, System.String url, System.String shortUrl) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
Screenshot of how it was highlighted by ELMAH is attached.
Original comment by daniel@d15.biz
on 19 Dec 2012 at 11:59
Attachments:
Thanks for the follow ups. I was going through the regular expression yesterday
and might have spotted where the double parentheses might be coming from.
Strange that I have never come across it. Which version are you using and is
that screenshot coming from ELMAH running on the Mono platform?
Original comment by azizatif
on 19 Dec 2012 at 6:59
Yes, the screenshot is coming from ELMAH running on Mono. I'm using Mono 3.0.2
(.NET Framework 4.0) and ELMAH 1.2 SP2 (installed via NuGet).
Original comment by daniel@d15.biz
on 20 Dec 2012 at 7:31
In that case, I have a feeling that Regex on Mono might be behaving slightly
differently and is capturing the extra parentheses (yet not always?) but I'll
double-check that against stack traces in existing logs and on Microsoft .NET
Framework.
Original comment by azizatif
on 20 Dec 2012 at 7:38
Yeah I've heard the regex engine in Mono sometimes does things a bit
differently so it could be hitting some edge case in its engine.
I'm happy to beta test any changes if you like :)
Original comment by daniel@d15.biz
on 20 Dec 2012 at 8:16
Original comment by azizatif
on 23 Dec 2012 at 12:19
This issue was closed by revision 4772b05acf51.
Original comment by azizatif
on 23 Dec 2012 at 12:40
> I'm happy to beta test any changes if you like :)
Let me know how that goes :)
Original comment by azizatif
on 23 Dec 2012 at 12:41
The latest version of ELMAH crashes when I try to go to elmah.axd - Looks like
HttpBrowserCapabilitiesBase.CreateHtmlTextWriter isn't implemented in Mono:
System.NotImplementedException
The requested feature is not implemented.
at System.Web.HttpBrowserCapabilitiesWrapper.CreateHtmlTextWriter (System.IO.TextWriter w) [0x00000] in <filename unknown>:0
at Elmah.SpeedBar+<>c__DisplayClass3.<Render>b__1 (System.IO.TextWriter writer) [0x00000] in <filename unknown>:0
at Elmah.HelperResult.WriteTo (System.IO.TextWriter writer) [0x00000] in <filename unknown>:0
at Elmah.HelperResult.ToHtmlString () [0x00000] in <filename unknown>:0
at Elmah.WebTemplateBase.Write (System.Object value) [0x00000] in <filename unknown>:0
at Elmah.MasterPage.Execute () [0x00000] in <filename unknown>:0
at Elmah.RazorTemplateBase.TransformText () [0x00000] in <filename unknown>:0
at Elmah.WebTemplateBase.TransformText () [0x00000] in <filename unknown>:0
at Elmah.RazorTemplateBase.TransformText () [0x00000] in <filename unknown>:0
at Elmah.WebTemplateBase.TransformText () [0x00000] in <filename unknown>:0
at Elmah.WebTemplateBase.ProcessRequest () [0x00000] in <filename unknown>:0
at Elmah.WebTemplateBase.System.Web.IHttpHandler.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0
at System.Web.HttpApplication+<Pipeline>c__Iterator3.MoveNext () [0x00000] in <filename unknown>:0
at System.Web.HttpApplication.Tick () [0x00000] in <filename unknown>:0
Should I raise this as a separate bug?
Original comment by daniel@d15.biz
on 23 Dec 2012 at 1:18
I "fixed" the above issue by not using browser.CreateHtmlTextWriter - That is,
changing this:
return Render(browser.CreateHtmlTextWriter, items);
To this:
return Render((Func<TextWriter, HtmlTextWriter>)null, items);
In SpeedBar.cs. Not sure if this may break something, but it appears to be
working. And the syntax highlighting is working too. Screenshot attached :)
Original comment by daniel@d15.biz
on 23 Dec 2012 at 1:28
Attachments:
I just found an error that appears to get it stuck in a very long loop. Takes a
long time to render the page in ELMAH (MiniProfiler says 17 seconds on Windows
and 21 seconds on Linux Mono) and the worker process uses 100% CPU the whole
time. Happens on both Microsoft .NET and Mono. Here's the stack trace causing
the problem:
System.Web.HttpRequestValidationException: A potentially dangerous
Request.QueryString value was detected from the client (test="<p>asd").
at System.Web.HttpRequest.ThrowValidationException (System.String name, System.String key, System.String value) [0x00040] in /usr/local/src/mono-3.0.2/mcs/class/System.Web/System.Web/HttpRequest.cs:1723
at System.Web.HttpRequest.ValidateString (System.String key, System.String value, RequestValidationSource source) [0x00019] in /usr/local/src/mono-3.0.2/mcs/class/System.Web/System.Web/HttpRequest.cs:1734
at Microsoft.Web.Infrastructure.DynamicValidationHelper.LazyWebROCollection.Validate (System.String key, System.String value) [0x0000d] in /usr/local/src/mono-3.0.2/mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicValidationHelper/LazyWebROCollection.cs:134
at Microsoft.Web.Infrastructure.DynamicValidationHelper.LazyWebROCollection.Get (System.String name) [0x00000] in /usr/local/src/mono-3.0.2/mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicValidationHelper/LazyWebROCollection.cs:86
at System.Collections.Specialized.NameValueCollection.get_Item (System.String name) [0x00000] in /usr/local/src/mono-3.0.2/mcs/class/System/System.Collections.Specialized/NameValueCollection.cs:117
at System.Web.HttpRequest.ValidateNameValueCollection (System.String name, System.Collections.Specialized.NameValueCollection coll) [0x00018] in /usr/local/src/mono-3.0.2/mcs/class/System.Web/System.Web/HttpRequest.cs:1643
at System.Web.HttpRequest.get_QueryString () [0x0005c] in /usr/local/src/mono-3.0.2/mcs/class/System.Web/System.Web/HttpRequest.cs:1183
at System.Web.HttpRequestWrapper.get_QueryString () [0x00000] in /usr/local/src/mono-3.0.2/mcs/class/System.Web.Abstractions/System.Web/HttpRequestWrapper.cs:186
at System.Web.Mvc.QueryStringValueProvider..ctor (System.Web.Mvc.ControllerContext controllerContext, IUnvalidatedRequestValues unvalidatedValues) [0x00000] in <filename unknown>:0
at System.Web.Mvc.QueryStringValueProviderFactory.GetValueProvider (System.Web.Mvc.ControllerContext controllerContext) [0x00000] in <filename unknown>:0
at System.Web.Mvc.ValueProviderFactoryCollection+<>c__DisplayClassc.<GetValueProvider>b__7 (System.Web.Mvc.ValueProviderFactory factory) [0x00000] in <filename unknown>:0
at System.Linq.Enumerable+<CreateSelectIterator>c__Iterator1C`2[System.Web.Mvc.ValueProviderFactory,<>f__AnonymousType2`2[System.Web.Mvc.ValueProviderFactory,System.Web.Mvc.IValueProvider]].MoveNext () [0x00059] in /usr/local/src/mono-3.0.2/mcs/class/System.Core/System.Linq/Enumerable.cs:2269
at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator2A`1[<>f__AnonymousType2`2[System.Web.Mvc.ValueProviderFactory,System.Web.Mvc.IValueProvider]].MoveNext () [0x0006f] in /usr/local/src/mono-3.0.2/mcs/class/System.Core/System.Linq/Enumerable.cs:3115
at System.Linq.Enumerable+<CreateSelectIterator>c__Iterator1C`2[<>f__AnonymousType2`2[System.Web.Mvc.ValueProviderFactory,System.Web.Mvc.IValueProvider],System.Web.Mvc.IValueProvider].MoveNext () [0x00059] in /usr/local/src/mono-3.0.2/mcs/class/System.Core/System.Linq/Enumerable.cs:2269
at System.Collections.Generic.List`1[System.Web.Mvc.IValueProvider].AddEnumerable (IEnumerable`1 enumerable) [0x00013] in /usr/local/src/mono-3.0.2/mcs/class/corlib/System.Collections.Generic/List.cs:134
at System.Collections.Generic.List`1[System.Web.Mvc.IValueProvider]..ctor (IEnumerable`1 collection) [0x0002f] in /usr/local/src/mono-3.0.2/mcs/class/corlib/System.Collections.Generic/List.cs:69
at System.Linq.Enumerable.ToList[IValueProvider] (IEnumerable`1 source) [0x00006] in /usr/local/src/mono-3.0.2/mcs/class/System.Core/System.Linq/Enumerable.cs:2951
at System.Web.Mvc.ValueProviderFactoryCollection.GetValueProvider (System.Web.Mvc.ControllerContext controllerContext) [0x00000] in <filename unknown>:0
at System.Web.Mvc.ControllerBase.get_ValueProvider () [0x00000] in <filename unknown>:0
at System.Web.Mvc.ControllerActionInvoker.GetParameterValue (System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ParameterDescriptor parameterDescriptor) [0x00000] in <filename unknown>:0
at System.Web.Mvc.ControllerActionInvoker.GetParameterValues (System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionDescriptor actionDescriptor) [0x00000] in <filename unknown>:0
at System.Web.Mvc.Async.AsyncControllerActionInvoker+<>c__DisplayClass25.<BeginInvokeAction>b__1e (System.AsyncCallback asyncCallback, System.Object asyncState) [0x00000] in <filename unknown>:0
Original comment by daniel@d15.biz
on 23 Dec 2012 at 1:42
Original issue reported on code.google.com by
daniel@d15.biz
on 15 Dec 2012 at 11:12