I'm trying to dynamically compile some VB code in my C# project and I'm running into an issue with the VBCodeProvider. It doesn't seem to be honoring the OptionInfer flag that I'm putting in the providerOptions Dictionary.
My code looks like this:
var providerOptions = new Dictionary<string, string>();
providerOptions.Add("CompilerVersion", "v3.5");
providerOptions.Add("OptionInfer", "True");
var provider = new VBCodeProvider(providerOptions);
I set my CompilerParameters.TreatWarningsAsErrors to True, and I get the following error:
Variable declaration without an 'As' clause; type of Object assumed.
However, all is well when I put the "Option Infer On" text at the top of my dynamic source code.
Can anyone shed some light? Am I using the wrong providerOptions key or value? Is there some other setting somewhere else?