1

Often in c# (and possibly other languages) error messages will contain < and > characters, especially if they use generics.

For example:


The type arguments for method 'System.Linq.Enumerable.Join (System.Collections.Generic.IEnumerable, System.Collections.Generic.IEnumerable, System.Func, System.Func, System.Func)' cannot be inferred from the usage. Try specifying the type arguments explicitly.


There are a lot of characters missing in the above text, which markdown removes. Markdown believes it's html, and removes it.

The site's consensus is to put errors in blockquotes. When I do this, markdown will still remove the offending characters.

The type arguments for method 'System.Linq.Enumerable.Join (System.Collections.Generic.IEnumerable, System.Collections.Generic.IEnumerable, System.Func, System.Func, System.Func)' cannot be inferred from the usage. Try specifying the type arguments explicitly."

I can also make it a code block, but this is tedious and does not look as nice.

The type arguments for method 
'System.Linq.Enumerable.Join<TOuter,TInner,TKey,TResult>(System.Collections.
Generic.IEnumerable<TOuter>, System.Collections.Generic.IEnumerable<TInner>, 
System.Func<TOuter,TKey>, System.Func<TInner,TKey>, System.Func<TOuter,TInner,
TResult>)' cannot be inferred from the usage. Try specifying the type arguments 
explicitly.

So, there has to be an easier way to do this. Cupcake blew my mind recently (link gone) by posting an entire answer in blockquotes. I hope there is something just as easy to fix this.

How can I show the full error without markdown removing characters with the least amount of effort on my part (the editor or author)?

If you really want to know, this is the question I was trying to edit where I came across this problem

2
  • 1
    I think the code block looks nicer, and I don't see how its any more tedious then blockquotes. At least not with your example. If the text isn't already wrapped you can use back ticks instead of a code block.
    – Ross Ridge
    Commented Sep 2, 2014 at 21:10
  • Just a note: mixing blockquotes and code doesn't render the same on the mobile site, since blockquotes are handled differently there. And, FWIW, I agree with Ross. I think code blocks look better, and are easier to visually parse.
    – Mike M.
    Commented Sep 3, 2014 at 0:16

2 Answers 2

3

Check out my edit. To quote,

To insert the literal character < into a blockquote, use &lt; and it will show up as <.

No need to entitize > as well, it seems Markdown is smart enough to leave them alone.

Pity there is no easy \escaping them.

3
  • I know that fixes it, but I RREEEEAAALLYYY don't want to do that, but it's easier than code-blocking.
    – gunr2171
    Commented Sep 2, 2014 at 20:03
  • @gunr2171: then imagine this, I did it using my iPad. No fun at all :-) Behind a proper computing device I'd cut the blockquote into a text editor, find/change, copy back. Ten seconds tops, against the painful minutes of arduously attemtping to drag that damn itty bitty little cursor into position ...
    – Jongware
    Commented Sep 2, 2014 at 20:07
  • Well, +1 for dedication. But yeah, I was hoping there was some super-easy built in method, but this is a good alternative.
    – gunr2171
    Commented Sep 2, 2014 at 20:09
2

You don't have to choose one or the other, you can mix quote and code formatting.

The type arguments for method 'System.Linq.Enumerable.Join<TOuter,TInner,TKey,TResult> (System.Collections.Generic.IEnumerable<TOuter>, System.Collections.Generic.IEnumerable<TInner>, System.Func<TOuter,TKey>, System.Func<TInner,TKey>, System.Func<TOuter,TInner,TResult>)' cannot be inferred from the usage. Try specifying the type arguments explicitly.

0

Not the answer you're looking for? Browse other questions tagged .