Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Chapter01/Chapter01.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ChapterNumber>01</ChapterNumber>
<ExpectedWarnings>$(ExpectedWarnings)</ExpectedWarnings>
Expand Down
16 changes: 16 additions & 0 deletions src/Chapter01/TopLevelStatementWrapperForListing01.01.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// See https://aka.ms/new-console-template for more information
// this file redirects debug break points to Listing01.01.HelloWorldInC#.cs
// allowing for the appearance that the top-level statement file of Listing01.01.HelloWorldInC#.cs is what is being ran.
namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter01.Listing01_01
{
public class HelloWorld
{
public static void Main()
{
// the #line directive reroutes the debugger's line mapper from this file to "Listing01.01.HelloWorldInC#.cs"
// see https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives#error-and-warning-information
#line (3,1) - (3,55) 13 "Listing01.01.HelloWorldInC#.cs"
Console.WriteLine("Hello. My name is Inigo Montoya.");
}
}
}
11 changes: 1 addition & 10 deletions src/Shared/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
Expand Down Expand Up @@ -41,15 +41,6 @@ public static async Task Main(string[] args)
{
input = ParseListingName(input);

// We handle listing 1.1 specially since the listing is a top level statement and
// the file (Listing01.01.HelloWorldInC#.cs) is set to not build as part of the project.
if(input == "01_01")
{
throw new InvalidOperationException(
"This listing (HelloWorld) is left as an exercise for the reader on the command line. ");
}


Regex reg = new($"Listing{input}\\.+");

IEnumerable<Type?> targets = assembly.GetTypes().Where(type =>
Expand Down