ISB003 Exported brokered services are valid
When a type is annotated with the [ExportBrokeredService] attribute, certain rules must be followed.
In particular, any such type must implement the IExportedBrokeredService interface.
Examples of patterns that are flagged by this analyzer
The following code generates a diagnostic.
[ExportBrokeredService("name", "1.0")]
class Foo
{
}
Solution
Fix the error by implementing the IExportedBrokeredService interface.
[ExportBrokeredService("name", "1.0")]
class Foo : IExportedBrokeredService
{
ServiceRpcDescriptor IExportedBrokeredService.Descriptor { get; } = new ServiceJsonRpcDescriptor(
new ServiceMoniker("CallBackService", new Version(0, 1)),
ServiceJsonRpcDescriptor.Formatters.UTF8,
ServiceJsonRpcDescriptor.MessageDelimiters.HttpLikeHeaders);
Task IExportedBrokeredService.InitializeAsync(CancellationToken cancellationToken) => Task.CompletedTask;
}