The stack trace returned from the ASP.NET application created from ArgumentNullException gives the impression that an error occurs in the last line of the code below. As far as I can tell, this is not possible, but if the JIT optimized the call Bar, which leads to a different stack trace, this will explain everything. I know for sure that this is not a C # compiler, since CIL looks exactly as I expected. Is it possible that the JIT compiler has removed the call in Bar?
C # 4, .NET 4.0.30319.1, ASP.NET 4.0.30319.1
EDIT:
I should have mentioned that this is a release version, with optimizations code = on, Debug Info = pdb-only.
Stack Trace:
[ArgumentNullException: Value cannot be null. Parameter name: value]
CreateHiddenField(HtmlTextWriter tr, String name, String value) in Foo.cs:129
Foo(IHttpContext context, HtmlTextWriter writer) in Foo.cs:106
private static void Foo(IHttpContext context, HtmlTextWriter writer)
{
Bar(writer, AuthorizationServerResponseDetailsHttpRequestParser.RequestSAMLFieldName, context);
Bar(writer, AuthorizationServerResponseDetailsHttpRequestParser.RequestTargetFieldName, context);
CreateHiddenField(tr, name, string.Empty);
}
private static void Bar(HtmlTextWriter tr,string name, IHttpContext context)
{
#region Sanitation
if (tr == null) { throw new System.ArgumentNullException("tr"); }
if (name == null) { throw new System.ArgumentNullException("name"); }
if (context == null) { throw new System.ArgumentNullException("context"); }
#endregion
CreateHiddenField(tr, name, context.RequestQueryString(name));
}
private static void CreateHiddenField(HtmlTextWriter tr, string name, string value)
{
#region Sanitation
if (tr == null) { throw new System.ArgumentNullException("tr"); }
if (name == null) { throw new System.ArgumentNullException("name"); }
if (value == null) { throw new System.ArgumentNullException("value"); }
#endregion
}
source
share