5 lines
740 B
Plaintext
5 lines
740 B
Plaintext
== Why is this an issue?
|
|
|
|
Marking a class with https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.composition.partcreationpolicyattribute[`PartCreationPolicy`](https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.composition.creationpolicy[`CreationPolicy.Shared`]), which is part of https://learn.microsoft.com/en-us/dotnet/framework/mef[Managed Extensibility Framework (MEF)], means that a single, shared instance of the exported object will be created. Therefore it doesn't make sense to create new instances using the constructor and it will most likely result in unexpected behaviours.
|
|
|
|
This rule raises an issue when a constructor of a class marked shared with a `PartCreationPolicyAttribute` is invoked. |