1

I have the following code:

using System.Diagnostics;

namespace test
{
    class Class1
    {
        static void Main()
        {
            Debug.WriteLine("hello world");
        }
    }
}

It results in the following errors:

Error CS0103 The name 'Debug' does not exist in the current context test
The parameter to the compiler is invalid, '/define:/d:DEBUG' will be ignored.

enter image description here

Why can't I use Debug.Print()?

11
  • 2
    What project did you start with, a .NET Core project? Commented May 16, 2018 at 21:04
  • 1
    What platform are you targeting? Commented May 16, 2018 at 21:07
  • 1
    Debug should exist in System.Diagnostics for any normal project, regardless of whether the DEBUG identifier is defined for the compiler or not. How did you get this project started? What kind of project is this? Commented May 16, 2018 at 21:08
  • There is no such thing as Debug.Print, however, but your screenshot doesn't show you trying to use that so I'm going to guess you're simple misrepresenting the code you're trying to compile in that comment, is that correct? Commented May 16, 2018 at 21:09
  • @LasseVågsætherKarlsen There is Debug.Print() Commented May 16, 2018 at 21:10

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.