Skip to content

ILogger naming conflict causes exceptions with plugins that have ILogger #177

@NealCallaghan

Description

@NealCallaghan

When creating or adding your own plugin, if you have an ILogger with a DependencyAttribute (copy and paste the devtools plugin then modified) an exception will be thrown on line 90 of AppPlugins.cs (property.SetValue(plugin, dependency);) this is because the type in the plugin is Microsoft.Extensions.Logging.Ilogger and not Micrsoft.Teams.Common.Logging.Ilogger. The Container.Resolve code is resolving anything with the string "ILogger" as the type name.

Couple of ways we could go about fixing this:

  • change the name of the Micrsoft.Teams.Common.Logging.Ilogger to something like ITeamsLogger which would have the added benefit of being a bit more explicit and self documenting.
  • have a further check within the inject method to ensure both types (property and the resolved type) really are the same type and if not throw an invalid operation exception as intended.

Additional notes:

The logger on the devtools plugin has an additional attribute of AllowNull though this isn't being read, the Dependency Attribute has an optional property, was this supposed to be used instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions