LINQ in Action - LINQ Book & News

LINQ in Action Errata (Second Printing, May 2008)

All mistakes found in the second printing of LINQ in Action are posted here.
If you discover any mistakes in the book, you may post them as a comment here or in the forum.

The errata for the first printing is still available.


Chapter 1, page 15, first point in bulleted list

The (grammatical) subject of the sentence is "A good knowledge of the tools." So, "being able" refers to this knowledge being able to do something, which, of course, is not what is meant. We should write something like "... before you can use them efficiently ..."

Chapter 1, page 19, last sentence of section 1.2.3

It would be better to use a different verb than "seeing" here, because that is more what the reader does. "Showing you" would be a natural possibility. "Presenting" would be possible too, but may be a little too formal in comparison with the rest of the text.

Chapter 1, page 37, second sentence of section 1.6

"database" should be plural and "same" should be left out: "LINQ to SQL ... applies this concept to allow developers to query relational databases using the syntax that you have seen ..."

Chapter 1, page 37, last complete sentence on the page

"by ourselves" would be more correct than "by ourself"

Chapter 1, page 38, first sentence after heading "Entity classes," at the bottom of the page

"our application data" would be more consistent with the rest of the sentence than "your application data"

Chapter 1, page 41, first line of second bulleted list

"Queries explicitly written SQL in quotes" should be "Queries explicitly written in SQL as a string in quotes"

Chapter 2, page 51, last paragraph but one, second sentence

"In some cases, they're required to use LINQ features." could be "If you want to take advantage of some features of LINQ, you will have to use these keywords."

Chapter 2, page 53, first sentence

"In cases where a constructor is required or useful, it's still possible to use object initializers." should be "In cases where a parameterized constructor is required or useful, it's still possible to use object initializers."

Chapter 2, page 58, last paragraph

" ... the previous piece of code." is not correct. The previous piece of code is part of a digression about List.Find(). What is meant is "... listing 2.9."

Chapter 2, page 58, code sample before 2.4.3

The code sample should be:
var visualStudio = processes.Find(delegate (ProcessData process)
  { return process.Name == "devenv"; } );

Chapter 2, page 62, in the list of delegates given just above the middle of the page

The last delegate but one is missing a parameter (T3 arg3).

Chapter 2, page 69

"Process" should be "ProcessData". There are three places where it occurs: The first line of the page and, twice, in the sample code after the sentence "Here is how we would have to use it"

Chapter 2, page 69, first sentence of the second paragraph

"When a generic method is called without specifying type arguments" should be "When you call a generic method without specifying type arguments"

Chapter 2, page 69, OrderByDescending signature

The signature given says that OrderByDescending returns an IOrderedSequence<TSource> object. This is not true anymore in the RTM. The correct return type of OrderByDescending is IOrderedQueryable<TSource> or IOrderedEnumerable<TSource>, depending on the parent class.

Chapter 2, page 71, Listing 2.19

Listing 2.19 should point to ExtensionMethodsDiscoverability.csproj

Chapter 3, page 91, Listing 3.5

Listing 3.5 should point to QueryReuse.csproj

Chapter 4, page 128, Listing 4.8

The line "using LinqInAction.LinqBooks.Common;" is not needed. Correct this in the source code as well.

Chapter 4, pages 130, 135, 136 and 137

It looks like the content in the book for chapter 4 is out of sync with what Fabrice wrote for that chapter...
For example, in Fabrice's copy, instead of "In order to use the Book class and the sample data provided with this book, start by adding a reference to the LinqBooks.Common project." there is "In order to use the Book class and the sample data provided with this book, start by adding a reference to the LinqInAction.LinqBooks.Common.dll assembly."
Page 137, the text before section 4.4 is out of place. The text is mixed up and content may be missing.
Other pages in chapter 4 may be concerned by this. See also the comments from Ricky.

Chapter 4, page 140, last code block

IEnumerable<IEnumerable<Author>> should be IEnumerable<Author[]>

Chapter 6, page 212, section 6.1.2

If the index is correct, the last time we were concerned about connection strings was page 40, when dealing with the Northwind database. We need to let the reader now that we are now using the lia.mdf database and liaConnectionString.

We should guide the readers more about the databases and the connection strings we use, here and potentially elsewhere in the book.

Chapter 6, page 213

Indicate that the tool is available in Visual Studio's Samples folder (at least for VS 2008 SP1): \Program Files\Microsoft Visual Studio 9.0\Samples\<lcid>\CSharpSamples\LinqSamples\QueryVisualizer.
Note also that the name of the generated DLL has changed.

Chapter 6, page 217, generated SQL at the bottom of the page

The generated SQL should include all fields since we selected book (not book.Title)
Chapter 6, page 224, paragraph before Listing 6.18
"we need to observe that we’re looking for books where the subject exists or is null" should be "we need to observe that we’re looking for subjects where book exists or not".

Chapter 6, page 225, Listing 6.19

joinedbook should be book. Twice.

Chapter 10, page 356, Listing 10.4

Console.WriteLine((string) dotNetcategory);
should be:
Console.WriteLine((string)name);

Chapter 10, page 360, 10.1.5

Ancestors is the only current method that provides access to ancestor elements within the XML tree. AncestorNodes was either removed or that was a typo and was supposed to be just Ancestors.
(There is a DescendantNodes method that returns all XNode's that are descendants, and maybe there used to be a similar method for retrieving AncestorNodes.

Chapter 10, pages 367, 369, 371 and 373

Amazon has changed their authentication process. See http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/index.html?RequestAuthenticationArticle.html
Sample source code has been updated accordingly in the zip file and in the LINQPad examples.

See also Chapter 11 and Chapter 12 below.

Chapter 11, pages 408, 409, 410, 413, 414 and 425

Amazon has changed their authentication process. See the notes for Chapter 10 above.

Chapter 11, pages 420 and 422

The first paragraph talks about publishers.DefaultIfEmpty() then in the full code sample at the bottom of the page it's publishers.SingleOrDefault() that is used.
Same thing on page 422: talks about DefaultIfEmpty but uses SingleOrDefault in the code.

Chapter 11, pages 420, 421, 422 and 423

Page 420 (code located around the middle of the page), when a new Publisher is created, the ID should be set to Guid.NewGuid(), and not Guid.Empty, as currently.
The same problem exists in the other code snippets, until page 426 where the full source code is correct.

Chapter 12, pages 472, 473 and 474

Amazon has changed their authentication process. See the notes for Chapter 10 above.

Chapter 13, page 506, Note

See http://LinqInAction.net should be See http://manning.com/marguerie

Appendix “The standard query operators”, page 522

The Aggregation operators are listed in two tables when they could be listed in only one. My guess is that at one point the Aggregation operators table didn’t fit on one page and the table had to be broken into two tables but this does not seem to be a problem anymore so the two tables should be joined.

Published Monday, February 4, 2008 12:47 AM by Fabrice Marguerie

Comments

 

LINQ in Action - LINQ Book & News said:

LINQ in Action is doing well. We're all happy with the sales and all the reviews , on Amazon (5 stars

May 7, 2008 3:17 PM
 

Fabrice's weblog said:

LINQ in Action is doing well. We're all happy with the sales and all the reviews , on Amazon (5 stars

May 8, 2008 11:24 AM
 

LINQ in Action - LINQ Book & News : LINQ in Action Errata (First Edition, February 2008) said:

May 26, 2008 2:30 PM
 

Bill Schroeder said:

Just a small suggestion regarding Chapter 6, section 6.1.2 on page 212.  If the index is correct the last time we were concerned about connection strings was page 40 when dealing with the northwind database.  Somehow I had assumed since then that your version of northwind contained the Book and other associated tables.  I spent a few eveinings figuring out that I needed to be using the lia.mdf (this despite your hint from the liaConnectionString variable).

I think it would be worth a few sentences in this section to explicity lay out that we are now using a different database.

Suggestons aside, I think you've written a really terrific book.

Bill

June 25, 2008 6:16 PM
 

Fabrice Marguerie said:

Thanks for this suggestion, Bill. I agree that we should guide the readers more about the databases and the connection strings we use.

I've just added this to the errata.

It's great to see that you enjoy our book :-)

June 26, 2008 2:15 PM
 

Pete said:

This seems like a mistake to me...but I could be wrong:

Chapter 11, page 420 - starts talking about publishers.DefaultIfEmpty()

then in the full code sample at the bottom of the page it's publishers.SingleOrDefault()

great book btw!

August 20, 2008 6:30 AM
 

Pete said:

Same thing on page 422 - talks about DefaultIfEmpty but uses SingleOrDefault in the code

August 20, 2008 6:43 AM
 

Ricky said:

Errata: p. 53. The very first sentence "In cases where a constructor is required or useful, it's still possible to use object initializers."  

Actually, the point being made by this passage is that object initializers can be used with constructors that take one or more parameters.  So the adjective "parameterized" should appear just before the word "constructor".

November 15, 2008 5:22 PM
 

Ricky said:

Errata: p 58. Last paragraph.

" ... the previous piece of code."  is not correct.  The previous piece of code is part of a digression about List.Find().  What is meant is "... the code in listing 2.9."

November 15, 2008 7:04 PM
 

Ricky said:

Errata: p.69. OrderByDescending signature.

The signature given says that OrderByDescending returns an IOrderedSequence object.  I can find no mention of such an interface on MSDN.  Some web pages mention it, but they seem to date from several months before RTM of C# 3.0.  According to MSDN, the return type of OrderByDescending is IOrderedQueryable or IOrderedEnumerable, depending on the parent class.

November 15, 2008 9:55 PM
 

Ricky said:

Errata: p. 128.  Listing 4.8 and p. 131. Listing 4.10.

The line "using LinqInAction.LinqBooks.Common;" in Listing 4.8 is not needed and generates a compiler error.  The line is missing from Listing 4.10 where it is needed.

November 22, 2008 7:26 PM
 

Ricky said:

Errata: 134. Step 1.

This step does not work as described because there seem to be things you need to do that aren't described.  In particular, I had to add the following line to the InitializeComponent() method in the default Form1.Designer.cs file.  Visual Studio does not have the line, but you have to add it or the data will not appear in the DataGridView.

this.Load += new System.EventHandler(this.FormStrings_Load);

November 22, 2008 9:29 PM
 

Ricky said:

Errata: p. 130 and 135.

Both pages tell readers to get a "reference to the LinqBooks.Common project".  What is meant is the LinqInAction.LinqBooks.Common.dll in the LinqBooks.Common project's bin\Debug folder.  This might seem like common sense, but the Visual Studio "Add Reference" dialog has a "Projects" tab.  That tab is NOT what's meant on these pages, so telling readers to get a reference to the "project" instead of the DLL is confusing.

November 22, 2008 9:37 PM
 

Ricky said:

Errata: p. 136.  "That's all there is to it. We know now have a rich collection mapped to a grid."

This paragraph is completely wrong.  It appears that MANY things were supposed to be between this paragraph and the one that precedes it.  The step the reader is in at this point, Step 2, is nowhere near finished and the reader's files at this point are missing a great deal that are in the corresponding files in the Chapter 4.Win folder (from the Zip that can be downloaded from the book's Web site). For example, nothing at this point has been done to the FormBooks.cs file, but the reader, in fact, needs to create a FormBooks_Load method in that file before he "now haSleep a rich collection mapped to a grid".  

Part of the missing information appears (completely out of place) on the next page (137) just above the beginning of the next section.

November 22, 2008 9:59 PM
 

Ricky said:

Errata: p. 136.  

There is even more material missing from this page than I thought when I wrote the previous errata note for p. 136.  It turns out that there is supposed to be a THIRD form in this project that has links to the FormBooks and FormStrings forms.  This third form is not even mentioned in the book.  I would estimate that at least 3 full pages are missing from the book at this point.  

November 22, 2008 10:07 PM
 

Fabrice Marguerie said:

Thanks Pete. Remarks added to the errata.

November 23, 2008 9:09 AM
 

Fabrice Marguerie said:

Thanks a lot Ricky for all your remarks. I've added them to the errata.

Regarding Listings 4.8 and 4.10, the "using" statements are correct with regards to the complete source code. However, it's true that it's not needed in Listing 4.8.

Listing 4.10 is not complete, and just shows the Page_Load method. That's why there is no "using" statement in it.

> Errata: 134. Step 1.

FormStrings.Designer.cs does indeed contain the line of code that you indicate as required.

> Errata: p. 130 and 135.

> Errata p.136

It looks like the content in the book for chapter 4 is out of sync with what I wrote for that chapter...

In my copy, it reads: "In order to use the Book class and the sample data provided with this book, start by adding a reference to the LinqInAction.LinqBooks.Common.dll assembly."

I'll make sure this gets fixed in the next edition. Thanks again.

November 23, 2008 9:32 AM
 

Ricky said:

Favrice,

I think you misunderstood what I'm saying about p. 134, Step 1.  I know that in the source code on your web site, the line is there (that's how I found out it needed to be there); but on page 134, you are having the reader create the code from scratch. My point is, that you never tell the reader to add this line.  When you are taking the reader step-by-step, you can't leave out any steps. A similar point applies to what I said about listing 4.10.  I agree that the code is incomplete, but that's my point. At this point in the book, you are having the reader create the code, not having him download it and look at it.  So you can't be incomplete.  

In general chapter 4, from 128 to the middle of 137, is confused because the text sometimes seems to be taking the reader through the code writing process, step-by-step, and other times seems to forget this and assumes that the reader has simply downloaded the completed project.

November 24, 2008 11:31 AM
 

Fabrice Marguerie said:

Ricky,

Thank you for getting back to me on this.

I understand what you mean. I guess that I described the steps too much then :-)

The purpose of this chapter (and the others) is not to give all the steps to the reader. The book needs to stay focused on LINQ. That's why we don't give all the steps for creating the code samples, but provide the complete code samples as a download, and focus in the book only on the important pieces of code related to LINQ. Someone who wants to see/test the complete examples can open the provided code files.

Not all readers are the same. Some just read the book without recoding the examples. We shouldn't put too many implentation details in their way.

Other readers want to reproduce all the code samples by themselves. But it's not possible to provide step-by-step instructions everywhere or the book would be too verbose.

Anyway, it seems that we could have done better, in chapter 4 at least. I'll try to do better next time. Thank you for your feedback.

Fabrice

November 24, 2008 2:23 PM
 

Rene said:

This is really not a big deal but I thought I would mention it anyway.

Page 522 (Appendix “The Standard query operators”). The Aggregation operators are listed in two tables when they could be listed in only one. My guess is that at one point the Aggregation operators table didn’t fit in one page and the table had to be broken into two tables but this does not seem to be a problem anymore so I think the two tables should be joined.

January 25, 2009 6:15 PM
 

Fabrice Marguerie said:

Thanks Rene.

January 26, 2009 9:06 AM
 

Eric T. said:

Hi -- your link to ScottGu's blog about SqlServerVisualizer (pg 213) actually points to broken code there.  Scott and his coworkers were kind enough to point me to the correct place for this tool, which is in the samples folder (at least for VS2008SP1): \Program Files\Microsoft Visual Studio 9.0\Samples\<lcid>\CSharpSamples\LinqSamples\QueryVisualizer.

Note that the generated DLL name has changed.  Do a Debug build, and copy the bin\debug\LinqToSqlQueryVisualizer to \Program Files\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\Visualizers.  Restart VS2008 and the visualizer now works.

July 13, 2009 10:01 AM
 

Fabrice Marguerie said:

Thanks for the information, Eric T.

July 27, 2009 4:49 AM
 

Shikiro said:

Chapter 2, page 58

For example, here is how the Find method can be used with an anonymous

method to find a specific process:

var visualStudio = processes.Find(delegate (Process process)

 { return process.ProcessName == "devenv"; } );

is not correct

should be

var visualStudio = processes.Find(delegate (ProcessData process)

 { return process.ProcessName == "devenv"; } );

February 12, 2010 7:58 AM
 

Fabrice Marguerie said:

Thanks Shikiro. Yes, it could be written that way.

In this example, processes doesn't refer specifically to the processes variable from the previous examples. It just represents a list of processes.

But I agree with you that it's easier to follow if we assume that processes is of type List<ProcessData>, as is the case in the previous examples.

In this case however, we need to test on Name and not ProcessName :-)

February 13, 2010 2:35 AM
 

Lars said:

I am considering buying this book, but the size of this errata makes me hesitate.  

Have these errors been corrected in the PDF version of the book (or in a later edition of the paper version)?

Thanks,

Lars

February 15, 2010 1:18 PM
 

Fabrice Marguerie said:

You should not consider this errata as an argument against buying our book. I can assure you that it has been carefully edited.

If you look at what's referenced here, you'll notice that a lot of the remarks on this page concern small typos and suggestions for improvement.

We keep track of all these here in case there is a new printing of the book, in which we would make the necessary corrections. I don't think this is done by many authors or publishers. I hope you'll take our conscientiousness as a positive point.

To my knowledge, there is no new printing or new PDF version yet including the improvements and corrections listed here. But such a small number of mistakes isn't too bad for a 576 pages book :-)

February 16, 2010 12:18 AM
 

Reader said:

Erratum:

chapter 6 page 224

"To accomplish the same thing with LINQ..we're looking for books where the subject exists or is null".

should be

"To accomplish the same thing with LINQ..we're looking for subjects where a book exists or is null".

December 8, 2011 9:35 AM
 

Fabrice Marguerie said:

Thank you, Reader.

December 8, 2011 4:09 PM
New Comments to this post are disabled