Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Using TypeExtensionPoints and CustomExtensionAttributes fail #39

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

mmgerald
Copy link
Contributor

Type Extension Points didn't work correctly, when using CustomExtensionAttribute. Using CustomExtensionAttribute on several TypeExtensionNodes didn't assign extension nodes to the correct extension points. Therefore, calling AddInEngine.GetExtensionNodes(typeof(IAnyInterface)) also returned extension nodes of another interface.

Equivalent to ExtensionAttribute, CustomExtensionAttribute with property Type now.
CustomAttribute with a list of nodes and properties (@IAssemblyReflector.cs)
Reflector.cs/DefaultAssemblyReflector.cs now returns a list of properties and a list of nodes. Properties are needed to get value of property Type.
AddinScanner now checks property Type of CustomExtensionAttribute, otherwise (equivalent to ExtensionAttribute) the base types are analyzed and used as path.

mmgerald and others added 7 commits April 29, 2016 11:50
…onAttribute. Using CustomExtensionAttribute on several TypeExtensionNodes didn't assign extension nodes to the correct extension points. Therefore, calling AddInEngine.GetExtensionNodes(typeof(IAnyInterface)) also returned extension nodes of another interface.

Equivalent to ExtensionAttribute, CustomExtensionAttribute with property Type now.
CustomAttribute with a list of nodes and properties (@IAssemblyReflector.cs)
Reflector.cs/DefaultAssemblyReflector.cs now returns a list of properties and a list of nodes. Properties are needed to get value of property Type.
AddinScanner now checks property Type of CustomExtensionAttribute, otherwise (equivalent to ExtensionAttribute) the base types are analyzed and used as path.
… an ExtensionNode still was loaded immediately before Shutdown, so ResetCachedData of Registry accessed the already uninitialized AddinEngine.

Also there was a different behavior between using Mono.Cecil and .NET Reflection using a derived version from CustomExtensionAttribute. When using AddInRegistry.GetAddinDescription, extension nodes were not found, because AddinScanResult.GetAssemblyLocation did not resolve to the startup directory (in our case here are all needed assemblies located).
@slluis
Copy link
Member

slluis commented Aug 1, 2016

That's not how CustomExtensionAttribute is intended to be used. You can't use the same CustomExtensionAttribute subclass to define two different type extension points. Each extension point must have its own attribute class. The attribute type identifies the extension point.

Base automatically changed from master to main March 9, 2021 14:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants