1
Vote

WriteToDeveloperTrace calls SPDiagnosticsServiceBase.GetLocal causes exception during SPFeatureReceiver.FeatureInstalled

description

If a SharePoint farm solution is deployed using Sever Object Model or PowerShell calling the SPDiagnosticsServiceBase.GetLocal in the SPFeatureReceiver.FeatureInstalled code causes an exception:
The installation of features failed during deployment of the solution.
 
CAS_SP : Configsetting with key 'CAS.SharePoint.Common.TypeMappings' could not be set 'CAS.SharePoint.Common.ServiceLocation.ServiceLocationConfigData' with type 'CAS.SharePoint.Common.ServiceLocation.ServiceLocationConfigData'. The technical exception was: CAS.SharePoint.Common.Logging.LoggingException: One or more error occurred while writing messages into the log.\r\nThe error while writing to the EventLog was:An exception has occurred. 
ExceptionType: 'SPDuplicateObjectException' 
ExceptionMessage: 'An object of the type CAS.SharePoint.Common.Logging.DiagnosticsService named "" already exists under the parent Microsoft.SharePoint.Administration.SPFarm named "SharePoint_Config_c8ae0268-40ff-4bea-82f0-eddcd464e806".  Rename your object or delete the existing object.' 
StackTrace: '   at Microsoft.SharePoint.Administration.SPConfigurationDatabase.StoreObject(SPPersistedObject obj, Boolean storeClassIfNecessary, Boolean ensure) 
   at Microsoft.SharePoint.Administration.SPConfigurationDatabase.Microsoft.SharePoint.Administration.ISPPersistedStoreProvider.PutObject(SPPersistedObject persistedObject, Boolean ensure) 
   at Microsoft.SharePoint.Administration.SPPersistedObject.BaseUpdate() 
   at Microsoft.SharePoint.Administration.SPDiagnosticsServiceBase.Update() 
   at Microsoft.SharePoint.Administration.SPDiagnosticsServiceBase.GetLocalToFarm[T](SPFarm farm) 
   at Microsoft.SharePoint.Administration.SPDiagnosticsServiceBase.GetLocal[T]() 
   at CAS.SharePoint.Common.Logging.TraceLogger.Trace(String message, Int32 eventId, TraceSeverity severity, String category) 
   at CAS.SharePoint.Common.Logging.SharePointLogger.WriteToDeveloperTrace(String message, Int32 eventId, 
The same solution deployed using Central Administration tool works fine. The code also works fine while executing it from command line application.

I have reproduced this problem on two SharePoint Servers and one Foundation instance. All servers work alone.
The problem is related to types mapping because there is called to trace log.

It seems as a SharePoint bug, but is there any workaround you know? How to report it to the SharePoint developers team ?

comments