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 Inheritance in Code

Alwin Landler
Alwin Landler
1,070 Points

Compilation error CS9010


I am getting the following error: treehouse:~/workspace$ mcs -out:TreehouseDefense.exe *.cs && mono TreehouseDefense.exe
Point.cs(22,7): error CS9010: Primary constructor body is not allowed
Compilation failed: 1 error(s), 0 warnings

Here are the snapshots: https://w.trhou.se/d1wf35x96h https://w.trhou.se/hodt2yy21i

Can you help me find what I am missing? Thanks.

1 Answer

Steven Parker
Steven Parker
230,248 Points

You only need one snapshot, since it stores the entire project.

On line 21 of "Point.cs" (the line just before the one indicated in the error message), there's a stray semicolon at the end of the line.

Once you fix that, you'll notice an additional issue on line 1 of "MapLocation.cs", where there is "treehouseDefense" (with lower-case "t") instead of "TreehouseDefense" (with capital "T").

Alwin Landler
Alwin Landler
1,070 Points

Thanks! I ought to pay more attention to details.. :)