3

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.

Rory
  • 40,559
  • 52
  • 175
  • 261

1 Answers1

4

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.

blowdart
  • 55,577
  • 12
  • 114
  • 149
  • Could be. With log4net I just pass a string to the logger, so the conversion of _my_ objects to strings is done before any logging code is executed. That means if it's serialization to blame it must be internal to log4net, right? I guess it's time to delve into log4net code... – Rory Aug 19 '11 at 23:14
  • Actually it wasn't Log4Net at all it was serialization code outside that, but blowdart's answer is correct in that it's serialization. I don't use the default serialization so can't use sgen. I've raised http://stackoverflow.com/questions/7333689/generating-an-xml-serialization-assembly-for-a-custom-xmlserializer as a follow up to this. – Rory Jan 16 '12 at 14:42