I am having an heck of a time trying to get two separately scoped solutions to work together.
The first solution is scoped for Farm and does nothing more than add a custom SPDiagnosticService. When this is deployed it appears to be fine as I can see my custom diagnostic categories in Central Administration.
The second solution depends on the first and is responsible for testing the first solution by writing events to the SharePoint diagnostic infrastructure. It does this by initiating an instance of the MyDiagnosticService class and executing methods on that class. This second solution is a webpart and scope for site. When I deploy this and add the web part to the page still all is well until I attempt to have it write a diagnostic event using a button click event.
In the button click event the failure occurs on this line:
MyDiagnosticService diagSrvc = MyDiagnosticService.Local;
This is the error msg:
SPDuplicateObjectException An object of the type MyDiagnosticService named "My Diagnostics" already exists under the parent Microsoft.SharePoint.Administration.SPFarm named "SP_Config_Farm". Rename your object or delete the existing object.
It was my thought that when the first solution is deployed the MyDiagnosticService class is installed in the GAC and available to any subsequent solution that may want to use it. I want to know what I am doing wrong. Thanks for the help.