Minor issues

Dec 1, 2009 at 7:53 PM

I would like to articulate a couple of issues:

  • I strongly beleive that the code below should work (currently, if field was declared readonly, it fails to initialize it; the fix must be straightforward in the MEF):

ImportMany("Microsoft.Samples.XFileExplorer.FileExplorerViewContract", AllowRecomposition = true)]
private readonly Lazy<UserControl, IFileExplorerViewMetadata>[] m_Views;

  • In some of your classes static field initialization depends on the declaraton order of them (i.e. System.ComponentModel.Composition.Caching.GenerationServices). I wish at least the fields that depend on other fields' values were initialized in a static constructor, i.e.

private static readonly MethodInfo standardDictionaryAddMethod;
private static readonly ConstructorInfo standardDictionaryConstructor;
private static readonly Type standardDictionaryType = typeof(Dictionary<string, object>);
static GenerationServices()
{
  standardDictionaryAddMethod = standardDictionaryType.GetMethod(
"Add", new[] {StringType, ObjectType});
  standardDictionaryConstructor = standardDictionaryType.GetConstructor(
new[] {Int32Type});
}