Why is my static dictionary not initialising?
<p>I am using a big dictionary I want to only be created once to store some information along with a static function to extract info from it like so:</p>

<pre><code>public static class AceMimeInfo
{
    static Dictionary&lt;string, Info&gt; mimedictionary = new Dictionary&lt;string, Info&gt;
    {
        {".abap", new Info("abap", "ABAP")},
        {".asciidoc", new Info("asciidoc", "AsciiDoc")},
        {".c9search_results", new Info("c9search", "C9Search")},
        {".coffee", new Info("coffee", "CoffeeScript")},
        {".cf", new Info("coffee", "CoffeeScript")},
        {".xul", new Info("xml", "XML")},
        {".xbl", new Info("xml", "XML")},
        {".xq", new Info("xquery", "XQuery")},
        {".yaml", new Info("yaml", "YAML")}
    };

    public class Info
    {
        public string Mode;
        public string Name;

        public Info(string mode, string name)
        {
            Mode = mode;
            Name = name;
        }
    }

    public static string GetMode(string fileext)
    {
        string fe;

        fe = fileext.ToLower();
        if(!fe.StartsWith("."))
            fe = "." + fe;

        if (mimedictionary.ContainsKey(fe))
            return mimedictionary[fe].Mode;
        return "";
    }
}
</code></pre>

<p>However when I step through <code>GetMode</code> with the debugger, the dictionary <code>mimedictionary</code> is always null. 
What do I need to do to make sure this isn't the case?
Any suggestions as to a better way of doing this would also be appreciated.</p>

<p>I am calling <code>GetMode</code> this like so:</p>

<pre><code>string mode = AceMimeInfo.GetMode("filename.cpp");
</code></pre>

<p>Thanks in advance</p>

<p><strong>Update:</strong></p>

<p>I tried the above code and it does indeed work. The dictionary above is a shorter version of what I am actually using (because it's quite long).</p>

<p>Here is the actual class I am using - and it doesn't work. When I shorten the dictionary, it does work.</p>

<pre><code>public static class AceMimeInfo
{
    static Dictionary&lt;string, Info&gt; mimedictionary = new Dictionary&lt;string, Info&gt;
    {
        {".abap", new Info("abap", "ABAP")},
        {".asciidoc", new Info("asciidoc", "AsciiDoc")},
        {".c9search_results", new Info("c9search", "C9Search")},
        {".coffee", new Info("coffee", "CoffeeScript")},
        {".cf", new Info("coffee", "CoffeeScript")},
        {".cfm", new Info("coldfusion", "ColdFusion")},
        {".cs", new Info("csharp", "C#")},
        {".css", new Info("css", "CSS")},
        {".dart", new Info("dart", "Dart")},
        {".diff", new Info("diff", "Diff")},
        {".patch", new Info("diff", "Diff")},
        {".dot", new Info("dot", "Dot")},
        {".glsl", new Info("glsl", "Glsl")},
        {".frag", new Info("glsl", "Glsl")},
        {".vert", new Info("glsl", "Glsl")},
        {".go", new Info("golang", "Go")},
        {".groovy", new Info("groovy", "Groovy")},
        {".hx", new Info("haxe", "haXe")},
        {".haml", new Info("haml", "HAML")},
        {".htm", new Info("html", "HTML")},
        {".html", new Info("html", "HTML")},
        {".xhtml", new Info("html", "HTML")},
        {".c", new Info("c_cpp", "C/C++")},
        {".cc", new Info("c_cpp", "C/C++")},
        {".cpp", new Info("c_cpp", "C/C++")},
        {".cxx", new Info("c_cpp", "C/C++")},
        {".h", new Info("c_cpp", "C/C++")},
        {".hh", new Info("c_cpp", "C/C++")},
        {".hpp", new Info("c_cpp", "C/C++")},
        {".clj", new Info("clojure", "Clojure")},
        {".jade", new Info("jade", "Jade")},
        {".java", new Info("java", "Java")},
        {".jsp", new Info("jsp", "JSP")},
        {".js", new Info("javascript", "JavaScript")},
        {".json", new Info("json", "JSON")},
        {".jsx", new Info("jsx", "JSX")},
        {".latex", new Info("latex", "LaTeX")},
        {".tex", new Info("latex", "LaTeX")},
        {".ltx", new Info("latex", "LaTeX")},
        {".bib", new Info("latex", "LaTeX")},
        {".less", new Info("less", "LESS")},
        {".lisp", new Info("lisp", "Lisp")},
        {".scm", new Info("lisp", "Lisp")},
        {".rkt", new Info("lisp", "Lisp")},
        {".liquid", new Info("liquid", "Liquid")},
        {".lua", new Info("lua", "Lua")},
        {".lp", new Info("luapage", "LuaPage")},
        {".lucene", new Info("lucene", "Lucene")},
        {".make", new Info("makefile", "Makefile")},
        {".md", new Info("markdown", "Markdown")},
        {".markdown", new Info("markdown", "Markdown")},
        {".m", new Info("objectivec", "Objective-C")},
        {".ml", new Info("ocaml", "OCaml")},
        {".mli", new Info("ocaml", "OCaml")},
        {".pl", new Info("perl", "Perl")},
        {".pm", new Info("perl", "Perl")},
        {".pgsql", new Info("pgsql", "pgSQL")},
        {".php", new Info("php", "PHP")},
        {".phtml", new Info("php", "PHP")},
        {".ps1", new Info("powershell", "Powershell")},
        {".py", new Info("python", "Python")},
        {".r", new Info("r", "R")},
        {".Rd", new Info("rdoc", "RDoc")},
        {".Rhtml", new Info("rhtml", "RHTML")},
        {".ru", new Info("ruby", "Ruby")},
        {".gemspec", new Info("ruby", "Ruby")},
        {".rake", new Info("ruby", "Ruby")},
        {".rb", new Info("ruby", "Ruby")},
        {".scad", new Info("scad", "OpenSCAD")},
        {".scala", new Info("scala", "Scala")},
        {".scss", new Info("scss", "SCSS")},
        {".sass", new Info("scss", "SCSS")},
        {".sh", new Info("sh", "SH")},
        {".bash", new Info("sh", "SH")},
        {".bat", new Info("sh", "SH")},
        {".sql", new Info("sql", "SQL")},
        {".styl", new Info("stylus", "Stylus")},
        {".stylus", new Info("stylus", "Stylus")},
        {".svg", new Info("svg", "SVG")},
        {".tcl", new Info("tcl", "Tcl")},
        {".tex", new Info("tex", "Tex")},
        {".txt", new Info("text", "Text")},
        {".textile", new Info("textile", "Textile")},
        {".typescript", new Info("typescript", "Typescript")},
        {".ts", new Info("typescript", "Typescript")},
        {".str", new Info("typescript", "Typescript")},
        {".xml", new Info("xml", "XML")},
        {".rdf", new Info("xml", "XML")},
        {".rss", new Info("xml", "XML")},
        {".wsdl", new Info("xml", "XML")},
        {".xslt", new Info("xml", "XML")},
        {".atom", new Info("xml", "XML")},
        {".mathml", new Info("xml", "XML")},
        {".mml", new Info("xml", "XML")},
        {".xul", new Info("xml", "XML")},
        {".xbl", new Info("xml", "XML")},
        {".xq", new Info("xquery", "XQuery")},
        {".yaml", new Info("yaml", "YAML")}
    };

    public class Info
    {
        public string Mode;
        public string Name;

        public Info(string mode, string name)
        {
            Mode = mode;
            Name = name;
        }
    }

    public static string GetMode(string fileext)
    {
        string fe;

        fe = fileext.ToLower();
        if(!fe.StartsWith("."))
            fe = "." + fe;

        if (mimedictionary.ContainsKey(fe))
            return "ace/mode/" + mimedictionary[fe].Mode;
        return "";
    }
}
</code></pre>

<p>Debugger output:</p>

<p><code>{"The type initializer for 'TestApp.AceMimeInfo' threw an exception."}</code></p>

<p><strong>Update II:</strong> Where's the repeated key?</p>
