Using Linq methods causes missing references to DependencyObject in WindowsBase

Posted by Jason Coyne on Stack Overflow See other posts from Stack Overflow or by Jason Coyne
Published on 2010-06-12T03:49:11Z Indexed on 2010/06/12 3:52 UTC
Read the original article Hit count: 462

Filed under:
|
|
|
|

I have some c# source that I want to compile using CodeDom within my application (for a plugin)

Everything works fine, except if I use a Linq extension function on some of my collections

var dict = new Dictionary<KeyType, ValueType>();
....
dict.Any(KV=>KV.Key == "Some Key);

When I try to compile source that has this code, it CodeDom complains that I am missing a reference to DependencyObject in WindowsBase.

I do not understand why this is happening. Neither the Dictionary class, or the Any extension method reference that class, which apparently is part of Windows.Forms

I would normally just ignore the quirk, make the CodeDom add a reference and move on, but Apparently WindowsBase is special and is not always distributed and I don't want to cause issues for users that may not have it installed correctly.

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ