4

I'm trying to use Debug.Writeline in a razor web page and I keep getting invalid arguments messages.

@System.Diagnostics.Debug.WriteLine("asdf");

returns

CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments

CoreyH
  • 464
  • 9
  • 21

1 Answers1

11

Debug.WriteLine does not return a value so it can't be written out using @. Try:

@{System.Diagnostics.Debug.WriteLine("asdf");}
Richard Szalay
  • 83,269
  • 19
  • 178
  • 237