Search code examples
c#internet-explorerlog4netbho

Internet Explorer prompts me if I want to run csc.exe while I'm running log4net methods


I'm using Log4Net within an Internet Explorer browser extension written in C#. Sometimes I get prompted by Internet Explorer saying "A website wants to open web content using this program on your computer" for csc.exe and asking me to Allow or Don't allow. Clearly it's not the website, and it only happens when I'm logging, so it looks like it's Log4Net. Is this normal and/or is there any way to make it not happen?

It only happens when I have Protected Mode on, but I need to be able to run logging code with Protected Mode on and don't want users to be prompted with this.


Solution

  • It sounds like the logging is triggering serialization of an object. Serialization works by examining the object, parsing the public properties, creating a proxy class and then compiling it up, hence the call to CSC, the C# compiler.

    You can generate serialization assemblies manually using sgen, and then link those into your application which will then stop .NET generating proxies at runtime.