I am building a Visual Studio editor extension for my Django rendering engine. I just started it so so far it is really simple and so far it does what I expect it to do - highlighting and the such. Or it did until I started to add parsing logic. Part of the parsing relies on regular expressions. And here is my problem: No matter how I try - static variables, member variables, - anything, every time I call new Regex it gives me "Object not set to an instance" exception. Is there a problem with using regular expressions (RegEx) in MEF?
here you go:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.Composition;
using System.Text.RegularExpressions;
namespace NDjango.Designer.Parsing
{
public interface IParser
{
List<Token> Parse(IEnumerable<string> template);
}
[Export(typeof(IParser))]
public class Parser : IParser
{
public List<Token> Parse(IEnumerable<string> template)
{
var result = new List<Token>();
Regex tag_re = new Regex("({{.*}}", RegexOptions.Compiled);
return result;
}
}
}
A breakpoint on the line with the Regex constructor is hit just fine. The next F10 gives the exception