Beginner level task to practice fixing the most common compiler errors.
Estimated time to complete the task - 1h.
The task requires .NET 6 SDK installed.
The task has five sub-tasks. Each sub-task is a small coding exercise.
- Build the solution.
- Click on the menu item - Build\Build Solution.
- Or use the default keyboard shortcut - Ctrl+Shift+B (different versions of Visual Studio may have different keyboard shortcuts. See Keyboard shortcuts in Visual Studio article).
- Open the Error List view.
- Click on the menu item - View\Error List.
- Or use the default shortcut - Ctrl+\, E.
- Find an error with CS0103 code and review the error in detail by clicking on the link in the "Code" column.
You will get to the issue documentation page.
- Double-click on the CS0103 issue in the Error List window.
You will get to the CS0103/MyClass.cs file.
-
Read the documentation page and learn how to fix the error: "Check the spelling of the name and check your using directives and assembly references to make sure that the name that you are trying to use is available."
-
Replace the name of the method called in the return statement with correct spelling - ReturnInt.
public static int MyMethod()
{
return ReturnInt(intParameter: 534_947_886);
}- Rebuild the solution.
- Open the Error List window again and make sure there are no CS0103 issues.
- Open the Error List window, find the CS0117 issue.
- Open and read the issue documentation page.
- Navigate to the code by clicking on the issue line in Error List window.
- Replace the name of the method called in the return statement with correct spelling - ReturnLong.
public static long MyMethod()
{
return AnotherClass.ReturnLong(longParameter: 49_023_471L);
}- Rebuild the solution.
- Open the Error List window again and make sure there are no CS0117 issues anymore.
Fix the issue by removing the method argument from the method call.
public static int MyMethod()
{
return ReturnInt();
}Fix the issue by replacing the named parameter with correct argument name.
public static int MyMethod()
{
return ReturnInt(intParameter: 9_389_572);
}Fix the issue by adding the parameter to the ReturnInt method call.
public static int MyMethod()
{
return ReturnInt(5_689_375);
}Additional style and code checks are enabled for the projects in this solution to help you maintaining consistency of the project source code and avoiding silly mistakes. Review the Error List in Visual Studio to see all compiler warnings and errors.
If a compiler error or warning message is not clear, review errors details or google the error or warning code to get more information about the issue.
- Rebuild the solution.
- Fix all compiler warnings and errors. Make sure there are no warnings and errors in Error List.
- Run all unit tests, make sure all unit tests completed successfully.
- Review all changes, make sure that only the code files (.cs) in CompilerErrors project are changed.
Do not make any changes to project files (.csproj) or in code files in CompilerErrors.Tests project.
- Stage your changes.
All your changes are staged now.
- Create a commit and push your changes to remote repository.
















