I have in a Razor view file:
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
<pre>@Model.Exception.Message</pre>
<pre>@Model.Exception.InnerException?.Message</pre>
<pre>@Model.info</pre>
The InnerException?.Message
shows more than the Message
property. It looks like the output of the ToString()
method:
If I instead of the null conditional operator I used:
@if (Model.Exception.InnerException != null)
{
<pre>@Model.Exception.InnerException.Message</pre>
}
then it comes out as I wanted:
Is the syntax I am using for the null conditional operator incorrect?