locked
Debug does not exist in the current context? RRS feed

  • Question

  • Hi to all,

    I recently started a new WPF Application Project and I added the following C# class to my project:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Diagnostics;
    
    namespace Wave
    {
        class WaveViewModel
        {
            Debug.WriteLine("Hello");
                
        }
    }

    However, I get the error message Debug.WriteLine does not exist in the current context.. Why? 

    As I type it sees the Debug and completes the word for me, but it doesn't show any of the methods that are available, such as WriteLine?

    Thanks in advance


    MarcinMR

    Monday, October 26, 2015 5:28 PM

Answers

  • Yes, I just noticed, I have the Debug outside of a method...Sorry everyone..

    MarcinMR

    • Proposed as answer by Andy ONeill Monday, October 26, 2015 7:02 PM
    • Marked as answer by Xavier Xie-MSFT Thursday, November 5, 2015 9:44 AM
    Monday, October 26, 2015 5:56 PM

All replies

  • Yes, I just noticed, I have the Debug outside of a method...Sorry everyone..

    MarcinMR

    • Proposed as answer by Andy ONeill Monday, October 26, 2015 7:02 PM
    • Marked as answer by Xavier Xie-MSFT Thursday, November 5, 2015 9:44 AM
    Monday, October 26, 2015 5:56 PM
  • Thank you for noting your solution! 
    Sunday, October 21, 2018 6:29 PM