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

Doesn't throw exception message.

I am not receiving the message in the console when I compile. I did not forget the '!' in the code. I even tried:

if(map.OnMap(this) != true)

and it still doesn't print. Link to my snapshot is here: https://w.trhou.se/3oq5fa0ldn Assistance greatly appreciated.

Shadab Khan
Shadab Khan
5,470 Points

Hi Anthony, I have forked out the project and tried to compile and run your project and it does show me the message "This is off the map homey" on my console output. The result IS as expected and I can't see any issue with the output. Have you tried recompiling your code and running it again for e.g. mcs *.cs TreehouseDefenseDev.exe && mono TreehouseDefenseDev.exe Let us know how you go.

What my plan is now is to continue on with the course and as the scripts are re-introduced I will examine each one to determine where the issue lies. I will post again once I find the issue.

1 Answer

Marko Kallaspoolik
Marko Kallaspoolik
10,455 Points

Hi Anthony!

I had the same issue. What I did was that I just saved the whole thing, then closed the console and lastly the workspace. After reopening the workspace the code was working just fine.