I use CSharpCodeProvider to compile instant plugins for my app.

Right now it is possible to try to compile a file, that looks good, but generates many errors, for example a C# code glued with a binary file. There are many characters, that are treated with error CS1056: Unexpected character.

This behaviour is expected, but a compilation process of such a "malicious" file is very time consuming.

One solution that I find reasonable would be to limit the number of errors, after which CSharpCodeProvider.CompileAssemblyFromFile returns.

Is it possible to set such a limit?

I don't really want to inspect the file very carefully in the first place, if it's possible to avoid.

Edit
Report