How to effectively log asynchronously?

I wrote this code a while back, feel free to use it. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; namespace MediaBrowser.Library.Logging { public abstract class ThreadedLogger : LoggerBase { Queue<Action> queue = new Queue<Action>(); AutoResetEvent hasNewItems = new AutoResetEvent(false); volatile bool waiting = false; public ThreadedLogger() : base() { Thread loggingThread = … Read more

When should I use Tracing vs Logger.NET, Enterprise Library, log4net or Ukadc.Diagnostics?

There are many similar questions here on SO: Logging best practices log4net versus TraceSource Silverlight Logging framework and/or best practices log4net vs. Nlog What’s the point of a logging facade? C# Logging. What should I use? You missed several commonly used logging frameworks. Here is a list of commonly used frameworks, some of which you … Read more

How to resolve “Could not find schema information for the element/attribute “?

I’ve created a new scheme based on my current app.config to get the messages to disappear. I just used the button in Visual Studio that says “Create Schema” and an xsd schema was created for me. Save the schema in an apropriate place and see the “Properties” tab of the app.config file where there is … Read more

WCF ExceptionShielding Error ID does not match up with handlingInstanceId passed to Handler

According to http://msdn.microsoft.com/en-us/library/ff649012.aspx: You can also specify a Source of “{Guid}” to add the current Handling Instance ID to the Fault Contract property. In your .config file: <mappings> <add source=”{Guid}” name=”HandlingInstanceId” /> </mappings> In your ValidationFault FaultContract: [DataMember] public Guid HandlingInstanceId { get; set; } Note: The “{Guid}” source appears to be a special marker … Read more

Can Unity be made to not throw SynchronizationLockException all the time?

I’m sure there’s a lot of ways code could call SynchronizedLifetimeManager, or a descendant like ContainerControlledLifetimeManager, but there were two scenarios in particular that were causing me problems. The first was my own fault – I was using constructor injection to supply a reference to the container, and in that constructor I was also adding … Read more

Where does Microsoft.Practices.ServiceLocation come from?

It comes from: https://github.com/unitycontainer/commonservicelocator From the project description: The Common Service Locator library contains a shared interface for service location which application and framework developers can reference. The library provides an abstraction over IoC containers and service locators. Using the library allows an application to indirectly access the capabilities without relying on hard references. The … Read more

Enterprise Library Unity vs Other IoC Containers [closed]

I am preparing a presentation for a usergroup. As such I just went through a bunch of them. Namely: AutoFac, MEF, Ninject, Spring.Net, StructureMap, Unity, and Windsor. I wanted to show off the 90% case (constructor injection, which is mainly what people use an IOC for anyway). You can check out the solution here (VS2008) … Read more