1

Closed

Exception thrown as:Object synchronization method was called from an unsynchronized block of code.

description

Hi All,
 
I am get exception "Object synchronization method was called from an unsynchronized block of code." while doing logging in database. I am using following library
 
Microsoft.Practices.EnterpriseLibrary.Logging
Microsoft.Practices.EnterpriseLibrary.Data
Microsoft.Practices.EnterpriseLibrary.Logging.Database
Microsoft.Practices.EnterpriseLibrary.Common
And my config file setting is as below:
 
 
 
<configuration>
<configSections>
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
</configSections>
<loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">
<listeners>
  <add name="Database Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    databaseInstanceName="Logging Database" writeLogStoredProcName="WriteLog"
    addCategoryStoredProcName="AddCategory" formatter="Text Formatter"
    traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId, Callstack" />
  <add name="Event Log Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    source="Enterprise Library Logging" formatter="Text Formatter"
    log="some" traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId, Callstack" />
</listeners>
<formatters>
  <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    template="Timestamp: {timestamp}{newline}&#xA;Message: {message}{newline}&#xA;Category: {category}{newline}&#xA;Priority: {priority}{newline}&#xA;EventId: {eventid}{newline}&#xA;Severity: {severity}{newline}&#xA;Title:{title}{newline}&#xA;Machine: {localMachine}{newline}&#xA;App Domain: {localAppDomain}{newline}&#xA;ProcessId: {localProcessId}{newline}&#xA;Process Name: {localProcessName}{newline}&#xA;Thread Name: {threadName}{newline}&#xA;Win32 ThreadId:{win32ThreadId}{newline}&#xA;Extended Properties: {dictionary({key} - {value}{newline})}"
    name="Text Formatter" />
</formatters>
<categorySources>
  <add switchValue="All" name="General">
    <listeners>
      <add name="Database Trace Listener" />
    </listeners>
  </add>
</categorySources>
<specialSources>
  <allEvents switchValue="All" name="All Events">
    <listeners>
      <add name="Database Trace Listener" />
    </listeners>
  </allEvents>
  <notProcessed switchValue="All" name="Unprocessed Category">
    <listeners>
      <add name="Database Trace Listener" />
    </listeners>
  </notProcessed>
  <errors switchValue="All" name="Logging Errors &amp; Warnings">
    <listeners>
      <add name="Event Log Trace Listener" />
    </listeners>
  </errors>
</specialSources>
</loggingConfiguration>
<connectionStrings>
<add name="Logging Database" connectionString="Password=*******;Persist Security Info=True;User ID=*******;initial catalog=*******;Data Source=******"
  providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
 
 
Can anyone help me in this regard.
 
Thanks and Regards
 
Mohammed Haroon
 
(Technology Enthusiast, Active learner and decent developer.)
Closed May 30, 2012 at 8:26 AM by jbourgault
Related to EntLib/Unity.More details @ http://unity.codeplex.com/workitem/7019

comments

jbourgault wrote May 30, 2012 at 8:24 AM

This issue is related to Unity.

See http://unity.codeplex.com/workitem/7019 for more details.

Cheers,

Jeremi