Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# C# Objects Inheritance Throwing Exceptions

My console outputs an error pinpoint at (10, 55) when my program only has 5 lines of code.

I am doing a Challenge Task, and I keep getting an error, with the hint telling me to check my console. The console tells me that value (the integer I'm using In this) is not positioned correctly, or something like that, but it also tells me that the error is located at (10, 55). My program only has 5 lines of code, with none of them being long enough to extend to the next line, which is making it impossible to tell where the error is.

Program.cs
try {
    int value = int.Parse(Console.ReadLine());
} catch(Exception) {
    Console.WriteLine(string.Format("You entered {0}",value));
}

1 Answer

Steven Parker
Steven Parker
231,268 Points

The challenge internally uses some boilerplate code that is throwing off the error position in the compiler output.

But the important thing is that for this challenge, you only need to test the value and throw the exception. You won't need "try" or "catch" for this one.