3

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
  • 294
  • 7
  • 20

1 Answers1

9

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

@{System.Diagnostics.Debug.WriteLine("asdf");}
Richard Szalay
  • 81,010
  • 19
  • 172
  • 232