diff --git a/docs/errata/README.md b/docs/errata/README.md index 2a7673b..f593dd8 100644 --- a/docs/errata/README.md +++ b/docs/errata/README.md @@ -2,7 +2,7 @@ If you find any mistakes in the seventh edition, *C# 11 and .NET 7 - Modern Cross-Platform Development Fundamentals*, or if you have suggestions for improvements, then please [raise an issue in this repository](https://github.com/markjprice/cs11dotnet7/issues) or email me at markjprice (at) gmail.com. -[**Errata** (32 items)](errata.md): Typos, tool user interface changes, or mistakes in code that would cause a compilation error that prevents a successful build. +[**Errata** (33 items)](errata.md): Typos, tool user interface changes, or mistakes in code that would cause a compilation error that prevents a successful build. [**Improvements** (16 items)](improvements.md): Changes to text or code that would improve the content. These are optional. diff --git a/docs/errata/errata.md b/docs/errata/errata.md index 2a27b8d..da81e01 100644 --- a/docs/errata/errata.md +++ b/docs/errata/errata.md @@ -1,4 +1,4 @@ -**Errata** (32 items) +**Errata** (33 items) If you find any mistakes, then please [raise an issue in this repository](https://github.com/markjprice/cs11dotnet7/issues) or email me at markjprice (at) gmail.com. @@ -15,6 +15,7 @@ If you find any mistakes, then please [raise an issue in this repository](https: - [Page 114 - Simplifying switch statements with switch expressions](#page-114---simplifying-switch-statements-with-switch-expressions) - [Page 156 - Calculating factorials with recursion](#page-156---calculating-factorials-with-recursion) - [Page 166 - Setting a breakpoint and starting debugging - Using Visual Studio 2022](#page-166---setting-a-breakpoint-and-starting-debugging---using-visual-studio-2022) +- [Page 178 - Reviewing project packages](#page-178---reviewing-project-packages) - [Page 185 - Creating a class library that needs testing](#page-185---creating-a-class-library-that-needs-testing) - [Page 188 - Running unit tests using Visual Studio Code](#page-188---running-unit-tests-using-visual-studio-code) - [Page 231 - Requiring properties to be set during instantiation](#page-231---requiring-properties-to-be-set-during-instantiation) @@ -187,6 +188,33 @@ At the end of this section I wrote, "If you do not want to see how to use Visual But the immediately following section is *Navigating with the debugging toolbar*. The paragraph should move to after this section and before the section titled *Using Visual Studio Code*, and it should say, "If you do not want to see how to use Visual Studio Code to start debugging, then you can skip the next section and continue to the section titled *Debugging windows*." +# Page 178 - Reviewing project packages + +> Thanks to [Nick Bettes](https://github.com/bettesn) and [Zhang Cheng](https://github.com/Matrix-Zhang) for raising this issue on [16 February 2023](https://github.com/markjprice/cs11dotnet7/issues/29), and a special thanks to [Huynh Loc Le](https://github.com/huynhloc-1110), who identified that the issue was caused by a Microsoft bug. + +In Step 1, you add package references to enable an `appsettings.json` file to configure a trace switch. If you reference `Microsoft.Extensions.Configuration.Binder` package version `7.0.3`, it has a bug that causes an exception to be thrown, as shown in the following output: +``` +Reading from appsettings.json in C:\cs11dotnet7\Chapter04\Instrumenting\bin\Debug\net7.0 +Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. + ---> System.ArgumentException: Must specify valid information for parsing in the string. (Parameter 'value') + at System.Enum.TryParse[TEnum](ReadOnlySpan`1 value, Boolean ignoreCase, Boolean throwOnFailure, TEnum& result) + at System.Enum.TryParse[TEnum](String value, Boolean ignoreCase, Boolean throwOnFailure, TEnum& result) + at System.Enum.Parse[TEnum](String value, Boolean ignoreCase) + at System.Diagnostics.TraceSwitch.OnValueChanged() +``` + +Until Microsoft fixes the bug, use version `7.0.2`, the latest version that works correctly, as shown in the following markup: +```xml + + + + + + + + +``` + # Page 185 - Creating a class library that needs testing In the "If you are using Visual Studio Code" section, in Step 5, the command in the book is `dotnet new console` but it should have been `dotnet new classlib`.