Resolved Head First C#: Animal Matching Game Event Handler

veeringnugget

New member
Joined
Sep 19, 2025
Messages
1
Programming Experience
Beginner
Hi all,

I'm very new to learning C# and I've delved into the book Head First C# 5th Edition. I've only coded using VS Code before so this is my first look at using Visual Studio.

In the first project, I set it up as per the book, using a .NET MAUI project. I've added the button and it tells you to add an Event Listener and this should automatically add the code to MainPage.xaml.cs, however, it didn't.

1758276757731.png


After a few tries, I tried clicking the intelliSense of <New Event Handler> and I get a pop-up saying "Failed to create event handler".

Here's a screenshot of what i'm seeing on my side:

1758276997677.png


I ended up having a slight nightmare the first time I tried it and for whatever reason the Toolbox wasn't showing anything. I found online to reset that and once I finally was able to drag it into my MainPage.xaml, the properties was picking up nothing other than my vertical stack so I did just reinstall the software and re-create the project. I also have followed along to the YouTube video they create alongside the book to see if I'd clicked something accidentally:

I also appreciate I could do it manually, but i'm just very curious on what it could be?

Sorry, this is super new to me, would appreciate any help.

Cheers.
 
It sounds like your VS installation is broken somehow. I recommend running the Installer again and using the Repair option. That should hopefully address the issue. If it doesn't, you might have to uninstall and reinstall.
 
As an aside, do you have full admin rights to your machine, or is there an IT team that manages your machine and gives you temporary admin or sort of reduced admin rights? My work machine falls in the latter case, and VS has some quirky behavior.

As much as Microsoft has done work in the late 2010's to let developers do work as non-admins, they still have a ways to go when they assume that a non-admins can simply elevate to Administrator when needed. Scenarios like when the elevated account is not the default Administrator, but rather another user with admin rights on the machine, or when tools like DefendPoint give the illusion that the current user is temporarily in the Administrators group, but actually has just a subset of the full local Administrator rights have to be worked out by Microsoft. Or MS will need to figure out how to make the Windows privileges more granular than they currently are so that it's not full Administrator or nothing when a developer is the primary user.
 
Last edited:
Back
Top Bottom