diff options
Diffstat (limited to 'mcs/class/System.ComponentModel.Composition')
465 files changed, 0 insertions, 76785 deletions
diff --git a/mcs/class/System.ComponentModel.Composition/.gitignore b/mcs/class/System.ComponentModel.Composition/.gitignore deleted file mode 100644 index 270df4cda87..00000000000 --- a/mcs/class/System.ComponentModel.Composition/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.resources diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/AggregateCatalog.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/AggregateCatalog.xml deleted file mode 100644 index 7c9a15cb56a..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/AggregateCatalog.xml +++ /dev/null @@ -1,262 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="AggregateCatalog" FullName="System.ComponentModel.Composition.Hosting.AggregateCatalog"> - <TypeSignature Language="C#" Value="public class AggregateCatalog : System.ComponentModel.Composition.Primitives.ComposablePartCatalog, System.ComponentModel.Composition.Hosting.INotifyComposablePartCatalogChanged" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit AggregateCatalog extends System.ComponentModel.Composition.Primitives.ComposablePartCatalog implements class System.ComponentModel.Composition.Hosting.INotifyComposablePartCatalogChanged" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.ComponentModel.Composition.Primitives.ComposablePartCatalog</BaseTypeName> - </Base> - <Interfaces> - <Interface> - <InterfaceName>System.ComponentModel.Composition.Hosting.INotifyComposablePartCatalogChanged</InterfaceName> - </Interface> - </Interfaces> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A catalog that combines the elements of <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> objects. </para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public AggregateCatalog ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.AggregateCatalog" /> class.</para> - </summary> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public AggregateCatalog (System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ComposablePartCatalog> catalogs);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.ComposablePartCatalog> catalogs) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="catalogs" Type="System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ComposablePartCatalog>" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.AggregateCatalog" /> class with the specified catalogs.</para> - </summary> - <param name="catalogs"> - <attribution license="cc4" from="Microsoft" modified="false" />A collection of <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> objects to add to the <see cref="T:System.ComponentModel.Composition.Hosting.AggregateCatalog" /> or null to create an empty <see cref="T:System.ComponentModel.Composition.Hosting.AggregateCatalog" />. </param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public AggregateCatalog (System.ComponentModel.Composition.Primitives.ComposablePartCatalog[] catalogs);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.ComponentModel.Composition.Primitives.ComposablePartCatalog[] catalogs) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="catalogs" Type="System.ComponentModel.Composition.Primitives.ComposablePartCatalog[]"> - <Attributes> - <Attribute> - <AttributeName>System.ParamArray</AttributeName> - </Attribute> - </Attributes> - </Parameter> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.AggregateCatalog" /> class with the specified catalogs.</para> - </summary> - <param name="catalogs"> - <attribution license="cc4" from="Microsoft" modified="false" />A array of <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> objects to add to the <see cref="T:System.ComponentModel.Composition.Hosting.AggregateCatalog" />.</param> - </Docs> - </Member> - <Member MemberName="Catalogs"> - <MemberSignature Language="C#" Value="public System.Collections.Generic.ICollection<System.ComponentModel.Composition.Primitives.ComposablePartCatalog> Catalogs { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.ICollection`1<class System.ComponentModel.Composition.Primitives.ComposablePartCatalog> Catalogs" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.ICollection<System.ComponentModel.Composition.Primitives.ComposablePartCatalog></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the underlying catalogs of the <see cref="T:System.ComponentModel.Composition.Hosting.AggregateCatalog" /> object.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Changed"> - <MemberSignature Language="C#" Value="public event EventHandler<System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs> Changed;" /> - <MemberSignature Language="ILAsm" Value=".event class System.EventHandler`1<class System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs> Changed" /> - <MemberType>Event</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.EventHandler<System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs></ReturnType> - </ReturnValue> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Occurs when the contents of the <see cref="T:System.ComponentModel.Composition.Hosting.AggregateCatalog" /> object have changed.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Changing"> - <MemberSignature Language="C#" Value="public event EventHandler<System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs> Changing;" /> - <MemberSignature Language="ILAsm" Value=".event class System.EventHandler`1<class System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs> Changing" /> - <MemberType>Event</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.EventHandler<System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs></ReturnType> - </ReturnValue> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Occurs when the contents of the <see cref="T:System.ComponentModel.Composition.Hosting.AggregateCatalog" /> object are changing.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Dispose"> - <MemberSignature Language="C#" Value="protected override void Dispose (bool disposing);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void Dispose(bool disposing) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="disposing" Type="System.Boolean" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Releases the unmanaged resources used by the <see cref="T:System.ComponentModel.Composition.Hosting.AggregateCatalog" /> and optionally releases the managed resources. </para> - </summary> - <param name="disposing"> - <attribution license="cc4" from="Microsoft" modified="false" />true to release both managed and unmanaged resources; false to release only unmanaged resources. </param> - </Docs> - </Member> - <Member MemberName="GetEnumerator"> - <MemberSignature Language="C#" Value="public override System.Collections.Generic.IEnumerator<System.ComponentModel.Composition.Primitives.ComposablePartDefinition> GetEnumerator ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance class System.Collections.Generic.IEnumerator`1<class System.ComponentModel.Composition.Primitives.ComposablePartDefinition> GetEnumerator() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerator<System.ComponentModel.Composition.Primitives.ComposablePartDefinition></ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns an enumerator that iterates through the catalog.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>An enumerator that can be used to iterate through the catalog.</para> - </returns> - </Docs> - </Member> - <Member MemberName="GetExports"> - <MemberSignature Language="C#" Value="public override System.Collections.Generic.IEnumerable<Tuple<System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.ComponentModel.Composition.Primitives.ExportDefinition>> GetExports (System.ComponentModel.Composition.Primitives.ImportDefinition definition);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance class System.Collections.Generic.IEnumerable`1<class System.Tuple`2<class System.ComponentModel.Composition.Primitives.ComposablePartDefinition, class System.ComponentModel.Composition.Primitives.ExportDefinition>> GetExports(class System.ComponentModel.Composition.Primitives.ImportDefinition definition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.Tuple<System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.ComponentModel.Composition.Primitives.ExportDefinition>></ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="definition" Type="System.ComponentModel.Composition.Primitives.ImportDefinition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the export definitions that match the constraint expressed by the specified definition.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A collection of <see cref="T:System.Tuple`2" /> containing the <see cref="T:System.ComponentModel.Composition.Primitives.ExportDefinition" /> objects and their associated <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> objects for objects that match the constraint specified by <paramref name="definition" />.</para> - </returns> - <param name="definition"> - <attribution license="cc4" from="Microsoft" modified="false" />The conditions of the <see cref="T:System.ComponentModel.Composition.Primitives.ExportDefinition" /> objects to be returned.</param> - </Docs> - </Member> - <Member MemberName="OnChanged"> - <MemberSignature Language="C#" Value="protected virtual void OnChanged (System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs e);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void OnChanged(class System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs e) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="e" Type="System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Raises the <see cref="E:System.ComponentModel.Composition.Hosting.AggregateCatalog.Changed" /> event.</para> - </summary> - <param name="e"> - <attribution license="cc4" from="Microsoft" modified="false" />A <see cref="T:System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs" /> object that contains the event data. </param> - </Docs> - </Member> - <Member MemberName="OnChanging"> - <MemberSignature Language="C#" Value="protected virtual void OnChanging (System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs e);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void OnChanging(class System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs e) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="e" Type="System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Raises the <see cref="E:System.ComponentModel.Composition.Hosting.AggregateCatalog.Changing" /> event.</para> - </summary> - <param name="e"> - <attribution license="cc4" from="Microsoft" modified="false" />A <see cref="T:System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs" /> object that contains the event data. </param> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/AggregateExportProvider.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/AggregateExportProvider.xml deleted file mode 100644 index 35d97377e5f..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/AggregateExportProvider.xml +++ /dev/null @@ -1,182 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="AggregateExportProvider" FullName="System.ComponentModel.Composition.Hosting.AggregateExportProvider"> - <TypeSignature Language="C#" Value="public class AggregateExportProvider : System.ComponentModel.Composition.Hosting.ExportProvider, IDisposable" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit AggregateExportProvider extends System.ComponentModel.Composition.Hosting.ExportProvider implements class System.IDisposable" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.ComponentModel.Composition.Hosting.ExportProvider</BaseTypeName> - </Base> - <Interfaces> - <Interface> - <InterfaceName>System.IDisposable</InterfaceName> - </Interface> - </Interfaces> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Retrieves exports provided by a collection of <see cref="T:System.ComponentModel.Composition.Hosting.ExportProvider" /> objects.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public AggregateExportProvider (System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Hosting.ExportProvider> providers);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Hosting.ExportProvider> providers) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="providers" Type="System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Hosting.ExportProvider>" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The <see cref="T:System.ComponentModel.Composition.Hosting.AggregateExportProvider" /> class consults the providers in the order in which they have been specified when it calls <see cref="M:System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition)" />. </para> - <para>The <see cref="T:System.ComponentModel.Composition.Hosting.AggregateExportProvider" /> does not take ownership of the specified providers. That is, it tries to dispose of any of the providers when it is disposed.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.AggregateExportProvider" /> class.</para> - </summary> - <param name="providers"> - <attribution license="cc4" from="Microsoft" modified="false" />The prioritized list of export providers. The providers are consulted in the order in which they are supplied.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public AggregateExportProvider (System.ComponentModel.Composition.Hosting.ExportProvider[] providers);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.ComponentModel.Composition.Hosting.ExportProvider[] providers) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="providers" Type="System.ComponentModel.Composition.Hosting.ExportProvider[]"> - <Attributes> - <Attribute> - <AttributeName>System.ParamArray</AttributeName> - </Attribute> - </Attributes> - </Parameter> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The <see cref="T:System.ComponentModel.Composition.Hosting.AggregateExportProvider" /> class consults the providers in the order in which they have been specified when it calls <see cref="M:System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition)" />. </para> - <para>The <see cref="T:System.ComponentModel.Composition.Hosting.AggregateExportProvider" /> does not take ownership of the specified providers. That is, it tries to dispose of any of the providers when it is disposed.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.AggregateExportProvider" /> class.</para> - </summary> - <param name="providers"> - <attribution license="cc4" from="Microsoft" modified="false" />The prioritized list of export providers.</param> - </Docs> - </Member> - <Member MemberName="Dispose"> - <MemberSignature Language="C#" Value="public void Dispose ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Dispose() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Call Dispose when you are finished using the <see cref="T:System.ComponentModel.Composition.Hosting.AggregateExportProvider" />. The Dispose method leaves the <see cref="T:System.ComponentModel.Composition.Hosting.AggregateExportProvider" /> in an unusable state. After calling Dispose, you must release all references to the <see cref="T:System.ComponentModel.Composition.Hosting.AggregateExportProvider" /> so the garbage collector can reclaim the memory that the <see cref="T:System.ComponentModel.Composition.Hosting.AggregateExportProvider" /> was occupying.</para> - <para>For more information, see <format type="text/html"><a href="A17B0066-71C2-4BA4-9822-8E19332FC213">Cleaning Up Unmanaged Resources</a></format> and <format type="text/html"><a href="eb4e1af0-3b48-4fbc-ad4e-fc2f64138bf9">Implementing a Dispose Method</a></format>.</para> - <block subset="none" type="note"> - <para>Always call Dispose before you release your last reference to the <see cref="T:System.ComponentModel.Composition.Hosting.AggregateExportProvider" />. Otherwise, the resources it is using will not be freed until the garbage collector calls the <see cref="T:System.ComponentModel.Composition.Hosting.AggregateExportProvider" /> object's Finalize method.</para> - </block> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Releases all resources used by the current instance of the <see cref="T:System.ComponentModel.Composition.Hosting.AggregateExportProvider" /> class. </para> - </summary> - </Docs> - </Member> - <Member MemberName="Dispose"> - <MemberSignature Language="C#" Value="protected virtual void Dispose (bool disposing);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void Dispose(bool disposing) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="disposing" Type="System.Boolean" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Releases the unmanaged resources used by the <see cref="T:System.ComponentModel.Composition.Hosting.AggregateExportProvider" /> class and optionally releases the managed resources. </para> - </summary> - <param name="disposing"> - <attribution license="cc4" from="Microsoft" modified="false" />true to release both managed and unmanaged resources; false to release only unmanaged resources. </param> - </Docs> - </Member> - <Member MemberName="GetExportsCore"> - <MemberSignature Language="C#" Value="protected override System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.Export> GetExportsCore (System.ComponentModel.Composition.Primitives.ImportDefinition definition, System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.Export> GetExportsCore(class System.ComponentModel.Composition.Primitives.ImportDefinition definition, class System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.Export></ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="definition" Type="System.ComponentModel.Composition.Primitives.ImportDefinition" /> - <Parameter Name="atomicComposition" Type="System.ComponentModel.Composition.Hosting.AtomicComposition" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Implementers should not treat cardinality-related mismatches as errors and are not expected to throw exceptions in those cases.</para> - <para>For example, if the import requests exactly one export and the provider has either no matching exports or more than one, the method should return an empty <see cref="T:System.Collections.Generic.IEnumerable`1" /> collection of <see cref="T:System.ComponentModel.Composition.Primitives.Export" />.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets all the exports that match the conditions of the specified import.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A collection that contains all the exports that match the specified condition.</para> - </returns> - <param name="definition"> - <attribution license="cc4" from="Microsoft" modified="false" />The conditions of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects to be returned.</param> - <param name="atomicComposition"> - <attribution license="cc4" from="Microsoft" modified="false" />The transactional container for the composition.</param> - </Docs> - </Member> - <Member MemberName="Providers"> - <MemberSignature Language="C#" Value="public System.Collections.ObjectModel.ReadOnlyCollection<System.ComponentModel.Composition.Hosting.ExportProvider> Providers { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.ObjectModel.ReadOnlyCollection`1<class System.ComponentModel.Composition.Hosting.ExportProvider> Providers" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.ObjectModel.ReadOnlyCollection<System.ComponentModel.Composition.Hosting.ExportProvider></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a collection that contains the providers that the <see cref="T:System.ComponentModel.Composition.Hosting.AggregateExportProvider" /> object aggregates.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/ApplicationCatalog.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/ApplicationCatalog.xml deleted file mode 100644 index b984c29b747..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/ApplicationCatalog.xml +++ /dev/null @@ -1,245 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ApplicationCatalog" FullName="System.ComponentModel.Composition.Hosting.ApplicationCatalog"> - <TypeSignature Language="C#" Value="public class ApplicationCatalog : System.ComponentModel.Composition.Primitives.ComposablePartCatalog, System.ComponentModel.Composition.Primitives.ICompositionElement" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit ApplicationCatalog extends System.ComponentModel.Composition.Primitives.ComposablePartCatalog implements class System.ComponentModel.Composition.Primitives.ICompositionElement" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.ComponentModel.Composition.Primitives.ComposablePartCatalog</BaseTypeName> - </Base> - <Interfaces> - <Interface> - <InterfaceName>System.ComponentModel.Composition.Primitives.ICompositionElement</InterfaceName> - </Interface> - </Interfaces> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Discovers attributed parts in the dynamic link library (DLL) and EXE files in an application's directory and path.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ApplicationCatalog ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.ApplicationCatalog" /> class.</para> - </summary> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ApplicationCatalog (System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="definitionOrigin" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.ApplicationCatalog" /> class by using the specified source for parts.</para> - </summary> - <param name="definitionOrigin"> - <attribution license="cc4" from="Microsoft" modified="false" />The element used by diagnostics to identify the source for parts.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ApplicationCatalog (System.Reflection.ReflectionContext reflectionContext);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Reflection.ReflectionContext reflectionContext) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="reflectionContext" Type="System.Reflection.ReflectionContext" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.ApplicationCatalog" /> class by using the specified reflection context.</para> - </summary> - <param name="reflectionContext"> - <attribution license="cc4" from="Microsoft" modified="false" />The reflection context.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ApplicationCatalog (System.Reflection.ReflectionContext reflectionContext, System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Reflection.ReflectionContext reflectionContext, class System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="reflectionContext" Type="System.Reflection.ReflectionContext" /> - <Parameter Name="definitionOrigin" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.ApplicationCatalog" /> class by using the specified reflection context and source for parts.</para> - </summary> - <param name="reflectionContext"> - <attribution license="cc4" from="Microsoft" modified="false" />The reflection context.</param> - <param name="definitionOrigin"> - <attribution license="cc4" from="Microsoft" modified="false" />The element used by diagnostics to identify the source for parts.</param> - </Docs> - </Member> - <Member MemberName="Dispose"> - <MemberSignature Language="C#" Value="protected override void Dispose (bool disposing);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void Dispose(bool disposing) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="disposing" Type="System.Boolean" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Releases the unmanaged resources used by the <see cref="T:System.ComponentModel.Composition.Hosting.DirectoryCatalog" /> and optionally releases the managed resources. </para> - </summary> - <param name="disposing"> - <attribution license="cc4" from="Microsoft" modified="false" />true to release both managed and unmanaged resources; false to release only unmanaged resources. </param> - </Docs> - </Member> - <Member MemberName="GetEnumerator"> - <MemberSignature Language="C#" Value="public override System.Collections.Generic.IEnumerator<System.ComponentModel.Composition.Primitives.ComposablePartDefinition> GetEnumerator ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance class System.Collections.Generic.IEnumerator`1<class System.ComponentModel.Composition.Primitives.ComposablePartDefinition> GetEnumerator() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerator<System.ComponentModel.Composition.Primitives.ComposablePartDefinition></ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns an enumerator that iterates through the collection.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>An enumerator that can be used to iterate through the collection.</para> - </returns> - </Docs> - </Member> - <Member MemberName="GetExports"> - <MemberSignature Language="C#" Value="public override System.Collections.Generic.IEnumerable<Tuple<System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.ComponentModel.Composition.Primitives.ExportDefinition>> GetExports (System.ComponentModel.Composition.Primitives.ImportDefinition definition);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance class System.Collections.Generic.IEnumerable`1<class System.Tuple`2<class System.ComponentModel.Composition.Primitives.ComposablePartDefinition, class System.ComponentModel.Composition.Primitives.ExportDefinition>> GetExports(class System.ComponentModel.Composition.Primitives.ImportDefinition definition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.Tuple<System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.ComponentModel.Composition.Primitives.ExportDefinition>></ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="definition" Type="System.ComponentModel.Composition.Primitives.ImportDefinition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the export definitions that match the constraint expressed by the specified import definition.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A collection of objects that contain the <see cref="T:System.ComponentModel.Composition.Primitives.ExportDefinition" /> objects and their associated <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> objects that match the specified constraint.</para> - </returns> - <param name="definition"> - <attribution license="cc4" from="Microsoft" modified="false" />The conditions of the <see cref="T:System.ComponentModel.Composition.Primitives.ExportDefinition" /> objects to be returned.</param> - </Docs> - </Member> - <Member MemberName="System.ComponentModel.Composition.Primitives.ICompositionElement.DisplayName"> - <MemberSignature Language="C#" Value="string System.ComponentModel.Composition.Primitives.ICompositionElement.DisplayName { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance string System.ComponentModel.Composition.Primitives.ICompositionElement.DisplayName" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This member is an explicit interface member implementation. It can be used only when the <see cref="T:System.ComponentModel.Composition.Hosting.ApplicationCatalog" /> instance is cast to an <see cref="T:System.ComponentModel.Composition.Primitives.ICompositionElement" /> interface.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the display name of the application catalog.</para> - </summary> - </Docs> - </Member> - <Member MemberName="System.ComponentModel.Composition.Primitives.ICompositionElement.Origin"> - <MemberSignature Language="C#" Value="System.ComponentModel.Composition.Primitives.ICompositionElement System.ComponentModel.Composition.Primitives.ICompositionElement.Origin { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.ComponentModel.Composition.Primitives.ICompositionElement System.ComponentModel.Composition.Primitives.ICompositionElement.Origin" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ICompositionElement</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This member is an explicit interface member implementation. It can be used only when the <see cref="T:System.ComponentModel.Composition.Hosting.ApplicationCatalog" /> instance is cast to an <see cref="T:System.ComponentModel.Composition.Primitives.ICompositionElement" /> interface.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the composition element from which the application catalog originated.</para> - </summary> - </Docs> - </Member> - <Member MemberName="ToString"> - <MemberSignature Language="C#" Value="public override string ToString ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance string ToString() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Retrieves a string representation of the application catalog.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A string representation of the catalog.</para> - </returns> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/AssemblyCatalog.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/AssemblyCatalog.xml deleted file mode 100644 index 935a63d93b2..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/AssemblyCatalog.xml +++ /dev/null @@ -1,381 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="AssemblyCatalog" FullName="System.ComponentModel.Composition.Hosting.AssemblyCatalog"> - <TypeSignature Language="C#" Value="public class AssemblyCatalog : System.ComponentModel.Composition.Primitives.ComposablePartCatalog, System.ComponentModel.Composition.Primitives.ICompositionElement" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit AssemblyCatalog extends System.ComponentModel.Composition.Primitives.ComposablePartCatalog implements class System.ComponentModel.Composition.Primitives.ICompositionElement" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.ComponentModel.Composition.Primitives.ComposablePartCatalog</BaseTypeName> - </Base> - <Interfaces> - <Interface> - <InterfaceName>System.ComponentModel.Composition.Primitives.ICompositionElement</InterfaceName> - </Interface> - </Interfaces> - <Attributes> - <Attribute> - <AttributeName>System.Diagnostics.DebuggerTypeProxy(typeof(System.ComponentModel.Composition.Hosting.AssemblyCatalogDebuggerProxy))</AttributeName> - </Attribute> - </Attributes> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>An <see cref="T:System.ComponentModel.Composition.Hosting.AssemblyCatalog" /> is used to parse all the parts present in a specified assembly. The target assembly can be indicated either by object reference or by path.</para> - <para>This type is thread safe.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Discovers attributed parts in a managed code assembly.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public AssemblyCatalog (System.Reflection.Assembly assembly);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Reflection.Assembly assembly) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="assembly" Type="System.Reflection.Assembly" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.AssemblyCatalog" /> class with the specified assembly.</para> - </summary> - <param name="assembly"> - <attribution license="cc4" from="Microsoft" modified="false" />The assembly that contains the attributed <see cref="T:System.Type" /> objects to add to the <see cref="T:System.ComponentModel.Composition.Hosting.AssemblyCatalog" /> object.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public AssemblyCatalog (string codeBase);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string codeBase) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="codeBase" Type="System.String" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The assembly referenced by <paramref name="codeBase" /> is loaded into the load context.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.AssemblyCatalog" /> class with the specified code base.</para> - </summary> - <param name="codeBase"> - <attribution license="cc4" from="Microsoft" modified="false" />A string that specifies the code base of the assembly (that is, the path to the assembly file) that contains the attributed <see cref="T:System.Type" /> objects to add to the <see cref="T:System.ComponentModel.Composition.Hosting.AssemblyCatalog" /> object.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public AssemblyCatalog (System.Reflection.Assembly assembly, System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Reflection.Assembly assembly, class System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="assembly" Type="System.Reflection.Assembly" /> - <Parameter Name="definitionOrigin" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.AssemblyCatalog" /> class with the specified assembly.</para> - </summary> - <param name="assembly"> - <attribution license="cc4" from="Microsoft" modified="false" />The assembly that contains the attributed <see cref="T:System.Type" /> objects to add to the <see cref="T:System.ComponentModel.Composition.Hosting.AssemblyCatalog" /> object.</param> - <param name="definitionOrigin"> - <attribution license="cc4" from="Microsoft" modified="false" />The element used by diagnostics to identify the sources of parts.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public AssemblyCatalog (System.Reflection.Assembly assembly, System.Reflection.ReflectionContext reflectionContext);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Reflection.Assembly assembly, class System.Reflection.ReflectionContext reflectionContext) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="assembly" Type="System.Reflection.Assembly" /> - <Parameter Name="reflectionContext" Type="System.Reflection.ReflectionContext" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.AssemblyCatalog" /> class with the specified assembly and reflection context.</para> - </summary> - <param name="assembly"> - <attribution license="cc4" from="Microsoft" modified="false" />The assembly that contains the attributed <see cref="T:System.Type" /> objects to add to the <see cref="T:System.ComponentModel.Composition.Hosting.AssemblyCatalog" /> object.</param> - <param name="reflectionContext"> - <attribution license="cc4" from="Microsoft" modified="false" />The context used by the catalog to interpret types.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public AssemblyCatalog (string codeBase, System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string codeBase, class System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="codeBase" Type="System.String" /> - <Parameter Name="definitionOrigin" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.AssemblyCatalog" /> class with the specified code base.</para> - </summary> - <param name="codeBase"> - <attribution license="cc4" from="Microsoft" modified="false" />A string that specifies the code base of the assembly (that is, the path to the assembly file) that contains the attributed <see cref="T:System.Type" /> objects to add to the <see cref="T:System.ComponentModel.Composition.Hosting.AssemblyCatalog" /> object.</param> - <param name="definitionOrigin"> - <attribution license="cc4" from="Microsoft" modified="false" />The element used by diagnostics to identify the sources of parts.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public AssemblyCatalog (string codeBase, System.Reflection.ReflectionContext reflectionContext);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string codeBase, class System.Reflection.ReflectionContext reflectionContext) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="codeBase" Type="System.String" /> - <Parameter Name="reflectionContext" Type="System.Reflection.ReflectionContext" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.AssemblyCatalog" /> class with the specified code base and reflection context.</para> - </summary> - <param name="codeBase"> - <attribution license="cc4" from="Microsoft" modified="false" />A string that specifies the code base of the assembly (that is, the path to the assembly file) that contains the attributed <see cref="T:System.Type" /> objects to add to the <see cref="T:System.ComponentModel.Composition.Hosting.AssemblyCatalog" /> object.</param> - <param name="reflectionContext"> - <attribution license="cc4" from="Microsoft" modified="false" />The context used by the catalog to interpret types.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public AssemblyCatalog (System.Reflection.Assembly assembly, System.Reflection.ReflectionContext reflectionContext, System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Reflection.Assembly assembly, class System.Reflection.ReflectionContext reflectionContext, class System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="assembly" Type="System.Reflection.Assembly" /> - <Parameter Name="reflectionContext" Type="System.Reflection.ReflectionContext" /> - <Parameter Name="definitionOrigin" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.AssemblyCatalog" /> class with the specified assembly and reflection context.</para> - </summary> - <param name="assembly"> - <attribution license="cc4" from="Microsoft" modified="false" />The assembly that contains the attributed <see cref="T:System.Type" /> objects to add to the <see cref="T:System.ComponentModel.Composition.Hosting.AssemblyCatalog" /> object.</param> - <param name="reflectionContext"> - <attribution license="cc4" from="Microsoft" modified="false" />The context used by the catalog to interpret types.</param> - <param name="definitionOrigin"> - <attribution license="cc4" from="Microsoft" modified="false" />The element used by diagnostics to identify the sources of parts.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public AssemblyCatalog (string codeBase, System.Reflection.ReflectionContext reflectionContext, System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string codeBase, class System.Reflection.ReflectionContext reflectionContext, class System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="codeBase" Type="System.String" /> - <Parameter Name="reflectionContext" Type="System.Reflection.ReflectionContext" /> - <Parameter Name="definitionOrigin" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.AssemblyCatalog" /> class with the specified code base and reflection context.</para> - </summary> - <param name="codeBase"> - <attribution license="cc4" from="Microsoft" modified="false" />A string that specifies the code base of the assembly (that is, the path to the assembly file) that contains the attributed <see cref="T:System.Type" /> objects to add to the <see cref="T:System.ComponentModel.Composition.Hosting.AssemblyCatalog" /> object.</param> - <param name="reflectionContext"> - <attribution license="cc4" from="Microsoft" modified="false" />The context used by the catalog to interpret types.</param> - <param name="definitionOrigin"> - <attribution license="cc4" from="Microsoft" modified="false" />The element used by diagnostics to identify the sources of parts.</param> - </Docs> - </Member> - <Member MemberName="Assembly"> - <MemberSignature Language="C#" Value="public System.Reflection.Assembly Assembly { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Reflection.Assembly Assembly" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Reflection.Assembly</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the assembly whose attributed types are contained in the assembly catalog.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Dispose"> - <MemberSignature Language="C#" Value="protected override void Dispose (bool disposing);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void Dispose(bool disposing) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="disposing" Type="System.Boolean" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Releases the unmanaged resources used by the <see cref="T:System.ComponentModel.Composition.Hosting.AssemblyCatalog" /> and optionally releases the managed resources. </para> - </summary> - <param name="disposing"> - <attribution license="cc4" from="Microsoft" modified="false" />true to release both managed and unmanaged resources; false to release only unmanaged resources. </param> - </Docs> - </Member> - <Member MemberName="GetEnumerator"> - <MemberSignature Language="C#" Value="public override System.Collections.Generic.IEnumerator<System.ComponentModel.Composition.Primitives.ComposablePartDefinition> GetEnumerator ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance class System.Collections.Generic.IEnumerator`1<class System.ComponentModel.Composition.Primitives.ComposablePartDefinition> GetEnumerator() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerator<System.ComponentModel.Composition.Primitives.ComposablePartDefinition></ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns an enumerator that iterates through the catalog.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>An enumerator that can be used to iterate through the catalog.</para> - </returns> - </Docs> - </Member> - <Member MemberName="GetExports"> - <MemberSignature Language="C#" Value="public override System.Collections.Generic.IEnumerable<Tuple<System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.ComponentModel.Composition.Primitives.ExportDefinition>> GetExports (System.ComponentModel.Composition.Primitives.ImportDefinition definition);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance class System.Collections.Generic.IEnumerable`1<class System.Tuple`2<class System.ComponentModel.Composition.Primitives.ComposablePartDefinition, class System.ComponentModel.Composition.Primitives.ExportDefinition>> GetExports(class System.ComponentModel.Composition.Primitives.ImportDefinition definition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.Tuple<System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.ComponentModel.Composition.Primitives.ExportDefinition>></ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="definition" Type="System.ComponentModel.Composition.Primitives.ImportDefinition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a collection of exports that match the conditions specified by the import definition.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A collection of exports that match the conditions specified by <paramref name="definition" />.</para> - </returns> - <param name="definition"> - <attribution license="cc4" from="Microsoft" modified="false" />Conditions that specify which exports to match.</param> - </Docs> - </Member> - <Member MemberName="System.ComponentModel.Composition.Primitives.ICompositionElement.DisplayName"> - <MemberSignature Language="C#" Value="string System.ComponentModel.Composition.Primitives.ICompositionElement.DisplayName { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance string System.ComponentModel.Composition.Primitives.ICompositionElement.DisplayName" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This member is an explicit interface member implementation. It can be used only when the <see cref="T:System.ComponentModel.Composition.Hosting.AssemblyCatalog" /> instance is cast to an <see cref="T:System.ComponentModel.Composition.Primitives.ICompositionElement" /> interface.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the display name of the <see cref="T:System.ComponentModel.Composition.Hosting.AssemblyCatalog" /> object.</para> - </summary> - </Docs> - </Member> - <Member MemberName="System.ComponentModel.Composition.Primitives.ICompositionElement.Origin"> - <MemberSignature Language="C#" Value="System.ComponentModel.Composition.Primitives.ICompositionElement System.ComponentModel.Composition.Primitives.ICompositionElement.Origin { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.ComponentModel.Composition.Primitives.ICompositionElement System.ComponentModel.Composition.Primitives.ICompositionElement.Origin" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ICompositionElement</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This member is an explicit interface member implementation. It can be used only when the <see cref="T:System.ComponentModel.Composition.Hosting.AssemblyCatalog" /> instance is cast to an <see cref="T:System.ComponentModel.Composition.Primitives.ICompositionElement" /> interface.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the composition element that this element originated from.</para> - </summary> - </Docs> - </Member> - <Member MemberName="ToString"> - <MemberSignature Language="C#" Value="public override string ToString ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance string ToString() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a string representation of the assembly catalog.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A representation of the assembly catalog.</para> - </returns> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/AtomicComposition.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/AtomicComposition.xml deleted file mode 100644 index 1542a5e8912..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/AtomicComposition.xml +++ /dev/null @@ -1,259 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="AtomicComposition" FullName="System.ComponentModel.Composition.Hosting.AtomicComposition"> - <TypeSignature Language="C#" Value="public class AtomicComposition : IDisposable" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit AtomicComposition extends System.Object implements class System.IDisposable" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Object</BaseTypeName> - </Base> - <Interfaces> - <Interface> - <InterfaceName>System.IDisposable</InterfaceName> - </Interface> - </Interfaces> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Represents a single composition operation for transactional composition.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public AtomicComposition ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.AtomicComposition" /> class. </para> - </summary> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public AtomicComposition (System.ComponentModel.Composition.Hosting.AtomicComposition outerAtomicComposition);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.ComponentModel.Composition.Hosting.AtomicComposition outerAtomicComposition) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="outerAtomicComposition" Type="System.ComponentModel.Composition.Hosting.AtomicComposition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.AtomicComposition" /> class with the specified parent <see cref="T:System.ComponentModel.Composition.Hosting.AtomicComposition" />.</para> - </summary> - <param name="outerAtomicComposition"> - <attribution license="cc4" from="Microsoft" modified="false" />The parent of this composition operation.</param> - </Docs> - </Member> - <Member MemberName="AddCompleteAction"> - <MemberSignature Language="C#" Value="public void AddCompleteAction (Action completeAction);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void AddCompleteAction(class System.Action completeAction) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="completeAction" Type="System.Action" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Adds an action to be executed when the overall composition operation completes successfully.</para> - </summary> - <param name="completeAction"> - <attribution license="cc4" from="Microsoft" modified="false" />The action to be executed.</param> - </Docs> - </Member> - <Member MemberName="AddRevertAction"> - <MemberSignature Language="C#" Value="public void AddRevertAction (Action revertAction);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void AddRevertAction(class System.Action revertAction) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="revertAction" Type="System.Action" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Adds an action to be executed if the overall composition operation fails.</para> - </summary> - <param name="revertAction"> - <attribution license="cc4" from="Microsoft" modified="false" />The action to be executed.</param> - </Docs> - </Member> - <Member MemberName="Complete"> - <MemberSignature Language="C#" Value="public void Complete ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Complete() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>If this <see cref="T:System.ComponentModel.Composition.Hosting.AtomicComposition" /> is nested, completion actions will not be executed until the parent composition operation has also completed.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Marks this composition operation as complete.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Dispose"> - <MemberSignature Language="C#" Value="public void Dispose ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Dispose() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Call Dispose when you are finished using the <see cref="T:System.ComponentModel.Composition.Hosting.AtomicComposition" />. The Dispose method leaves the <see cref="T:System.ComponentModel.Composition.Hosting.AtomicComposition" /> in an unusable state. After calling Dispose, you must release all references to the <see cref="T:System.ComponentModel.Composition.Hosting.AtomicComposition" /> so the garbage collector can reclaim the memory that the <see cref="T:System.ComponentModel.Composition.Hosting.AtomicComposition" /> was occupying.</para> - <para>For more information, see <format type="text/html"><a href="A17B0066-71C2-4BA4-9822-8E19332FC213">Cleaning Up Unmanaged Resources</a></format> and <format type="text/html"><a href="eb4e1af0-3b48-4fbc-ad4e-fc2f64138bf9">Implementing a Dispose Method</a></format>.</para> - <block subset="none" type="note"> - <para>Always call Dispose before you release your last reference to the <see cref="T:System.ComponentModel.Composition.Hosting.AtomicComposition" />. Otherwise, the resources it is using will not be freed until the garbage collector calls the <see cref="T:System.ComponentModel.Composition.Hosting.AtomicComposition" /> object's Finalize method.</para> - </block> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Releases all resources used by the current instance of the <see cref="T:System.ComponentModel.Composition.Hosting.AtomicComposition" /> class, and mark this composition operation as failed.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Dispose"> - <MemberSignature Language="C#" Value="protected virtual void Dispose (bool disposing);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void Dispose(bool disposing) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="disposing" Type="System.Boolean" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Releases the unmanaged resources used by the <see cref="T:System.ComponentModel.Composition.Hosting.AtomicComposition" /> and optionally releases the managed resources. </para> - </summary> - <param name="disposing"> - <attribution license="cc4" from="Microsoft" modified="false" />true to release both managed and unmanaged resources; false to release only unmanaged resources. </param> - </Docs> - </Member> - <Member MemberName="SetValue"> - <MemberSignature Language="C#" Value="public void SetValue (object key, object value);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void SetValue(object key, object value) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="key" Type="System.Object" /> - <Parameter Name="value" Type="System.Object" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Saves a key-value pair in the transaction to track tentative state.</para> - </summary> - <param name="key"> - <attribution license="cc4" from="Microsoft" modified="false" />The key to save.</param> - <param name="value"> - <attribution license="cc4" from="Microsoft" modified="false" />The value to save.</param> - </Docs> - </Member> - <Member MemberName="TryGetValue<T>"> - <MemberSignature Language="C#" Value="public bool TryGetValue<T> (object key, out T value);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance bool TryGetValue<T>(object key, !!T value) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="key" Type="System.Object" /> - <Parameter Name="value" Type="T&" RefType="out" /> - </Parameters> - <Docs> - <typeparam name="T">To be added.</typeparam> - <param name="key">To be added.</param> - <param name="value">To be added.</param> - <summary>To be added.</summary> - <returns>To be added.</returns> - <remarks>To be added.</remarks> - </Docs> - </Member> - <Member MemberName="TryGetValue<T>"> - <MemberSignature Language="C#" Value="public bool TryGetValue<T> (object key, bool localAtomicCompositionOnly, out T value);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance bool TryGetValue<T>(object key, bool localAtomicCompositionOnly, !!T value) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="key" Type="System.Object" /> - <Parameter Name="localAtomicCompositionOnly" Type="System.Boolean" /> - <Parameter Name="value" Type="T&" RefType="out" /> - </Parameters> - <Docs> - <typeparam name="T">To be added.</typeparam> - <param name="key">To be added.</param> - <param name="localAtomicCompositionOnly">To be added.</param> - <param name="value">To be added.</param> - <summary>To be added.</summary> - <returns>To be added.</returns> - <remarks>To be added.</remarks> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/CatalogExportProvider.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/CatalogExportProvider.xml deleted file mode 100644 index 2243cfd22cc..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/CatalogExportProvider.xml +++ /dev/null @@ -1,215 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="CatalogExportProvider" FullName="System.ComponentModel.Composition.Hosting.CatalogExportProvider"> - <TypeSignature Language="C#" Value="public class CatalogExportProvider : System.ComponentModel.Composition.Hosting.ExportProvider, IDisposable" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit CatalogExportProvider extends System.ComponentModel.Composition.Hosting.ExportProvider implements class System.IDisposable" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.ComponentModel.Composition.Hosting.ExportProvider</BaseTypeName> - </Base> - <Interfaces> - <Interface> - <InterfaceName>System.IDisposable</InterfaceName> - </Interface> - </Interfaces> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Retrieves exports from a catalog.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CatalogExportProvider (System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="catalog" Type="System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.CatalogExportProvider" /> class with the specified catalog.</para> - </summary> - <param name="catalog"> - <attribution license="cc4" from="Microsoft" modified="false" />The catalog that the <see cref="T:System.ComponentModel.Composition.Hosting.CatalogExportProvider" /> uses to produce <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CatalogExportProvider (System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, bool isThreadSafe);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, bool isThreadSafe) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="catalog" Type="System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> - <Parameter Name="isThreadSafe" Type="System.Boolean" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.CatalogExportProvider" /> class with the specified catalog and optional thread-safe mode. </para> - </summary> - <param name="catalog"> - <attribution license="cc4" from="Microsoft" modified="false" />The catalog that the <see cref="T:System.ComponentModel.Composition.Hosting.CatalogExportProvider" /> uses to produce <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects.</param> - <param name="isThreadSafe"> - <attribution license="cc4" from="Microsoft" modified="false" />true if this object must be thread-safe; otherwise, false.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CatalogExportProvider (System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, System.ComponentModel.Composition.Hosting.CompositionOptions compositionOptions);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, valuetype System.ComponentModel.Composition.Hosting.CompositionOptions compositionOptions) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="catalog" Type="System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> - <Parameter Name="compositionOptions" Type="System.ComponentModel.Composition.Hosting.CompositionOptions" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.CatalogExportProvider" /> class with the specified catalog and composition options.</para> - </summary> - <param name="catalog"> - <attribution license="cc4" from="Microsoft" modified="false" />The catalog that the <see cref="T:System.ComponentModel.Composition.Hosting.CatalogExportProvider" /> uses to produce <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects.</param> - <param name="compositionOptions"> - <attribution license="cc4" from="Microsoft" modified="false" />Options that determine the behavior of this provider.</param> - </Docs> - </Member> - <Member MemberName="Catalog"> - <MemberSignature Language="C#" Value="public System.ComponentModel.Composition.Primitives.ComposablePartCatalog Catalog { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.ComponentModel.Composition.Primitives.ComposablePartCatalog Catalog" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ComposablePartCatalog</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the catalog that is used to provide exports.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Dispose"> - <MemberSignature Language="C#" Value="public void Dispose ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Dispose() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Call Dispose when you are finished using the <see cref="T:System.ComponentModel.Composition.Hosting.CatalogExportProvider" />. The Dispose method leaves the <see cref="T:System.ComponentModel.Composition.Hosting.CatalogExportProvider" /> in an unusable state. After calling Dispose, you must release all references to the <see cref="T:System.ComponentModel.Composition.Hosting.CatalogExportProvider" /> so the garbage collector can reclaim the memory that the <see cref="T:System.ComponentModel.Composition.Hosting.CatalogExportProvider" /> was occupying.</para> - <para>For more information, see <format type="text/html"><a href="A17B0066-71C2-4BA4-9822-8E19332FC213">Cleaning Up Unmanaged Resources</a></format> and <format type="text/html"><a href="eb4e1af0-3b48-4fbc-ad4e-fc2f64138bf9">Implementing a Dispose Method</a></format>.</para> - <block subset="none" type="note"> - <para>Always call Dispose before you release your last reference to the <see cref="T:System.ComponentModel.Composition.Hosting.CatalogExportProvider" />. Otherwise, the resources it is using will not be freed until the garbage collector calls the <see cref="T:System.ComponentModel.Composition.Hosting.CatalogExportProvider" /> object's Finalize method.</para> - </block> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Releases all resources used by the current instance of the <see cref="T:System.ComponentModel.Composition.Hosting.CatalogExportProvider" /> class.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Dispose"> - <MemberSignature Language="C#" Value="protected virtual void Dispose (bool disposing);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void Dispose(bool disposing) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="disposing" Type="System.Boolean" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Releases the unmanaged resources used by the <see cref="T:System.ComponentModel.Composition.Hosting.CatalogExportProvider" /> and optionally releases the managed resources. </para> - </summary> - <param name="disposing"> - <attribution license="cc4" from="Microsoft" modified="false" />true to release both managed and unmanaged resources; false to release only unmanaged resources. </param> - </Docs> - </Member> - <Member MemberName="GetExportsCore"> - <MemberSignature Language="C#" Value="protected override System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.Export> GetExportsCore (System.ComponentModel.Composition.Primitives.ImportDefinition definition, System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.Export> GetExportsCore(class System.ComponentModel.Composition.Primitives.ImportDefinition definition, class System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.Export></ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="definition" Type="System.ComponentModel.Composition.Primitives.ImportDefinition" /> - <Parameter Name="atomicComposition" Type="System.ComponentModel.Composition.Hosting.AtomicComposition" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Implementers should not treat cardinality-related mismatches as errors and should not throw exceptions for cardinality-related mismatches. For example, if the import requests exactly one export and the provider has either no matching exports or more than one, the <see cref="M:System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportsCore(System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition)" /> method should return an empty <see cref="T:System.Collections.Generic.IEnumerable`1" /> collection of <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns all exports that match the conditions of the specified import.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A collection that contains all the exports that match the specified condition.</para> - </returns> - <param name="definition"> - <attribution license="cc4" from="Microsoft" modified="false" />The conditions of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects to be returned.</param> - <param name="atomicComposition"> - <attribution license="cc4" from="Microsoft" modified="false" />The composition transaction to use, or null to disable transactional composition.</param> - </Docs> - </Member> - <Member MemberName="SourceProvider"> - <MemberSignature Language="C#" Value="public System.ComponentModel.Composition.Hosting.ExportProvider SourceProvider { get; set; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.ComponentModel.Composition.Hosting.ExportProvider SourceProvider" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Hosting.ExportProvider</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>You must set this property before you access any methods on the <see cref="T:System.ComponentModel.Composition.Hosting.CatalogExportProvider" /> object.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets or sets the export provider that provides access to additional exports.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/CatalogExtensions.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/CatalogExtensions.xml deleted file mode 100644 index 2d56d3d466d..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/CatalogExtensions.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="CatalogExtensions" FullName="System.ComponentModel.Composition.Hosting.CatalogExtensions"> - <TypeSignature Language="C#" Value="public static class CatalogExtensions" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi abstract sealed beforefieldinit CatalogExtensions extends System.Object" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Object</BaseTypeName> - </Base> - <Interfaces /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Provides extension methods for constructing composition services.</para> - </summary> - </Docs> - <Members> - <Member MemberName="CreateCompositionService"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Hosting.CompositionService CreateCompositionService (this System.ComponentModel.Composition.Primitives.ComposablePartCatalog composablePartCatalog);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Hosting.CompositionService CreateCompositionService(class System.ComponentModel.Composition.Primitives.ComposablePartCatalog composablePartCatalog) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Hosting.CompositionService</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="composablePartCatalog" Type="System.ComponentModel.Composition.Primitives.ComposablePartCatalog" RefType="this" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Creates a new composition service by using the specified catalog as a source for exports.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A new composition service.</para> - </returns> - <param name="composablePartCatalog"> - <attribution license="cc4" from="Microsoft" modified="false" />The catalog that will provide exports.</param> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/ComposablePartCatalogChangeEventArgs.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/ComposablePartCatalogChangeEventArgs.xml deleted file mode 100644 index a14855a728a..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/ComposablePartCatalogChangeEventArgs.xml +++ /dev/null @@ -1,105 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ComposablePartCatalogChangeEventArgs" FullName="System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs"> - <TypeSignature Language="C#" Value="public class ComposablePartCatalogChangeEventArgs : EventArgs" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit ComposablePartCatalogChangeEventArgs extends System.EventArgs" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.EventArgs</BaseTypeName> - </Base> - <Interfaces /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Provides data for the <see cref="E:System.ComponentModel.Composition.Hosting.INotifyComposablePartCatalogChanged.Changed" /> event.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ComposablePartCatalogChangeEventArgs (System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ComposablePartDefinition> addedDefinitions, System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ComposablePartDefinition> removedDefinitions, System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.ComposablePartDefinition> addedDefinitions, class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.ComposablePartDefinition> removedDefinitions, class System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="addedDefinitions" Type="System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ComposablePartDefinition>" /> - <Parameter Name="removedDefinitions" Type="System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ComposablePartDefinition>" /> - <Parameter Name="atomicComposition" Type="System.ComponentModel.Composition.Hosting.AtomicComposition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs" /> class with the specified changes.</para> - </summary> - <param name="addedDefinitions"> - <attribution license="cc4" from="Microsoft" modified="false" />The part definitions that were added to the catalog.</param> - <param name="removedDefinitions"> - <attribution license="cc4" from="Microsoft" modified="false" />The part definitions that were removed from the catalog.</param> - <param name="atomicComposition"> - <attribution license="cc4" from="Microsoft" modified="false" />The composition transaction to use, or null to disable transactional composition.</param> - </Docs> - </Member> - <Member MemberName="AddedDefinitions"> - <MemberSignature Language="C#" Value="public System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ComposablePartDefinition> AddedDefinitions { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.ComposablePartDefinition> AddedDefinitions" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ComposablePartDefinition></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a collection of definitions added to the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> in this change.</para> - </summary> - </Docs> - </Member> - <Member MemberName="AtomicComposition"> - <MemberSignature Language="C#" Value="public System.ComponentModel.Composition.Hosting.AtomicComposition AtomicComposition { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.ComponentModel.Composition.Hosting.AtomicComposition AtomicComposition" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Hosting.AtomicComposition</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the composition transaction for this change.</para> - </summary> - </Docs> - </Member> - <Member MemberName="RemovedDefinitions"> - <MemberSignature Language="C#" Value="public System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ComposablePartDefinition> RemovedDefinitions { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.ComposablePartDefinition> RemovedDefinitions" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ComposablePartDefinition></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a collection of definitions removed from the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> in this change.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/ComposablePartExportProvider.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/ComposablePartExportProvider.xml deleted file mode 100644 index 1f7ee3eeef9..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/ComposablePartExportProvider.xml +++ /dev/null @@ -1,209 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ComposablePartExportProvider" FullName="System.ComponentModel.Composition.Hosting.ComposablePartExportProvider"> - <TypeSignature Language="C#" Value="public class ComposablePartExportProvider : System.ComponentModel.Composition.Hosting.ExportProvider, IDisposable" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit ComposablePartExportProvider extends System.ComponentModel.Composition.Hosting.ExportProvider implements class System.IDisposable" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.ComponentModel.Composition.Hosting.ExportProvider</BaseTypeName> - </Base> - <Interfaces> - <Interface> - <InterfaceName>System.IDisposable</InterfaceName> - </Interface> - </Interfaces> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Retrieves exports from a part.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ComposablePartExportProvider ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.ComposablePartExportProvider" /> class.</para> - </summary> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ComposablePartExportProvider (bool isThreadSafe);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(bool isThreadSafe) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="isThreadSafe" Type="System.Boolean" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.ComposablePartExportProvider" /> class, optionally in thread-safe mode. </para> - </summary> - <param name="isThreadSafe"> - <attribution license="cc4" from="Microsoft" modified="false" />true if the <see cref="T:System.ComponentModel.Composition.Hosting.ComposablePartExportProvider" /> object must be thread-safe; otherwise, false.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ComposablePartExportProvider (System.ComponentModel.Composition.Hosting.CompositionOptions compositionOptions);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(valuetype System.ComponentModel.Composition.Hosting.CompositionOptions compositionOptions) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="compositionOptions" Type="System.ComponentModel.Composition.Hosting.CompositionOptions" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.ComposablePartExportProvider" /> class with the specified composition options.</para> - </summary> - <param name="compositionOptions"> - <attribution license="cc4" from="Microsoft" modified="false" />Options that specify the behavior of this provider.</param> - </Docs> - </Member> - <Member MemberName="Compose"> - <MemberSignature Language="C#" Value="public void Compose (System.ComponentModel.Composition.Hosting.CompositionBatch batch);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Compose(class System.ComponentModel.Composition.Hosting.CompositionBatch batch) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="batch" Type="System.ComponentModel.Composition.Hosting.CompositionBatch" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Executes composition on the specified batch.</para> - </summary> - <param name="batch"> - <attribution license="cc4" from="Microsoft" modified="false" />The batch to execute composition on.</param> - </Docs> - </Member> - <Member MemberName="Dispose"> - <MemberSignature Language="C#" Value="public void Dispose ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Dispose() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Call Dispose when you are finished using the <see cref="T:System.ComponentModel.Composition.Hosting.ComposablePartExportProvider" />. The Dispose method leaves the <see cref="T:System.ComponentModel.Composition.Hosting.ComposablePartExportProvider" /> in an unusable state. After calling Dispose, you must release all references to the <see cref="T:System.ComponentModel.Composition.Hosting.ComposablePartExportProvider" /> so the garbage collector can reclaim the memory that the <see cref="T:System.ComponentModel.Composition.Hosting.ComposablePartExportProvider" /> was occupying.</para> - <para>For more information, see <format type="text/html"><a href="A17B0066-71C2-4BA4-9822-8E19332FC213">Cleaning Up Unmanaged Resources</a></format> and <format type="text/html"><a href="eb4e1af0-3b48-4fbc-ad4e-fc2f64138bf9">Implementing a Dispose Method</a></format>.</para> - <block subset="none" type="note"> - <para>Always call Dispose before you release your last reference to the <see cref="T:System.ComponentModel.Composition.Hosting.ComposablePartExportProvider" />. Otherwise, the resources it is using will not be freed until the garbage collector calls the <see cref="T:System.ComponentModel.Composition.Hosting.ComposablePartExportProvider" /> object's Finalize method.</para> - </block> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Releases all resources used by the current instance of the <see cref="T:System.ComponentModel.Composition.Hosting.ComposablePartExportProvider" /> class.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Dispose"> - <MemberSignature Language="C#" Value="protected virtual void Dispose (bool disposing);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void Dispose(bool disposing) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="disposing" Type="System.Boolean" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Releases the unmanaged resources used by the <see cref="T:System.ComponentModel.Composition.Hosting.ComposablePartExportProvider" /> and optionally releases the managed resources. </para> - </summary> - <param name="disposing"> - <attribution license="cc4" from="Microsoft" modified="false" />true to release both managed and unmanaged resources; false to release only unmanaged resources. </param> - </Docs> - </Member> - <Member MemberName="GetExportsCore"> - <MemberSignature Language="C#" Value="protected override System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.Export> GetExportsCore (System.ComponentModel.Composition.Primitives.ImportDefinition definition, System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.Export> GetExportsCore(class System.ComponentModel.Composition.Primitives.ImportDefinition definition, class System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.Export></ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="definition" Type="System.ComponentModel.Composition.Primitives.ImportDefinition" /> - <Parameter Name="atomicComposition" Type="System.ComponentModel.Composition.Hosting.AtomicComposition" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Implementers should not treat cardinality-related mismatches as errors and should not throw exceptions for cardinality-related mismatches. For example, if the import requests exactly one export and the provider has no matching exports or more than one, the <see cref="M:System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.GetExportsCore(System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition)" /> method should return an empty <see cref="T:System.Collections.Generic.IEnumerable`1" /> collection of <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a collection of all exports in this provider that match the conditions of the specified import.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A collection of all exports in this provider that match the specified conditions.</para> - </returns> - <param name="definition"> - <attribution license="cc4" from="Microsoft" modified="false" />The <see cref="T:System.ComponentModel.Composition.Primitives.ImportDefinition" /> that defines the conditions of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> to get.</param> - <param name="atomicComposition"> - <attribution license="cc4" from="Microsoft" modified="false" />The composition transaction to use, or null to disable transactional composition.</param> - </Docs> - </Member> - <Member MemberName="SourceProvider"> - <MemberSignature Language="C#" Value="public System.ComponentModel.Composition.Hosting.ExportProvider SourceProvider { get; set; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.ComponentModel.Composition.Hosting.ExportProvider SourceProvider" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Hosting.ExportProvider</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This property must be set before accessing any methods on the <see cref="T:System.ComponentModel.Composition.Hosting.ComposablePartExportProvider" />.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets or sets the export provider that provides access to additional <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/CompositionBatch.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/CompositionBatch.xml deleted file mode 100644 index fd793158c03..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/CompositionBatch.xml +++ /dev/null @@ -1,172 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="CompositionBatch" FullName="System.ComponentModel.Composition.Hosting.CompositionBatch"> - <TypeSignature Language="C#" Value="public class CompositionBatch" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit CompositionBatch extends System.Object" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Object</BaseTypeName> - </Base> - <Interfaces /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Represents a set of <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> objects which will be added or removed from the container in a single transactional composition.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CompositionBatch ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionBatch" /> class.</para> - </summary> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CompositionBatch (System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ComposablePart> partsToAdd, System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ComposablePart> partsToRemove);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.ComposablePart> partsToAdd, class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.ComposablePart> partsToRemove) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="partsToAdd" Type="System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ComposablePart>" /> - <Parameter Name="partsToRemove" Type="System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ComposablePart>" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionBatch" /> class with the specified parts for addition and removal.</para> - </summary> - <param name="partsToAdd"> - <attribution license="cc4" from="Microsoft" modified="false" />A collection of <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> objects to add.</param> - <param name="partsToRemove"> - <attribution license="cc4" from="Microsoft" modified="false" />A collection of <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> objects to remove.</param> - </Docs> - </Member> - <Member MemberName="AddExport"> - <MemberSignature Language="C#" Value="public System.ComponentModel.Composition.Primitives.ComposablePart AddExport (System.ComponentModel.Composition.Primitives.Export export);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.ComponentModel.Composition.Primitives.ComposablePart AddExport(class System.ComponentModel.Composition.Primitives.Export export) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ComposablePart</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="export" Type="System.ComponentModel.Composition.Primitives.Export" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Adds the specified export to the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionBatch" /> object.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The part added.</para> - </returns> - <param name="export"> - <attribution license="cc4" from="Microsoft" modified="false" />The export to add to the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionBatch" /> object.</param> - </Docs> - </Member> - <Member MemberName="AddPart"> - <MemberSignature Language="C#" Value="public void AddPart (System.ComponentModel.Composition.Primitives.ComposablePart part);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void AddPart(class System.ComponentModel.Composition.Primitives.ComposablePart part) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePart" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Adds the specified part to the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionBatch" /> object.</para> - </summary> - <param name="part"> - <attribution license="cc4" from="Microsoft" modified="false" />The part to add.</param> - </Docs> - </Member> - <Member MemberName="PartsToAdd"> - <MemberSignature Language="C#" Value="public System.Collections.ObjectModel.ReadOnlyCollection<System.ComponentModel.Composition.Primitives.ComposablePart> PartsToAdd { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.ObjectModel.ReadOnlyCollection`1<class System.ComponentModel.Composition.Primitives.ComposablePart> PartsToAdd" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.ObjectModel.ReadOnlyCollection<System.ComponentModel.Composition.Primitives.ComposablePart></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the collection of <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> objects to be added.</para> - </summary> - </Docs> - </Member> - <Member MemberName="PartsToRemove"> - <MemberSignature Language="C#" Value="public System.Collections.ObjectModel.ReadOnlyCollection<System.ComponentModel.Composition.Primitives.ComposablePart> PartsToRemove { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.ObjectModel.ReadOnlyCollection`1<class System.ComponentModel.Composition.Primitives.ComposablePart> PartsToRemove" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.ObjectModel.ReadOnlyCollection<System.ComponentModel.Composition.Primitives.ComposablePart></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the collection of <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> objects to be removed.</para> - </summary> - </Docs> - </Member> - <Member MemberName="RemovePart"> - <MemberSignature Language="C#" Value="public void RemovePart (System.ComponentModel.Composition.Primitives.ComposablePart part);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void RemovePart(class System.ComponentModel.Composition.Primitives.ComposablePart part) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePart" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Puts the specified part on the list of parts to remove.</para> - </summary> - <param name="part"> - <attribution license="cc4" from="Microsoft" modified="false" />The part to be removed.</param> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/CompositionConstants.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/CompositionConstants.xml deleted file mode 100644 index 6df3b0ecfcb..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/CompositionConstants.xml +++ /dev/null @@ -1,133 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="CompositionConstants" FullName="System.ComponentModel.Composition.Hosting.CompositionConstants"> - <TypeSignature Language="C#" Value="public static class CompositionConstants" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi abstract sealed beforefieldinit CompositionConstants extends System.Object" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Object</BaseTypeName> - </Base> - <Interfaces /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Do not create metadata by using any of the keys in this class, except to deliberately interact with the composition system. Other uses will cause unpredictable behavior.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Contains static metadata keys used by the composition system.</para> - </summary> - </Docs> - <Members> - <Member MemberName="ExportTypeIdentityMetadataName"> - <MemberSignature Language="C#" Value="public const string ExportTypeIdentityMetadataName;" /> - <MemberSignature Language="ILAsm" Value=".field public static literal string ExportTypeIdentityMetadataName" /> - <MemberType>Field</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Specifies the metadata key created by the composition system to mark a part with a unique identifier.</para> - </summary> - </Docs> - </Member> - <Member MemberName="GenericContractMetadataName"> - <MemberSignature Language="C#" Value="public const string GenericContractMetadataName;" /> - <MemberSignature Language="ILAsm" Value=".field public static literal string GenericContractMetadataName" /> - <MemberType>Field</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Specifies the metadata key created by the composition system to mark a generic contract.</para> - </summary> - </Docs> - </Member> - <Member MemberName="GenericParametersMetadataName"> - <MemberSignature Language="C#" Value="public const string GenericParametersMetadataName;" /> - <MemberSignature Language="ILAsm" Value=".field public static literal string GenericParametersMetadataName" /> - <MemberType>Field</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Specifies the metadata key created by the composition system to mark generic parameters.</para> - </summary> - </Docs> - </Member> - <Member MemberName="ImportSourceMetadataName"> - <MemberSignature Language="C#" Value="public const string ImportSourceMetadataName;" /> - <MemberSignature Language="ILAsm" Value=".field public static literal string ImportSourceMetadataName" /> - <MemberType>Field</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Specifies the metadata key created by the composition system to mark an import source.</para> - </summary> - </Docs> - </Member> - <Member MemberName="IsGenericPartMetadataName"> - <MemberSignature Language="C#" Value="public const string IsGenericPartMetadataName;" /> - <MemberSignature Language="ILAsm" Value=".field public static literal string IsGenericPartMetadataName" /> - <MemberType>Field</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Specifies the metadata key created by the composition system to mark an IsGenericPart method.</para> - </summary> - </Docs> - </Member> - <Member MemberName="PartCreationPolicyMetadataName"> - <MemberSignature Language="C#" Value="public const string PartCreationPolicyMetadataName;" /> - <MemberSignature Language="ILAsm" Value=".field public static literal string PartCreationPolicyMetadataName" /> - <MemberType>Field</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Specifies the metadata key created by the composition system to mark a part with a creation policy.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/CompositionContainer.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/CompositionContainer.xml deleted file mode 100644 index b1879b7965e..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/CompositionContainer.xml +++ /dev/null @@ -1,512 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="CompositionContainer" FullName="System.ComponentModel.Composition.Hosting.CompositionContainer"> - <TypeSignature Language="C#" Value="public class CompositionContainer : System.ComponentModel.Composition.Hosting.ExportProvider, IDisposable, System.ComponentModel.Composition.ICompositionService" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit CompositionContainer extends System.ComponentModel.Composition.Hosting.ExportProvider implements class System.ComponentModel.Composition.ICompositionService, class System.IDisposable" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.ComponentModel.Composition.Hosting.ExportProvider</BaseTypeName> - </Base> - <Interfaces> - <Interface> - <InterfaceName>System.ComponentModel.Composition.ICompositionService</InterfaceName> - </Interface> - <Interface> - <InterfaceName>System.IDisposable</InterfaceName> - </Interface> - </Interfaces> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> object serves two major purposes in an application. First, it keeps track of which parts are available for composition and what their dependencies are, and performs composition whenever the set of available parts changes. Second, it provides the methods by which the application gets instances of composed parts or fills the dependencies of a composable part.</para> - <para>Parts can be made available to the container either directly or through the <see cref="P:System.ComponentModel.Composition.Hosting.CompositionContainer.Catalog" /> property. All the parts discoverable in this <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> are available to the container to fulfill imports, along with any parts added directly.</para> - <para>The <see cref="M:System.ComponentModel.Composition.Hosting.CompositionContainer.Compose(System.ComponentModel.Composition.Hosting.CompositionBatch)" /> method allows instantiated parts to be added to an existing container. Assuming composition is successful, these parts will have their imports filled with parts retrieved from the container, and their exports will be available to other parts. Imports marked as recomposable will be registered for recomposition.</para> - <para>The <see cref="M:System.ComponentModel.Composition.Hosting.CompositionContainer.SatisfyImportsOnce(System.ComponentModel.Composition.Primitives.ComposablePart)" /> method allows a part to have its imports filled without being added to the container. If the composition is successful, the part's imports will be filled, but the part's exports will not be available to other parts and no imports will be registered for recomposition.</para> - <para> - <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> objects should always be disposed. When the <see cref="M:System.ComponentModel.Composition.Hosting.CompositionContainer.Dispose" /> method is called, the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> object also disposes all the parts that it has created.</para> - <para>A <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> object that can be accessed from multiple threads must be constructed with the <paramref name="isThreadSafe" /> parameter set to true, using the <see cref="M:System.ComponentModel.Composition.Hosting.CompositionContainer.#ctor(System.ComponentModel.Composition.Primitives.ComposablePartCatalog,System.Boolean,System.ComponentModel.Composition.Hosting.ExportProvider[])" /> constructor. Performance will be slightly slower when <paramref name="isThreadSafe" /> is true, so we recommend that you set this parameter to false in single-threaded scenarios. The default is false.</para> - <block subset="none" type="note"> - <para>A <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> should never import itself, or a part that has a reference to it. Such a reference could allow an untrusted part to gain access all the parts in the container.</para> - </block> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Manages the composition of parts.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CompositionContainer ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> class.</para> - </summary> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CompositionContainer (System.ComponentModel.Composition.Hosting.ExportProvider[] providers);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.ComponentModel.Composition.Hosting.ExportProvider[] providers) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="providers" Type="System.ComponentModel.Composition.Hosting.ExportProvider[]"> - <Attributes> - <Attribute> - <AttributeName>System.ParamArray</AttributeName> - </Attribute> - </Attributes> - </Parameter> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> class with the specified export providers.</para> - </summary> - <param name="providers"> - <attribution license="cc4" from="Microsoft" modified="false" />An array of <see cref="T:System.ComponentModel.Composition.Hosting.ExportProvider" /> objects that provide the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> access to <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects, or null to set <see cref="P:System.ComponentModel.Composition.Hosting.CompositionContainer.Providers" /> to an empty <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" />.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CompositionContainer (System.ComponentModel.Composition.Hosting.CompositionOptions compositionOptions, System.ComponentModel.Composition.Hosting.ExportProvider[] providers);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(valuetype System.ComponentModel.Composition.Hosting.CompositionOptions compositionOptions, class System.ComponentModel.Composition.Hosting.ExportProvider[] providers) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="compositionOptions" Type="System.ComponentModel.Composition.Hosting.CompositionOptions" /> - <Parameter Name="providers" Type="System.ComponentModel.Composition.Hosting.ExportProvider[]"> - <Attributes> - <Attribute> - <AttributeName>System.ParamArray</AttributeName> - </Attribute> - </Attributes> - </Parameter> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> class with the specified export providers and options.</para> - </summary> - <param name="compositionOptions"> - <attribution license="cc4" from="Microsoft" modified="false" />An object that specifies the behavior of this container.</param> - <param name="providers"> - <attribution license="cc4" from="Microsoft" modified="false" />An array of <see cref="T:System.ComponentModel.Composition.Hosting.ExportProvider" /> objects that provide the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> access to <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects, or null to set <see cref="P:System.ComponentModel.Composition.Hosting.CompositionContainer.Providers" /> to an empty <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" />.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CompositionContainer (System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, System.ComponentModel.Composition.Hosting.ExportProvider[] providers);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, class System.ComponentModel.Composition.Hosting.ExportProvider[] providers) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="catalog" Type="System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> - <Parameter Name="providers" Type="System.ComponentModel.Composition.Hosting.ExportProvider[]"> - <Attributes> - <Attribute> - <AttributeName>System.ParamArray</AttributeName> - </Attribute> - </Attributes> - </Parameter> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> class with the specified catalog and export providers.</para> - </summary> - <param name="catalog"> - <attribution license="cc4" from="Microsoft" modified="false" />A catalog that provides <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects to the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" />.</param> - <param name="providers"> - <attribution license="cc4" from="Microsoft" modified="false" />An array of <see cref="T:System.ComponentModel.Composition.Hosting.ExportProvider" /> objects that provide the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> access to <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects, or null to set <see cref="P:System.ComponentModel.Composition.Hosting.CompositionContainer.Providers" /> to an empty <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" />.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CompositionContainer (System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, bool isThreadSafe, System.ComponentModel.Composition.Hosting.ExportProvider[] providers);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, bool isThreadSafe, class System.ComponentModel.Composition.Hosting.ExportProvider[] providers) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="catalog" Type="System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> - <Parameter Name="isThreadSafe" Type="System.Boolean" /> - <Parameter Name="providers" Type="System.ComponentModel.Composition.Hosting.ExportProvider[]"> - <Attributes> - <Attribute> - <AttributeName>System.ParamArray</AttributeName> - </Attribute> - </Attributes> - </Parameter> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> object that can be accessed from multiple threads must set the <paramref name="isThreadSafe" /> parameter to true. Performance will be slightly slower when <paramref name="isThreadSafe" /> is true, so we recommend that you set this parameter to false in single-threaded scenarios. The default is false.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> class with the specified catalog, thread-safe mode, and export providers. </para> - </summary> - <param name="catalog"> - <attribution license="cc4" from="Microsoft" modified="false" />A catalog that provides <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects to the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" />.</param> - <param name="isThreadSafe"> - <attribution license="cc4" from="Microsoft" modified="false" />true if this <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> object must be thread-safe; otherwise, false.</param> - <param name="providers"> - <attribution license="cc4" from="Microsoft" modified="false" />An array of <see cref="T:System.ComponentModel.Composition.Hosting.ExportProvider" /> objects that provide the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> access to <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects, or null to set the <see cref="P:System.ComponentModel.Composition.Hosting.CompositionContainer.Providers" /> property to an empty <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" />.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CompositionContainer (System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, System.ComponentModel.Composition.Hosting.CompositionOptions compositionOptions, System.ComponentModel.Composition.Hosting.ExportProvider[] providers);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, valuetype System.ComponentModel.Composition.Hosting.CompositionOptions compositionOptions, class System.ComponentModel.Composition.Hosting.ExportProvider[] providers) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="catalog" Type="System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> - <Parameter Name="compositionOptions" Type="System.ComponentModel.Composition.Hosting.CompositionOptions" /> - <Parameter Name="providers" Type="System.ComponentModel.Composition.Hosting.ExportProvider[]"> - <Attributes> - <Attribute> - <AttributeName>System.ParamArray</AttributeName> - </Attribute> - </Attributes> - </Parameter> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> class with the specified catalog, options, and export providers.</para> - </summary> - <param name="catalog"> - <attribution license="cc4" from="Microsoft" modified="false" />A catalog that provides <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects to the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" />.</param> - <param name="compositionOptions"> - <attribution license="cc4" from="Microsoft" modified="false" />An object that specifies options that affect the behavior of the container.</param> - <param name="providers"> - <attribution license="cc4" from="Microsoft" modified="false" />An array of <see cref="T:System.ComponentModel.Composition.Hosting.ExportProvider" /> objects that provide the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> access to <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects, or null to set <see cref="P:System.ComponentModel.Composition.Hosting.CompositionContainer.Providers" /> to an empty <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" />.</param> - </Docs> - </Member> - <Member MemberName="Catalog"> - <MemberSignature Language="C#" Value="public System.ComponentModel.Composition.Primitives.ComposablePartCatalog Catalog { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.ComponentModel.Composition.Primitives.ComposablePartCatalog Catalog" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ComposablePartCatalog</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> that provides the container access to <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Compose"> - <MemberSignature Language="C#" Value="public void Compose (System.ComponentModel.Composition.Hosting.CompositionBatch batch);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Compose(class System.ComponentModel.Composition.Hosting.CompositionBatch batch) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="batch" Type="System.ComponentModel.Composition.Hosting.CompositionBatch" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This method is the primary way of directly adding or removing parts from the container. The <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> will always maintain a stable, composed state. Therefore, calling <see cref="M:System.ComponentModel.Composition.Hosting.CompositionContainer.Compose(System.ComponentModel.Composition.Hosting.CompositionBatch)" /> with an empty <see cref="T:System.ComponentModel.Composition.Hosting.CompositionBatch" /> is never necessary to start composition. Instead, call the <see cref="M:System.ComponentModel.Composition.Hosting.CompositionContainer.Compose(System.ComponentModel.Composition.Hosting.CompositionBatch)" /> method whenever you need to make changes to the parts available to the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" />.</para> - <para>The <see cref="T:System.ComponentModel.Composition.Hosting.CompositionBatch" /> can contain both parts to be added and parts to be removed. Recomposition will take place only once for each call to <see cref="M:System.ComponentModel.Composition.Hosting.CompositionContainer.Compose(System.ComponentModel.Composition.Hosting.CompositionBatch)" />.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Adds or removes the parts in the specified <see cref="T:System.ComponentModel.Composition.Hosting.CompositionBatch" /> from the container and executes composition.</para> - </summary> - <param name="batch"> - <attribution license="cc4" from="Microsoft" modified="false" />Changes to the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> to include during the composition.</param> - </Docs> - </Member> - <Member MemberName="Dispose"> - <MemberSignature Language="C#" Value="public void Dispose ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Dispose() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Call Dispose when you are finished using the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" />. The Dispose method leaves the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> in an unusable state. After calling Dispose, you must release all references to the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> so the garbage collector can reclaim the memory that the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> was occupying.</para> - <para>For more information, see <format type="text/html"><a href="A17B0066-71C2-4BA4-9822-8E19332FC213">Cleaning Up Unmanaged Resources</a></format> and <format type="text/html"><a href="eb4e1af0-3b48-4fbc-ad4e-fc2f64138bf9">Implementing a Dispose Method</a></format>.</para> - <block subset="none" type="note"> - <para>Always call Dispose before you release your last reference to the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" />. Otherwise, the resources it is using will not be freed until the garbage collector calls the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> object's Finalize method.</para> - </block> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Releases all resources used by the current instance of the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> class.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Dispose"> - <MemberSignature Language="C#" Value="protected virtual void Dispose (bool disposing);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void Dispose(bool disposing) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="disposing" Type="System.Boolean" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Releases the unmanaged resources used by the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> and optionally releases the managed resources. </para> - </summary> - <param name="disposing"> - <attribution license="cc4" from="Microsoft" modified="false" />true to release both managed and unmanaged resources; false to release only unmanaged resources. </param> - </Docs> - </Member> - <Member MemberName="GetExportsCore"> - <MemberSignature Language="C#" Value="protected override System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.Export> GetExportsCore (System.ComponentModel.Composition.Primitives.ImportDefinition definition, System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.Export> GetExportsCore(class System.ComponentModel.Composition.Primitives.ImportDefinition definition, class System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.Export></ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="definition" Type="System.ComponentModel.Composition.Primitives.ImportDefinition" /> - <Parameter Name="atomicComposition" Type="System.ComponentModel.Composition.Hosting.AtomicComposition" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Implementations should not treat cardinality-related mismatches as errors and should not throw exceptions for cardinality-related mismatches. For example, if the import requests exactly one export and the provider has either no matching exports or more than one, the <see cref="M:System.ComponentModel.Composition.Hosting.CompositionContainer.GetExportsCore(System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition)" /> method should return an empty <see cref="T:System.Collections.Generic.IEnumerable`1" /> collection of <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns a collection of all exports that match the conditions in the specified <see cref="T:System.ComponentModel.Composition.Primitives.ImportDefinition" /> object.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A collection of all the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects in this <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> object that match the conditions specified by <paramref name="definition" />.</para> - </returns> - <param name="definition"> - <attribution license="cc4" from="Microsoft" modified="false" />The object that defines the conditions of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects to get.</param> - <param name="atomicComposition"> - <attribution license="cc4" from="Microsoft" modified="false" />The composition transaction to use, or null to disable transactional composition.</param> - </Docs> - </Member> - <Member MemberName="Providers"> - <MemberSignature Language="C#" Value="public System.Collections.ObjectModel.ReadOnlyCollection<System.ComponentModel.Composition.Hosting.ExportProvider> Providers { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.ObjectModel.ReadOnlyCollection`1<class System.ComponentModel.Composition.Hosting.ExportProvider> Providers" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.ObjectModel.ReadOnlyCollection<System.ComponentModel.Composition.Hosting.ExportProvider></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the export providers that provide the container access to additional <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> objects.</para> - </summary> - </Docs> - </Member> - <Member MemberName="ReleaseExport"> - <MemberSignature Language="C#" Value="public void ReleaseExport (System.ComponentModel.Composition.Primitives.Export export);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void ReleaseExport(class System.ComponentModel.Composition.Primitives.Export export) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="export" Type="System.ComponentModel.Composition.Primitives.Export" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The behavior of this method may vary depending on the implementation of the <see cref="T:System.ComponentModel.Composition.Hosting.ExportProvider" /> that produced the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> instance. As a rule, non-shared exports should be detached from the container.</para> - <para>For example, the <see cref="T:System.ComponentModel.Composition.Hosting.CatalogExportProvider" /> will only release an <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> if it comes from a <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> that was constructed under a <see cref="F:System.ComponentModel.Composition.CreationPolicy.NonShared" /> context. Release in this context means walking the dependency chain of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects, detaching references from the container and calling Dispose on the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> objects as needed. If the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> was constructed under a <see cref="F:System.ComponentModel.Composition.CreationPolicy.Shared" /> context the <see cref="T:System.ComponentModel.Composition.Hosting.CatalogExportProvider" /> will do nothing, as the specified <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> may being used by other requestors. Those will only be detached when the container is itself disposed.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Releases the specified <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> object from the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" />. </para> - </summary> - <param name="export"> - <attribution license="cc4" from="Microsoft" modified="false" />The <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> that needs to be released.</param> - </Docs> - </Member> - <Member MemberName="ReleaseExport<T>"> - <MemberSignature Language="C#" Value="public void ReleaseExport<T> (Lazy<T> export);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void ReleaseExport<T>(class System.Lazy`1<!!T> export) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="export" Type="System.Lazy<T>" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Removes the specified export from composition and releases its resources if possible.</para> - </summary> - <param name="export"> - <attribution license="cc4" from="Microsoft" modified="false" />An indirect reference to the export to remove.</param> - <typeparam name="T"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the export.</typeparam> - </Docs> - </Member> - <Member MemberName="ReleaseExports"> - <MemberSignature Language="C#" Value="public void ReleaseExports (System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.Export> exports);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void ReleaseExports(class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.Export> exports) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="exports" Type="System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.Export>" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The behavior of this method may vary depending on the context in which the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> was constructed. For more information, see the <see cref="M:System.ComponentModel.Composition.Hosting.CompositionContainer.ReleaseExport(System.ComponentModel.Composition.Primitives.Export)" /> method.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Releases a set of <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects from the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" />. </para> - </summary> - <param name="exports"> - <attribution license="cc4" from="Microsoft" modified="false" />A collection of <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects to be released.</param> - </Docs> - </Member> - <Member MemberName="ReleaseExports<T>"> - <MemberSignature Language="C#" Value="public void ReleaseExports<T> (System.Collections.Generic.IEnumerable<Lazy<T>> exports);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void ReleaseExports<T>(class System.Collections.Generic.IEnumerable`1<class System.Lazy`1<!!T>> exports) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="exports" Type="System.Collections.Generic.IEnumerable<System.Lazy<T>>" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Removes a collection of exports from composition and releases their resources if possible.</para> - </summary> - <param name="exports"> - <attribution license="cc4" from="Microsoft" modified="false" />A collection of indirect references to the exports to be removed.</param> - <typeparam name="T"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the exports.</typeparam> - </Docs> - </Member> - <Member MemberName="ReleaseExports<T,TMetadataView>"> - <MemberSignature Language="C#" Value="public void ReleaseExports<T,TMetadataView> (System.Collections.Generic.IEnumerable<Lazy<T,TMetadataView>> exports);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void ReleaseExports<T, TMetadataView>(class System.Collections.Generic.IEnumerable`1<class System.Lazy`2<!!T, !!TMetadataView>> exports) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - <TypeParameter Name="TMetadataView" /> - </TypeParameters> - <Parameters> - <Parameter Name="exports" Type="System.Collections.Generic.IEnumerable<System.Lazy<T,TMetadataView>>" /> - </Parameters> - <Docs> - <typeparam name="T">To be added.</typeparam> - <typeparam name="TMetadataView">To be added.</typeparam> - <param name="exports">To be added.</param> - <summary>To be added.</summary> - <remarks>To be added.</remarks> - </Docs> - </Member> - <Member MemberName="SatisfyImportsOnce"> - <MemberSignature Language="C#" Value="public void SatisfyImportsOnce (System.ComponentModel.Composition.Primitives.ComposablePart part);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void SatisfyImportsOnce(class System.ComponentModel.Composition.Primitives.ComposablePart part) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePart" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Satisfies the imports of the specified <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> object without registering it for recomposition.</para> - </summary> - <param name="part"> - <attribution license="cc4" from="Microsoft" modified="false" />The part to satisfy the imports of.</param> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/CompositionOptions.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/CompositionOptions.xml deleted file mode 100644 index 21b808a7e74..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/CompositionOptions.xml +++ /dev/null @@ -1,94 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="CompositionOptions" FullName="System.ComponentModel.Composition.Hosting.CompositionOptions"> - <TypeSignature Language="C#" Value="public enum CompositionOptions" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed CompositionOptions extends System.Enum" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Enum</BaseTypeName> - </Base> - <Attributes> - <Attribute> - <AttributeName>System.Flags</AttributeName> - </Attribute> - </Attributes> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Defines options for export providers.</para> - </summary> - </Docs> - <Members> - <Member MemberName="Default"> - <MemberSignature Language="C#" Value="Default" /> - <MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.ComponentModel.Composition.Hosting.CompositionOptions Default = int32(0)" /> - <MemberType>Field</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Hosting.CompositionOptions</ReturnType> - </ReturnValue> - <Docs> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>No options are defined.</para> - </summary> - </Docs> - </Member> - <Member MemberName="DisableSilentRejection"> - <MemberSignature Language="C#" Value="DisableSilentRejection" /> - <MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.ComponentModel.Composition.Hosting.CompositionOptions DisableSilentRejection = int32(1)" /> - <MemberType>Field</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Hosting.CompositionOptions</ReturnType> - </ReturnValue> - <Docs> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Silent rejection is disabled, so all rejections will result in errors.</para> - </summary> - </Docs> - </Member> - <Member MemberName="ExportCompositionService"> - <MemberSignature Language="C#" Value="ExportCompositionService" /> - <MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.ComponentModel.Composition.Hosting.CompositionOptions ExportCompositionService = int32(4)" /> - <MemberType>Field</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Hosting.CompositionOptions</ReturnType> - </ReturnValue> - <Docs> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This provider is an export composition service.</para> - </summary> - </Docs> - </Member> - <Member MemberName="IsThreadSafe"> - <MemberSignature Language="C#" Value="IsThreadSafe" /> - <MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.ComponentModel.Composition.Hosting.CompositionOptions IsThreadSafe = int32(2)" /> - <MemberType>Field</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Hosting.CompositionOptions</ReturnType> - </ReturnValue> - <Docs> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This provider should be thread-safe.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/CompositionScopeDefinition.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/CompositionScopeDefinition.xml deleted file mode 100644 index dffd288b862..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/CompositionScopeDefinition.xml +++ /dev/null @@ -1,301 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="CompositionScopeDefinition" FullName="System.ComponentModel.Composition.Hosting.CompositionScopeDefinition"> - <TypeSignature Language="C#" Value="public class CompositionScopeDefinition : System.ComponentModel.Composition.Primitives.ComposablePartCatalog, System.ComponentModel.Composition.Hosting.INotifyComposablePartCatalogChanged" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit CompositionScopeDefinition extends System.ComponentModel.Composition.Primitives.ComposablePartCatalog implements class System.ComponentModel.Composition.Hosting.INotifyComposablePartCatalogChanged" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.ComponentModel.Composition.Primitives.ComposablePartCatalog</BaseTypeName> - </Base> - <Interfaces> - <Interface> - <InterfaceName>System.ComponentModel.Composition.Hosting.INotifyComposablePartCatalogChanged</InterfaceName> - </Interface> - </Interfaces> - <Attributes> - <Attribute> - <AttributeName>System.Diagnostics.DebuggerTypeProxy(typeof(System.ComponentModel.Composition.Hosting.CompositionScopeDefinitionDebuggerProxy))</AttributeName> - </Attribute> - </Attributes> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Represents a node in a tree of scoped catalogs, reflecting an underlying catalog and its child scopes.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="protected CompositionScopeDefinition ();" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionScopeDefinition" /> class.</para> - </summary> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CompositionScopeDefinition (System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Hosting.CompositionScopeDefinition> children);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Hosting.CompositionScopeDefinition> children) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="catalog" Type="System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> - <Parameter Name="children" Type="System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Hosting.CompositionScopeDefinition>" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionScopeDefinition" /> class with the specified underlying catalog and children.</para> - </summary> - <param name="catalog"> - <attribution license="cc4" from="Microsoft" modified="false" />The underlying catalog for this catalog.</param> - <param name="children"> - <attribution license="cc4" from="Microsoft" modified="false" />A collection of the child scopes of this catalog.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CompositionScopeDefinition (System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Hosting.CompositionScopeDefinition> children, System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ExportDefinition> publicSurface);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Hosting.CompositionScopeDefinition> children, class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.ExportDefinition> publicSurface) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="catalog" Type="System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> - <Parameter Name="children" Type="System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Hosting.CompositionScopeDefinition>" /> - <Parameter Name="publicSurface" Type="System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ExportDefinition>" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionScopeDefinition" /> class with the specified underlying catalog, children, and public surface.</para> - </summary> - <param name="catalog"> - <attribution license="cc4" from="Microsoft" modified="false" />The underlying catalog for this catalog.</param> - <param name="children"> - <attribution license="cc4" from="Microsoft" modified="false" />A collection of the child scopes of this catalog.</param> - <param name="publicSurface"> - <attribution license="cc4" from="Microsoft" modified="false" />The public surface for this catalog.</param> - </Docs> - </Member> - <Member MemberName="Changed"> - <MemberSignature Language="C#" Value="public event EventHandler<System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs> Changed;" /> - <MemberSignature Language="ILAsm" Value=".event class System.EventHandler`1<class System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs> Changed" /> - <MemberType>Event</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.EventHandler<System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs></ReturnType> - </ReturnValue> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Occurs when the underlying catalog has changed, if that catalog supports notifications.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Changing"> - <MemberSignature Language="C#" Value="public event EventHandler<System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs> Changing;" /> - <MemberSignature Language="ILAsm" Value=".event class System.EventHandler`1<class System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs> Changing" /> - <MemberType>Event</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.EventHandler<System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs></ReturnType> - </ReturnValue> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Occurs when the underlying catalog is changing, if that catalog supports notifications.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Children"> - <MemberSignature Language="C#" Value="public virtual System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Hosting.CompositionScopeDefinition> Children { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Hosting.CompositionScopeDefinition> Children" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Hosting.CompositionScopeDefinition></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the child scopes of this catalog.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Dispose"> - <MemberSignature Language="C#" Value="protected override void Dispose (bool disposing);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void Dispose(bool disposing) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="disposing" Type="System.Boolean" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This method is called only by the public Dispose() and Finalize() methods; do not call this method directly.When you implement the dispose pattern, the Boolean parameter of the Dispose(Boolean) method should be used as follows:</para> - <list type="bullet"> - <item> - <para>The Dispose() method of the current object should call Dispose(Boolean) with the Boolean parameter set to true to release both managed and unmanaged resources.</para> - </item> - <item> - <para>The Finalize() method of the current object should call Dispose(Boolean) with the Boolean parameter set to false to release only unmanaged resources.</para> - </item> - </list> - <para>For more information, see <format type="text/html"><a href="eb4e1af0-3b48-4fbc-ad4e-fc2f64138bf9">Implementing a Dispose Method</a></format>.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Called by the Dispose() and Finalize() methods to release the managed and unmanaged resources used by the current instance of the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionScopeDefinition" /> class.</para> - </summary> - <param name="disposing"> - <attribution license="cc4" from="Microsoft" modified="false" />true to release managed and unmanaged resources; false to release only unmanaged resources.</param> - </Docs> - </Member> - <Member MemberName="GetEnumerator"> - <MemberSignature Language="C#" Value="public override System.Collections.Generic.IEnumerator<System.ComponentModel.Composition.Primitives.ComposablePartDefinition> GetEnumerator ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance class System.Collections.Generic.IEnumerator`1<class System.ComponentModel.Composition.Primitives.ComposablePartDefinition> GetEnumerator() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerator<System.ComponentModel.Composition.Primitives.ComposablePartDefinition></ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns an enumerator that iterates through the catalog.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>An enumerator that can be used to iterate through the catalog.</para> - </returns> - </Docs> - </Member> - <Member MemberName="GetExports"> - <MemberSignature Language="C#" Value="public override System.Collections.Generic.IEnumerable<Tuple<System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.ComponentModel.Composition.Primitives.ExportDefinition>> GetExports (System.ComponentModel.Composition.Primitives.ImportDefinition definition);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance class System.Collections.Generic.IEnumerable`1<class System.Tuple`2<class System.ComponentModel.Composition.Primitives.ComposablePartDefinition, class System.ComponentModel.Composition.Primitives.ExportDefinition>> GetExports(class System.ComponentModel.Composition.Primitives.ImportDefinition definition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.Tuple<System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.ComponentModel.Composition.Primitives.ExportDefinition>></ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="definition" Type="System.ComponentModel.Composition.Primitives.ImportDefinition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a collection of exports that match the conditions specified by the import definition.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A collection of exports that match the specified conditions.</para> - </returns> - <param name="definition"> - <attribution license="cc4" from="Microsoft" modified="false" />Conditions that specify which exports to match.</param> - </Docs> - </Member> - <Member MemberName="OnChanged"> - <MemberSignature Language="C#" Value="protected virtual void OnChanged (System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs e);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void OnChanged(class System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs e) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="e" Type="System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Raises the <see cref="E:System.ComponentModel.Composition.Hosting.CompositionScopeDefinition.Changed" /> event.</para> - </summary> - <param name="e"> - <attribution license="cc4" from="Microsoft" modified="false" />Contains data for the <see cref="E:System.ComponentModel.Composition.Hosting.CompositionScopeDefinition.Changed" /> event.</param> - </Docs> - </Member> - <Member MemberName="OnChanging"> - <MemberSignature Language="C#" Value="protected virtual void OnChanging (System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs e);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void OnChanging(class System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs e) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="e" Type="System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Raises the <see cref="E:System.ComponentModel.Composition.Hosting.CompositionScopeDefinition.Changing" /> event.</para> - </summary> - <param name="e"> - <attribution license="cc4" from="Microsoft" modified="false" />Contains data for the <see cref="E:System.ComponentModel.Composition.Hosting.CompositionScopeDefinition.Changing" /> event.</param> - </Docs> - </Member> - <Member MemberName="PublicSurface"> - <MemberSignature Language="C#" Value="public virtual System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ExportDefinition> PublicSurface { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.ExportDefinition> PublicSurface" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ExportDefinition></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a collection of parts visible to the parent scope of this catalog.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/CompositionService.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/CompositionService.xml deleted file mode 100644 index a490bd433c7..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/CompositionService.xml +++ /dev/null @@ -1,78 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="CompositionService" FullName="System.ComponentModel.Composition.Hosting.CompositionService"> - <TypeSignature Language="C#" Value="public class CompositionService : IDisposable, System.ComponentModel.Composition.ICompositionService" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit CompositionService extends System.Object implements class System.ComponentModel.Composition.ICompositionService, class System.IDisposable" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Object</BaseTypeName> - </Base> - <Interfaces> - <Interface> - <InterfaceName>System.ComponentModel.Composition.ICompositionService</InterfaceName> - </Interface> - <Interface> - <InterfaceName>System.IDisposable</InterfaceName> - </Interface> - </Interfaces> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Provides methods to satisfy imports on an existing part instance.</para> - </summary> - </Docs> - <Members> - <Member MemberName="Dispose"> - <MemberSignature Language="C#" Value="public void Dispose ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Dispose() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Call Dispose when you are finished using the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" />. The Dispose method leaves the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> in an unusable state. After calling Dispose, you must release all references to the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> so the garbage collector can reclaim the memory that the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> was occupying.</para> - <para>For more information, see <format type="text/html"><a href="A17B0066-71C2-4BA4-9822-8E19332FC213">Cleaning Up Unmanaged Resources</a></format> and <format type="text/html"><a href="eb4e1af0-3b48-4fbc-ad4e-fc2f64138bf9">Implementing a Dispose Method</a></format>.</para> - <block subset="none" type="note"> - <para>Always call Dispose before you release your last reference to the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" />. Otherwise, the resources it is using will not be freed until the garbage collector calls the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> object's Finalize method.</para> - </block> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Releases all resources used by the current instance of the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> class.</para> - </summary> - </Docs> - </Member> - <Member MemberName="SatisfyImportsOnce"> - <MemberSignature Language="C#" Value="public void SatisfyImportsOnce (System.ComponentModel.Composition.Primitives.ComposablePart part);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void SatisfyImportsOnce(class System.ComponentModel.Composition.Primitives.ComposablePart part) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePart" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Composes the specified part, with recomposition and validation disabled.</para> - </summary> - <param name="part"> - <attribution license="cc4" from="Microsoft" modified="false" />The part to compose.</param> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/DirectoryCatalog.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/DirectoryCatalog.xml deleted file mode 100644 index 610a5c3e91d..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/DirectoryCatalog.xml +++ /dev/null @@ -1,556 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="DirectoryCatalog" FullName="System.ComponentModel.Composition.Hosting.DirectoryCatalog"> - <TypeSignature Language="C#" Value="public class DirectoryCatalog : System.ComponentModel.Composition.Primitives.ComposablePartCatalog, System.ComponentModel.Composition.Hosting.INotifyComposablePartCatalogChanged, System.ComponentModel.Composition.Primitives.ICompositionElement" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit DirectoryCatalog extends System.ComponentModel.Composition.Primitives.ComposablePartCatalog implements class System.ComponentModel.Composition.Hosting.INotifyComposablePartCatalogChanged, class System.ComponentModel.Composition.Primitives.ICompositionElement" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.ComponentModel.Composition.Primitives.ComposablePartCatalog</BaseTypeName> - </Base> - <Interfaces> - <Interface> - <InterfaceName>System.ComponentModel.Composition.Hosting.INotifyComposablePartCatalogChanged</InterfaceName> - </Interface> - <Interface> - <InterfaceName>System.ComponentModel.Composition.Primitives.ICompositionElement</InterfaceName> - </Interface> - </Interfaces> - <Attributes> - <Attribute> - <AttributeName>System.Diagnostics.DebuggerTypeProxy(typeof(System.ComponentModel.Composition.Hosting.DirectoryCatalog/DirectoryCatalogDebuggerProxy))</AttributeName> - </Attribute> - </Attributes> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>You can use a <see cref="T:System.ComponentModel.Composition.Hosting.DirectoryCatalog" /> object to parse the contents of a designated directory. Any attributed parts contained in dynamic link library (DLL) files are extracted and made available through the catalog.To restrict parsing to specific DLLs, you can specify a search pattern by using the same syntax as the <see cref="M:System.IO.Directory.GetFiles(System.String,System.String)" /> method.</para> - <block subset="none" type="note"> - <para>The designated directory should not allow access to non-administrators. For example, using a folder that contains temporary Internet files could create vulnerabilities in your application.</para> - </block> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Discovers attributed parts in the assemblies in a specified directory.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public DirectoryCatalog (string path);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string path) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="path" Type="System.String" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.DirectoryCatalog" /> class by using <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> objects based on all the DLL files in the specified directory path.</para> - </summary> - <param name="path"> - <attribution license="cc4" from="Microsoft" modified="false" />The path to the directory to scan for assemblies to add to the catalog.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public DirectoryCatalog (string path, System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string path, class System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="path" Type="System.String" /> - <Parameter Name="definitionOrigin" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.DirectoryCatalog" /> class by using <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> objects based on all the DLL files in the specified directory path with the specified source for parts.</para> - </summary> - <param name="path"> - <attribution license="cc4" from="Microsoft" modified="false" />The path to the directory to scan for assemblies to add to the catalog.</param> - <param name="definitionOrigin"> - <attribution license="cc4" from="Microsoft" modified="false" />The element used by diagnostics to identify the source for parts.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public DirectoryCatalog (string path, System.Reflection.ReflectionContext reflectionContext);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string path, class System.Reflection.ReflectionContext reflectionContext) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="path" Type="System.String" /> - <Parameter Name="reflectionContext" Type="System.Reflection.ReflectionContext" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.DirectoryCatalog" /> class by using <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> objects based on all the DLL files in the specified directory path, in the specified reflection context.</para> - </summary> - <param name="path"> - <attribution license="cc4" from="Microsoft" modified="false" />The path to the directory to scan for assemblies to add to the catalog.</param> - <param name="reflectionContext"> - <attribution license="cc4" from="Microsoft" modified="false" />The context used to create parts.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public DirectoryCatalog (string path, string searchPattern);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string path, string searchPattern) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="path" Type="System.String" /> - <Parameter Name="searchPattern" Type="System.String" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.DirectoryCatalog" /> class by using <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> objects that match a specified search pattern in the specified directory path.</para> - </summary> - <param name="path"> - <attribution license="cc4" from="Microsoft" modified="false" />The path to the directory to scan for assemblies to add to the catalog.</param> - <param name="searchPattern"> - <attribution license="cc4" from="Microsoft" modified="false" />The search string. The format of the string should be the same as specified for the <see cref="M:System.IO.Directory.GetFiles(System.String,System.String)" /> method.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public DirectoryCatalog (string path, System.Reflection.ReflectionContext reflectionContext, System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string path, class System.Reflection.ReflectionContext reflectionContext, class System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="path" Type="System.String" /> - <Parameter Name="reflectionContext" Type="System.Reflection.ReflectionContext" /> - <Parameter Name="definitionOrigin" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.DirectoryCatalog" /> class by using <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> objects based on all the DLL files in the specified directory path, in the specified reflection context.</para> - </summary> - <param name="path"> - <attribution license="cc4" from="Microsoft" modified="false" />The path to the directory to scan for assemblies to add to the catalog.</param> - <param name="reflectionContext"> - <attribution license="cc4" from="Microsoft" modified="false" />The context used to create parts.</param> - <param name="definitionOrigin"> - <attribution license="cc4" from="Microsoft" modified="false" />The element used by diagnostics to identify the source for parts.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public DirectoryCatalog (string path, string searchPattern, System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string path, string searchPattern, class System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="path" Type="System.String" /> - <Parameter Name="searchPattern" Type="System.String" /> - <Parameter Name="definitionOrigin" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.DirectoryCatalog" /> class by using <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> objects based on the specified search pattern in the specified directory path with the specified source for parts.</para> - </summary> - <param name="path"> - <attribution license="cc4" from="Microsoft" modified="false" />The path to the directory to scan for assemblies to add to the catalog.</param> - <param name="searchPattern"> - <attribution license="cc4" from="Microsoft" modified="false" />The search string. The format of the string should be the same as specified for the <see cref="M:System.IO.Directory.GetFiles(System.String,System.String)" /> method.</param> - <param name="definitionOrigin"> - <attribution license="cc4" from="Microsoft" modified="false" />The element used by diagnostics to identify the source for parts.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public DirectoryCatalog (string path, string searchPattern, System.Reflection.ReflectionContext reflectionContext);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string path, string searchPattern, class System.Reflection.ReflectionContext reflectionContext) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="path" Type="System.String" /> - <Parameter Name="searchPattern" Type="System.String" /> - <Parameter Name="reflectionContext" Type="System.Reflection.ReflectionContext" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.DirectoryCatalog" /> class by using <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> objects based on the specified search pattern in the specified directory path, using the specified reflection context.</para> - </summary> - <param name="path"> - <attribution license="cc4" from="Microsoft" modified="false" />The path to the directory to scan for assemblies to add to the catalog.</param> - <param name="searchPattern"> - <attribution license="cc4" from="Microsoft" modified="false" />The search string. The format of the string should be the same as specified for the <see cref="M:System.IO.Directory.GetFiles(System.String,System.String)" /> method.</param> - <param name="reflectionContext"> - <attribution license="cc4" from="Microsoft" modified="false" />The context used to create parts.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public DirectoryCatalog (string path, string searchPattern, System.Reflection.ReflectionContext reflectionContext, System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string path, string searchPattern, class System.Reflection.ReflectionContext reflectionContext, class System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="path" Type="System.String" /> - <Parameter Name="searchPattern" Type="System.String" /> - <Parameter Name="reflectionContext" Type="System.Reflection.ReflectionContext" /> - <Parameter Name="definitionOrigin" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.DirectoryCatalog" /> class by using <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> objects based on the specified search pattern in the specified directory path, using the specified reflection context.</para> - </summary> - <param name="path"> - <attribution license="cc4" from="Microsoft" modified="false" />The path to the directory to scan for assemblies to add to the catalog.</param> - <param name="searchPattern"> - <attribution license="cc4" from="Microsoft" modified="false" />The search string. The format of the string should be the same as specified for the <see cref="M:System.IO.Directory.GetFiles(System.String,System.String)" /> method.</param> - <param name="reflectionContext"> - <attribution license="cc4" from="Microsoft" modified="false" />The context used to create parts.</param> - <param name="definitionOrigin"> - <attribution license="cc4" from="Microsoft" modified="false" />The element used by diagnostics to identify the source for parts.</param> - </Docs> - </Member> - <Member MemberName="Changed"> - <MemberSignature Language="C#" Value="public event EventHandler<System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs> Changed;" /> - <MemberSignature Language="ILAsm" Value=".event class System.EventHandler`1<class System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs> Changed" /> - <MemberType>Event</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.EventHandler<System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs></ReturnType> - </ReturnValue> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Occurs when the contents of the catalog has changed.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Changing"> - <MemberSignature Language="C#" Value="public event EventHandler<System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs> Changing;" /> - <MemberSignature Language="ILAsm" Value=".event class System.EventHandler`1<class System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs> Changing" /> - <MemberType>Event</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.EventHandler<System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs></ReturnType> - </ReturnValue> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Occurs when the catalog is changing.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Dispose"> - <MemberSignature Language="C#" Value="protected override void Dispose (bool disposing);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void Dispose(bool disposing) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="disposing" Type="System.Boolean" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Releases the unmanaged resources used by the <see cref="T:System.ComponentModel.Composition.Hosting.DirectoryCatalog" /> and optionally releases the managed resources. </para> - </summary> - <param name="disposing"> - <attribution license="cc4" from="Microsoft" modified="false" />true to release both managed and unmanaged resources; false to release only unmanaged resources. </param> - </Docs> - </Member> - <Member MemberName="FullPath"> - <MemberSignature Language="C#" Value="public string FullPath { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance string FullPath" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the translated absolute path observed by the <see cref="T:System.ComponentModel.Composition.Hosting.DirectoryCatalog" /> object.</para> - </summary> - </Docs> - </Member> - <Member MemberName="GetEnumerator"> - <MemberSignature Language="C#" Value="public override System.Collections.Generic.IEnumerator<System.ComponentModel.Composition.Primitives.ComposablePartDefinition> GetEnumerator ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance class System.Collections.Generic.IEnumerator`1<class System.ComponentModel.Composition.Primitives.ComposablePartDefinition> GetEnumerator() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerator<System.ComponentModel.Composition.Primitives.ComposablePartDefinition></ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns an enumerator that iterates through the catalog.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>An enumerator that can be used to iterate through the catalog.</para> - </returns> - </Docs> - </Member> - <Member MemberName="GetExports"> - <MemberSignature Language="C#" Value="public override System.Collections.Generic.IEnumerable<Tuple<System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.ComponentModel.Composition.Primitives.ExportDefinition>> GetExports (System.ComponentModel.Composition.Primitives.ImportDefinition definition);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance class System.Collections.Generic.IEnumerable`1<class System.Tuple`2<class System.ComponentModel.Composition.Primitives.ComposablePartDefinition, class System.ComponentModel.Composition.Primitives.ExportDefinition>> GetExports(class System.ComponentModel.Composition.Primitives.ImportDefinition definition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.Tuple<System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.ComponentModel.Composition.Primitives.ExportDefinition>></ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="definition" Type="System.ComponentModel.Composition.Primitives.ImportDefinition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the export definitions that match the constraint expressed by the specified import definition.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A collection of objects that contain the <see cref="T:System.ComponentModel.Composition.Primitives.ExportDefinition" /> objects and their associated <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> objects that match the constraint specified by <paramref name="definition" />.</para> - </returns> - <param name="definition"> - <attribution license="cc4" from="Microsoft" modified="false" />The conditions of the <see cref="T:System.ComponentModel.Composition.Primitives.ExportDefinition" /> objects to be returned.</param> - </Docs> - </Member> - <Member MemberName="LoadedFiles"> - <MemberSignature Language="C#" Value="public System.Collections.ObjectModel.ReadOnlyCollection<string> LoadedFiles { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.ObjectModel.ReadOnlyCollection`1<string> LoadedFiles" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.ObjectModel.ReadOnlyCollection<System.String></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the collection of files currently loaded in the catalog.</para> - </summary> - </Docs> - </Member> - <Member MemberName="OnChanged"> - <MemberSignature Language="C#" Value="protected virtual void OnChanged (System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs e);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void OnChanged(class System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs e) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="e" Type="System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Raises the <see cref="E:System.ComponentModel.Composition.Hosting.DirectoryCatalog.Changed" /> event.</para> - </summary> - <param name="e"> - <attribution license="cc4" from="Microsoft" modified="false" />An object that contains the event data. </param> - </Docs> - </Member> - <Member MemberName="OnChanging"> - <MemberSignature Language="C#" Value="protected virtual void OnChanging (System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs e);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void OnChanging(class System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs e) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="e" Type="System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Raises the <see cref="E:System.ComponentModel.Composition.Hosting.DirectoryCatalog.Changing" /> event.</para> - </summary> - <param name="e"> - <attribution license="cc4" from="Microsoft" modified="false" />An object that contains the event data.</param> - </Docs> - </Member> - <Member MemberName="Path"> - <MemberSignature Language="C#" Value="public string Path { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance string Path" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the path observed by the <see cref="T:System.ComponentModel.Composition.Hosting.DirectoryCatalog" /> object.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Refresh"> - <MemberSignature Language="C#" Value="public void Refresh ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Refresh() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>If files were added to the directory, they are also added to the catalog. If files were removed from the directory, they are also removed from the catalog. For files that have been removed, the assembly cannot be unloaded from the process, so <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> objects for those files will be removed only from the catalog.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Refreshes the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> objects with the latest files in the directory that match the search pattern. </para> - </summary> - </Docs> - </Member> - <Member MemberName="SearchPattern"> - <MemberSignature Language="C#" Value="public string SearchPattern { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance string SearchPattern" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the search pattern that is passed into the constructor of the <see cref="T:System.ComponentModel.Composition.Hosting.DirectoryCatalog" /> object.</para> - </summary> - </Docs> - </Member> - <Member MemberName="System.ComponentModel.Composition.Primitives.ICompositionElement.DisplayName"> - <MemberSignature Language="C#" Value="string System.ComponentModel.Composition.Primitives.ICompositionElement.DisplayName { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance string System.ComponentModel.Composition.Primitives.ICompositionElement.DisplayName" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This member is an explicit interface member implementation. It can be used only when the <see cref="T:System.ComponentModel.Composition.Hosting.DirectoryCatalog" /> instance is cast to an <see cref="T:System.ComponentModel.Composition.Primitives.ICompositionElement" /> interface.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the display name of the directory catalog.</para> - </summary> - </Docs> - </Member> - <Member MemberName="System.ComponentModel.Composition.Primitives.ICompositionElement.Origin"> - <MemberSignature Language="C#" Value="System.ComponentModel.Composition.Primitives.ICompositionElement System.ComponentModel.Composition.Primitives.ICompositionElement.Origin { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.ComponentModel.Composition.Primitives.ICompositionElement System.ComponentModel.Composition.Primitives.ICompositionElement.Origin" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ICompositionElement</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This member is an explicit interface member implementation. It can be used only when the <see cref="T:System.ComponentModel.Composition.Hosting.DirectoryCatalog" /> instance is cast to an <see cref="T:System.ComponentModel.Composition.Primitives.ICompositionElement" /> interface.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the composition element from which the directory catalog originated.</para> - </summary> - </Docs> - </Member> - <Member MemberName="ToString"> - <MemberSignature Language="C#" Value="public override string ToString ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance string ToString() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a string representation of the directory catalog.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A string representation of the catalog.</para> - </returns> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/ExportProvider.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/ExportProvider.xml deleted file mode 100644 index 77778f5917a..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/ExportProvider.xml +++ /dev/null @@ -1,761 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ExportProvider" FullName="System.ComponentModel.Composition.Hosting.ExportProvider"> - <TypeSignature Language="C#" Value="public abstract class ExportProvider" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi abstract beforefieldinit ExportProvider extends System.Object" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Object</BaseTypeName> - </Base> - <Interfaces /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Retrieves exports which match a specified <see cref="T:System.ComponentModel.Composition.Primitives.ImportDefinition" /> object.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="protected ExportProvider ();" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.ExportProvider" /> class.</para> - </summary> - </Docs> - </Member> - <Member MemberName="ExportsChanged"> - <MemberSignature Language="C#" Value="public event EventHandler<System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs> ExportsChanged;" /> - <MemberSignature Language="ILAsm" Value=".event class System.EventHandler`1<class System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs> ExportsChanged" /> - <MemberType>Event</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.EventHandler<System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs></ReturnType> - </ReturnValue> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Occurs when the exports in the <see cref="T:System.ComponentModel.Composition.Hosting.ExportProvider" /> change.</para> - </summary> - </Docs> - </Member> - <Member MemberName="ExportsChanging"> - <MemberSignature Language="C#" Value="public event EventHandler<System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs> ExportsChanging;" /> - <MemberSignature Language="ILAsm" Value=".event class System.EventHandler`1<class System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs> ExportsChanging" /> - <MemberType>Event</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.EventHandler<System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs></ReturnType> - </ReturnValue> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Occurs when the provided exports are changing.</para> - </summary> - </Docs> - </Member> - <Member MemberName="GetExport<T>"> - <MemberSignature Language="C#" Value="public Lazy<T> GetExport<T> ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Lazy`1<!!T> GetExport<T>() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Lazy<T></ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on <paramref name="T" />.</para> - <para>The contract name is compared by using the <see cref="P:System.StringComparer.Ordinal" /> property to perform a case-sensitive, non-linguistic comparison.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns the export with the contract name derived from the specified type parameter. If there is not exactly one matching export, an exception is thrown.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The export with the contract name derived from the specified type parameter.</para> - </returns> - <typeparam name="T"> - <attribution license="cc4" from="Microsoft" modified="false" />The type parameter of the <see cref="T:System.Lazy`1" /> object to return. The contract name is also derived from this type parameter.</typeparam> - </Docs> - </Member> - <Member MemberName="GetExport<T>"> - <MemberSignature Language="C#" Value="public Lazy<T> GetExport<T> (string contractName);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Lazy`1<!!T> GetExport<T>(string contractName) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Lazy<T></ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="contractName" Type="System.String" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The default contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on <paramref name="T" />.</para> - <para>The contract name is compared by using the <see cref="P:System.StringComparer.Ordinal" /> property to perform a case-sensitive, non-linguistic comparison.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns the export with the specified contract name. If there is not exactly one matching export, an exception is thrown.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The export with the specified contract name.</para> - </returns> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name of the <see cref="T:System.Lazy`1" /> object to return, or null or an empty string ("") to use the default contract name.</param> - <typeparam name="T"> - <attribution license="cc4" from="Microsoft" modified="false" />The type parameter of the <see cref="T:System.Lazy`1" /> object to return.</typeparam> - </Docs> - </Member> - <Member MemberName="GetExport<T,TMetadataView>"> - <MemberSignature Language="C#" Value="public Lazy<T,TMetadataView> GetExport<T,TMetadataView> ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Lazy`2<!!T, !!TMetadataView> GetExport<T, TMetadataView>() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Lazy<T,TMetadataView></ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - <TypeParameter Name="TMetadataView" /> - </TypeParameters> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on <paramref name="T" />.</para> - <para>The contract name is compared by using the <see cref="P:System.StringComparer.Ordinal" /> property to perform a case-sensitive, non-linguistic comparison.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns the export with the contract name derived from the specified type parameter. If there is not exactly one matching export, an exception is thrown.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>System.Lazy`2</para> - </returns> - <typeparam name="T"> - <attribution license="cc4" from="Microsoft" modified="false" />The type parameter of the <see cref="T:System.Lazy`2" /> object to return. The contract name is also derived from this type parameter.</typeparam> - <typeparam name="TMetadataView"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the metadata view of the <see cref="T:System.Lazy`2" /> object to return.</typeparam> - </Docs> - </Member> - <Member MemberName="GetExport<T,TMetadataView>"> - <MemberSignature Language="C#" Value="public Lazy<T,TMetadataView> GetExport<T,TMetadataView> (string contractName);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Lazy`2<!!T, !!TMetadataView> GetExport<T, TMetadataView>(string contractName) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Lazy<T,TMetadataView></ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - <TypeParameter Name="TMetadataView" /> - </TypeParameters> - <Parameters> - <Parameter Name="contractName" Type="System.String" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The default contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on <paramref name="T" />.</para> - <para>The contract name is compared by using the <see cref="P:System.StringComparer.Ordinal" /> property to perform a case-sensitive, non-linguistic comparison.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns the export with the specified contract name. If there is not exactly one matching export, an exception is thrown.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The export with the specified contract name.</para> - </returns> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name of the <see cref="T:System.Lazy`2" /> object to return, or null or an empty string ("") to use the default contract name.</param> - <typeparam name="T"> - <attribution license="cc4" from="Microsoft" modified="false" />The type parameter of the <see cref="T:System.Lazy`2" /> object to return.</typeparam> - <typeparam name="TMetadataView"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the metadata view of the <see cref="T:System.Lazy`2" /> object to return.</typeparam> - </Docs> - </Member> - <Member MemberName="GetExportedValue<T>"> - <MemberSignature Language="C#" Value="public T GetExportedValue<T> ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance !!T GetExportedValue<T>() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>T</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on <paramref name="T" />.</para> - <para>The contract name is compared by using the <see cref="P:System.StringComparer.Ordinal" /> property to perform a case-sensitive, non-linguistic comparison.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns the exported object with the contract name derived from the specified type parameter. If there is not exactly one matching exported object, an exception is thrown.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The exported object with the contract name derived from the specified type parameter.</para> - </returns> - <typeparam name="T"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the exported object to return. The contract name is also derived from this type parameter.</typeparam> - </Docs> - </Member> - <Member MemberName="GetExportedValue<T>"> - <MemberSignature Language="C#" Value="public T GetExportedValue<T> (string contractName);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance !!T GetExportedValue<T>(string contractName) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>T</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="contractName" Type="System.String" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The default contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on <paramref name="T" />.</para> - <para>The contract name is compared by using the <see cref="P:System.StringComparer.Ordinal" /> property to perform a case-sensitive, non-linguistic comparison.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns the exported object with the specified contract name. If there is not exactly one matching exported object, an exception is thrown.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The exported object with the specified contract name.</para> - </returns> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name of the exported object to return, or null or an empty string ("") to use the default contract name.</param> - <typeparam name="T"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the exported object to return.</typeparam> - </Docs> - </Member> - <Member MemberName="GetExportedValueOrDefault<T>"> - <MemberSignature Language="C#" Value="public T GetExportedValueOrDefault<T> ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance !!T GetExportedValueOrDefault<T>() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>T</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>If the exported object is not found, this method returns the appropriate default value for <paramref name="T" />; for example, zero for integer types, false for Boolean types, and null for reference types.</para> - <para>The contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on <paramref name="T" />.</para> - <para>The contract name is compared by using the <see cref="P:System.StringComparer.Ordinal" /> property to perform a case-sensitive, non-linguistic comparison.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the exported object with the contract name derived from the specified type parameter or the default value for the specified type, or throws an exception if there is more than one matching exported object.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The exported object with the contract name derived from <paramref name="T" />, if found; otherwise, the default value for <paramref name="T" />.</para> - </returns> - <typeparam name="T"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the exported object to return. The contract name is also derived from this type parameter.</typeparam> - </Docs> - </Member> - <Member MemberName="GetExportedValueOrDefault<T>"> - <MemberSignature Language="C#" Value="public T GetExportedValueOrDefault<T> (string contractName);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance !!T GetExportedValueOrDefault<T>(string contractName) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>T</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="contractName" Type="System.String" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>If the exported object is not found, this method returns the appropriate default value for <paramref name="T" />; for example, zero for integer types, false for Boolean types, and null for reference types.</para> - <para>The default contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on <paramref name="T" />.</para> - <para>The contract name is compared by using the <see cref="P:System.StringComparer.Ordinal" /> property to perform a case-sensitive, non-linguistic comparison.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the exported object with the specified contract name or the default value for the specified type, or throws an exception if there is more than one matching exported object.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The exported object with the specified contract name, if found; otherwise, the default value for <paramref name="T" />.</para> - </returns> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name of the exported object to return, or null or an empty string ("") to use the default contract name.</param> - <typeparam name="T"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the exported object to return.</typeparam> - </Docs> - </Member> - <Member MemberName="GetExportedValues<T>"> - <MemberSignature Language="C#" Value="public System.Collections.Generic.IEnumerable<T> GetExportedValues<T> ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Collections.Generic.IEnumerable`1<!!T> GetExportedValues<T>() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<T></ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on <paramref name="T" />.</para> - <para>The contract name is compared by using the <see cref="P:System.StringComparer.Ordinal" /> property to perform a case-sensitive, non-linguistic comparison.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets all the exported objects with the contract name derived from the specified type parameter.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The exported objects with the contract name derived from the specified type parameter, if found; otherwise, an empty <see cref="T:System.Collections.ObjectModel.Collection`1" /> object.</para> - </returns> - <typeparam name="T"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the exported object to return. The contract name is also derived from this type parameter.</typeparam> - </Docs> - </Member> - <Member MemberName="GetExportedValues<T>"> - <MemberSignature Language="C#" Value="public System.Collections.Generic.IEnumerable<T> GetExportedValues<T> (string contractName);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Collections.Generic.IEnumerable`1<!!T> GetExportedValues<T>(string contractName) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<T></ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="contractName" Type="System.String" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The default contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on <paramref name="T" />.</para> - <para>The contract name is compared by using the <see cref="P:System.StringComparer.Ordinal" /> property to perform a case-sensitive, non-linguistic comparison.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets all the exported objects with the specified contract name.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The exported objects with the specified contract name, if found; otherwise, an empty <see cref="T:System.Collections.ObjectModel.Collection`1" /> object.</para> - </returns> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name of the exported objects to return; or null or an empty string ("") to use the default contract name.</param> - <typeparam name="T"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the exported object to return.</typeparam> - </Docs> - </Member> - <Member MemberName="GetExports"> - <MemberSignature Language="C#" Value="public System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.Export> GetExports (System.ComponentModel.Composition.Primitives.ImportDefinition definition);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.Export> GetExports(class System.ComponentModel.Composition.Primitives.ImportDefinition definition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.Export></ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="definition" Type="System.ComponentModel.Composition.Primitives.ImportDefinition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets all exports that match the conditions of the specified import definition.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A collection of all the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects matching the condition specified by <paramref name="definition" />.</para> - </returns> - <param name="definition"> - <attribution license="cc4" from="Microsoft" modified="false" />The object that defines the conditions of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects to get.</param> - </Docs> - </Member> - <Member MemberName="GetExports"> - <MemberSignature Language="C#" Value="public System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.Export> GetExports (System.ComponentModel.Composition.Primitives.ImportDefinition definition, System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.Export> GetExports(class System.ComponentModel.Composition.Primitives.ImportDefinition definition, class System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.Export></ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="definition" Type="System.ComponentModel.Composition.Primitives.ImportDefinition" /> - <Parameter Name="atomicComposition" Type="System.ComponentModel.Composition.Hosting.AtomicComposition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets all exports that match the conditions of the specified import definition and composition.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A collection of all the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects matching the condition specified by <paramref name="definition" /> and <paramref name="atomicComposition" />.</para> - </returns> - <param name="definition"> - <attribution license="cc4" from="Microsoft" modified="false" />The object that defines the conditions of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects to get.</param> - <param name="atomicComposition"> - <attribution license="cc4" from="Microsoft" modified="false" />The transactional container for the composition.</param> - </Docs> - </Member> - <Member MemberName="GetExports"> - <MemberSignature Language="C#" Value="public System.Collections.Generic.IEnumerable<Lazy<object,object>> GetExports (Type type, Type metadataViewType, string contractName);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Collections.Generic.IEnumerable`1<class System.Lazy`2<object, object>> GetExports(class System.Type type, class System.Type metadataViewType, string contractName) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.Lazy<System.Object,System.Object>></ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="type" Type="System.Type" /> - <Parameter Name="metadataViewType" Type="System.Type" /> - <Parameter Name="contractName" Type="System.String" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The default contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on <paramref name="type" />.</para> - <para>The contract name is compared by using the <see cref="P:System.StringComparer.Ordinal" /> property to perform a case-sensitive, non-linguistic comparison.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets all the exports with the specified contract name.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A collection of all the <see cref="T:System.Lazy`2" /> objects for the contract matching <paramref name="contractName" />.</para> - </returns> - <param name="type"> - <attribution license="cc4" from="Microsoft" modified="false" />The type parameter of the <see cref="T:System.Lazy`2" /> objects to return.</param> - <param name="metadataViewType"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the metadata view of the <see cref="T:System.Lazy`2" /> objects to return.</param> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name of the <see cref="T:System.Lazy`2" /> object to return, or null or an empty string ("") to use the default contract name.</param> - </Docs> - </Member> - <Member MemberName="GetExports<T>"> - <MemberSignature Language="C#" Value="public System.Collections.Generic.IEnumerable<Lazy<T>> GetExports<T> ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Collections.Generic.IEnumerable`1<class System.Lazy`1<!!T>> GetExports<T>() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.Lazy<T>></ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on <paramref name="T" />.</para> - <para>The contract name is compared by using the <see cref="P:System.StringComparer.Ordinal" /> property to perform a case-sensitive, non-linguistic comparison.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets all the exports with the contract name derived from the specified type parameter.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The <see cref="T:System.Lazy`1" /> objects with the contract name derived from <paramref name="T" />, if found; otherwise, an empty <see cref="T:System.Collections.Generic.IEnumerable`1" /> object.</para> - </returns> - <typeparam name="T"> - <attribution license="cc4" from="Microsoft" modified="false" />The type parameter of the <see cref="T:System.Lazy`1" /> objects to return. The contract name is also derived from this type parameter.</typeparam> - </Docs> - </Member> - <Member MemberName="GetExports<T>"> - <MemberSignature Language="C#" Value="public System.Collections.Generic.IEnumerable<Lazy<T>> GetExports<T> (string contractName);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Collections.Generic.IEnumerable`1<class System.Lazy`1<!!T>> GetExports<T>(string contractName) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.Lazy<T>></ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="contractName" Type="System.String" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The default contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on <paramref name="T" />.</para> - <para>The contract name is compared by using the <see cref="P:System.StringComparer.Ordinal" /> property to perform a case-sensitive, non-linguistic comparison.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets all the exports with the specified contract name.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The <see cref="T:System.Lazy`1" /> objects with the specified contract name, if found; otherwise, an empty <see cref="T:System.Collections.Generic.IEnumerable`1" /> object.</para> - </returns> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name of the <see cref="T:System.Lazy`1" /> objects to return, or null or an empty string ("") to use the default contract name.</param> - <typeparam name="T"> - <attribution license="cc4" from="Microsoft" modified="false" />The type parameter of the <see cref="T:System.Lazy`1" /> objects to return.</typeparam> - </Docs> - </Member> - <Member MemberName="GetExports<T,TMetadataView>"> - <MemberSignature Language="C#" Value="public System.Collections.Generic.IEnumerable<Lazy<T,TMetadataView>> GetExports<T,TMetadataView> ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Collections.Generic.IEnumerable`1<class System.Lazy`2<!!T, !!TMetadataView>> GetExports<T, TMetadataView>() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.Lazy<T,TMetadataView>></ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - <TypeParameter Name="TMetadataView" /> - </TypeParameters> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on <paramref name="T" />.</para> - <para>The contract name is compared by using the <see cref="P:System.StringComparer.Ordinal" /> property to perform a case-sensitive, non-linguistic comparison.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets all the exports with the contract name derived from the specified type parameter.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The <see cref="T:System.Lazy`2" /> objects with the contract name derived from <paramref name="T" />, if found; otherwise, an empty <see cref="T:System.Collections.Generic.IEnumerable`1" /> object.</para> - </returns> - <typeparam name="T"> - <attribution license="cc4" from="Microsoft" modified="false" />The type parameter of the <see cref="T:System.Lazy`2" /> objects to return. The contract name is also derived from this type parameter.</typeparam> - <typeparam name="TMetadataView"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the metadata view of the <see cref="T:System.Lazy`2" /> objects to return.</typeparam> - </Docs> - </Member> - <Member MemberName="GetExports<T,TMetadataView>"> - <MemberSignature Language="C#" Value="public System.Collections.Generic.IEnumerable<Lazy<T,TMetadataView>> GetExports<T,TMetadataView> (string contractName);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Collections.Generic.IEnumerable`1<class System.Lazy`2<!!T, !!TMetadataView>> GetExports<T, TMetadataView>(string contractName) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.Lazy<T,TMetadataView>></ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - <TypeParameter Name="TMetadataView" /> - </TypeParameters> - <Parameters> - <Parameter Name="contractName" Type="System.String" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The default contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on <paramref name="T" />.</para> - <para>The contract name is compared by using the <see cref="P:System.StringComparer.Ordinal" /> property to perform a case-sensitive, non-linguistic comparison.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets all the exports with the specified contract name.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The <see cref="T:System.Lazy`2" /> objects with the specified contract name if found; otherwise, an empty <see cref="T:System.Collections.Generic.IEnumerable`1" /> object.</para> - </returns> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name of the <see cref="T:System.Lazy`2" /> objects to return, or null or an empty string ("") to use the default contract name.</param> - <typeparam name="T"> - <attribution license="cc4" from="Microsoft" modified="false" />The type parameter of the <see cref="T:System.Lazy`2" /> objects to return. The contract name is also derived from this type parameter.</typeparam> - <typeparam name="TMetadataView"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the metadata view of the <see cref="T:System.Lazy`2" /> objects to return.</typeparam> - </Docs> - </Member> - <Member MemberName="GetExportsCore"> - <MemberSignature Language="C#" Value="protected abstract System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.Export> GetExportsCore (System.ComponentModel.Composition.Primitives.ImportDefinition definition, System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.Export> GetExportsCore(class System.ComponentModel.Composition.Primitives.ImportDefinition definition, class System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.Export></ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="definition" Type="System.ComponentModel.Composition.Primitives.ImportDefinition" /> - <Parameter Name="atomicComposition" Type="System.ComponentModel.Composition.Hosting.AtomicComposition" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Overrides of this method should not treat cardinality-related mismatches as errors, and should not throw exceptions in those cases. For example, if <see cref="P:System.ComponentModel.Composition.Primitives.ImportDefinition.Cardinality" /> is <see cref="F:System.ComponentModel.Composition.Primitives.ImportCardinality.ExactlyOne" /> and there are zero <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects that match the conditions of the specified <see cref="T:System.ComponentModel.Composition.Primitives.ImportDefinition" />, an empty <see cref="T:System.Collections.Generic.IEnumerable`1" /> collection should be returned.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets all the exports that match the constraint defined by the specified definition.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A collection that contains all the exports that match the specified condition.</para> - </returns> - <param name="definition"> - <attribution license="cc4" from="Microsoft" modified="false" />The object that defines the conditions of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects to return.</param> - <param name="atomicComposition"> - <attribution license="cc4" from="Microsoft" modified="false" />The transactional container for the composition.</param> - </Docs> - </Member> - <Member MemberName="OnExportsChanged"> - <MemberSignature Language="C#" Value="protected virtual void OnExportsChanged (System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs e);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void OnExportsChanged(class System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs e) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="e" Type="System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Raises the <see cref="E:System.ComponentModel.Composition.Hosting.ExportProvider.ExportsChanged" /> event.</para> - </summary> - <param name="e"> - <attribution license="cc4" from="Microsoft" modified="false" />An <see cref="T:System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs" /> that contains the event data.</param> - </Docs> - </Member> - <Member MemberName="OnExportsChanging"> - <MemberSignature Language="C#" Value="protected virtual void OnExportsChanging (System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs e);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void OnExportsChanging(class System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs e) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="e" Type="System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Raises the <see cref="E:System.ComponentModel.Composition.Hosting.ExportProvider.ExportsChanging" /> event.</para> - </summary> - <param name="e"> - <attribution license="cc4" from="Microsoft" modified="false" />An <see cref="T:System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs" /> that contains the event data.</param> - </Docs> - </Member> - <Member MemberName="TryGetExports"> - <MemberSignature Language="C#" Value="public bool TryGetExports (System.ComponentModel.Composition.Primitives.ImportDefinition definition, System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition, out System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.Export> exports);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance bool TryGetExports(class System.ComponentModel.Composition.Primitives.ImportDefinition definition, class System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition, class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.Export> exports) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="definition" Type="System.ComponentModel.Composition.Primitives.ImportDefinition" /> - <Parameter Name="atomicComposition" Type="System.ComponentModel.Composition.Hosting.AtomicComposition" /> - <Parameter Name="exports" Type="System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.Export>&" RefType="out" /> - </Parameters> - <Docs> - <param name="definition">To be added.</param> - <param name="atomicComposition">To be added.</param> - <param name="exports">To be added.</param> - <summary>To be added.</summary> - <returns>To be added.</returns> - <remarks>To be added.</remarks> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/ExportsChangeEventArgs.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/ExportsChangeEventArgs.xml deleted file mode 100644 index dfa725ee57d..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/ExportsChangeEventArgs.xml +++ /dev/null @@ -1,124 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ExportsChangeEventArgs" FullName="System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs"> - <TypeSignature Language="C#" Value="public class ExportsChangeEventArgs : EventArgs" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit ExportsChangeEventArgs extends System.EventArgs" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.EventArgs</BaseTypeName> - </Base> - <Interfaces /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Provides data for the <see cref="E:System.ComponentModel.Composition.Hosting.ExportProvider.ExportsChanging" /> and <see cref="E:System.ComponentModel.Composition.Hosting.ExportProvider.ExportsChanged" /> event. </para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ExportsChangeEventArgs (System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ExportDefinition> addedExports, System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ExportDefinition> removedExports, System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.ExportDefinition> addedExports, class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.ExportDefinition> removedExports, class System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="addedExports" Type="System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ExportDefinition>" /> - <Parameter Name="removedExports" Type="System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ExportDefinition>" /> - <Parameter Name="atomicComposition" Type="System.ComponentModel.Composition.Hosting.AtomicComposition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs" /> class. </para> - </summary> - <param name="addedExports"> - <attribution license="cc4" from="Microsoft" modified="false" />The events that were added.</param> - <param name="removedExports"> - <attribution license="cc4" from="Microsoft" modified="false" />The events that were removed.</param> - <param name="atomicComposition"> - <attribution license="cc4" from="Microsoft" modified="false" />The composition transaction that contains the change.</param> - </Docs> - </Member> - <Member MemberName="AddedExports"> - <MemberSignature Language="C#" Value="public System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ExportDefinition> AddedExports { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.ExportDefinition> AddedExports" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ExportDefinition></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the exports that were added in this change.</para> - </summary> - </Docs> - </Member> - <Member MemberName="AtomicComposition"> - <MemberSignature Language="C#" Value="public System.ComponentModel.Composition.Hosting.AtomicComposition AtomicComposition { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.ComponentModel.Composition.Hosting.AtomicComposition AtomicComposition" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Hosting.AtomicComposition</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the composition transaction of the change, if any.</para> - </summary> - </Docs> - </Member> - <Member MemberName="ChangedContractNames"> - <MemberSignature Language="C#" Value="public System.Collections.Generic.IEnumerable<string> ChangedContractNames { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IEnumerable`1<string> ChangedContractNames" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.String></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the contract names that were altered in the change.</para> - </summary> - </Docs> - </Member> - <Member MemberName="RemovedExports"> - <MemberSignature Language="C#" Value="public System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ExportDefinition> RemovedExports { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.ExportDefinition> RemovedExports" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ExportDefinition></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the exports that were removed in the change.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/FilteredCatalog.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/FilteredCatalog.xml deleted file mode 100644 index c152fc4e90b..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/FilteredCatalog.xml +++ /dev/null @@ -1,335 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="FilteredCatalog" FullName="System.ComponentModel.Composition.Hosting.FilteredCatalog"> - <TypeSignature Language="C#" Value="public class FilteredCatalog : System.ComponentModel.Composition.Primitives.ComposablePartCatalog, System.ComponentModel.Composition.Hosting.INotifyComposablePartCatalogChanged" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit FilteredCatalog extends System.ComponentModel.Composition.Primitives.ComposablePartCatalog implements class System.ComponentModel.Composition.Hosting.INotifyComposablePartCatalogChanged" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.ComponentModel.Composition.Primitives.ComposablePartCatalog</BaseTypeName> - </Base> - <Interfaces> - <Interface> - <InterfaceName>System.ComponentModel.Composition.Hosting.INotifyComposablePartCatalogChanged</InterfaceName> - </Interface> - </Interfaces> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Represents a catalog after a filter function is applied to it.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public FilteredCatalog (System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, Func<System.ComponentModel.Composition.Primitives.ComposablePartDefinition,bool> filter);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, class System.Func`2<class System.ComponentModel.Composition.Primitives.ComposablePartDefinition, bool> filter) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="catalog" Type="System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> - <Parameter Name="filter" Type="System.Func<System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.Boolean>" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.FilteredCatalog" /> class with the specified underlying catalog and filter.</para> - </summary> - <param name="catalog"> - <attribution license="cc4" from="Microsoft" modified="false" />The underlying catalog.</param> - <param name="filter"> - <attribution license="cc4" from="Microsoft" modified="false" />The function to filter parts.</param> - </Docs> - </Member> - <Member MemberName="Changed"> - <MemberSignature Language="C#" Value="public event EventHandler<System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs> Changed;" /> - <MemberSignature Language="ILAsm" Value=".event class System.EventHandler`1<class System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs> Changed" /> - <MemberType>Event</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.EventHandler<System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs></ReturnType> - </ReturnValue> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Occurs when the underlying catalog has changed.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Changing"> - <MemberSignature Language="C#" Value="public event EventHandler<System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs> Changing;" /> - <MemberSignature Language="ILAsm" Value=".event class System.EventHandler`1<class System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs> Changing" /> - <MemberType>Event</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.EventHandler<System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs></ReturnType> - </ReturnValue> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Occurs when the underlying catalog is changing.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Complement"> - <MemberSignature Language="C#" Value="public System.ComponentModel.Composition.Hosting.FilteredCatalog Complement { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.ComponentModel.Composition.Hosting.FilteredCatalog Complement" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Hosting.FilteredCatalog</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a catalog that contains parts that are present in the underlying catalog but that were filtered out by the filter function.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Dispose"> - <MemberSignature Language="C#" Value="protected override void Dispose (bool disposing);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void Dispose(bool disposing) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="disposing" Type="System.Boolean" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This method is called only by the public Dispose() and Finalize() methods; do not call this method directly.When you implement the dispose pattern, the Boolean parameter of the Dispose(Boolean) method should be used as follows:</para> - <list type="bullet"> - <item> - <para>The Dispose() method of the current object should call Dispose(Boolean) with the Boolean parameter set to true to release both managed and unmanaged resources.</para> - </item> - <item> - <para>The Finalize() method of the current object should call Dispose(Boolean) with the Boolean parameter set to false to release only unmanaged resources.</para> - </item> - </list> - <para>For more information, see <format type="text/html"><a href="eb4e1af0-3b48-4fbc-ad4e-fc2f64138bf9">Implementing a Dispose Method</a></format>.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Called by the Dispose() and Finalize() methods to release the managed and unmanaged resources used by the current instance of the <see cref="T:System.ComponentModel.Composition.Hosting.FilteredCatalog" /> class.</para> - </summary> - <param name="disposing"> - <attribution license="cc4" from="Microsoft" modified="false" />true to release managed and unmanaged resources; false to release only unmanaged resources.</param> - </Docs> - </Member> - <Member MemberName="GetEnumerator"> - <MemberSignature Language="C#" Value="public override System.Collections.Generic.IEnumerator<System.ComponentModel.Composition.Primitives.ComposablePartDefinition> GetEnumerator ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance class System.Collections.Generic.IEnumerator`1<class System.ComponentModel.Composition.Primitives.ComposablePartDefinition> GetEnumerator() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerator<System.ComponentModel.Composition.Primitives.ComposablePartDefinition></ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns an enumerator that iterates through the catalog.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>An enumerator that can be used to iterate through the catalog.</para> - </returns> - </Docs> - </Member> - <Member MemberName="GetExports"> - <MemberSignature Language="C#" Value="public override System.Collections.Generic.IEnumerable<Tuple<System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.ComponentModel.Composition.Primitives.ExportDefinition>> GetExports (System.ComponentModel.Composition.Primitives.ImportDefinition definition);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance class System.Collections.Generic.IEnumerable`1<class System.Tuple`2<class System.ComponentModel.Composition.Primitives.ComposablePartDefinition, class System.ComponentModel.Composition.Primitives.ExportDefinition>> GetExports(class System.ComponentModel.Composition.Primitives.ImportDefinition definition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.Tuple<System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.ComponentModel.Composition.Primitives.ExportDefinition>></ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="definition" Type="System.ComponentModel.Composition.Primitives.ImportDefinition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the exported parts from this catalog that match the specified import.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A collection of matching parts.</para> - </returns> - <param name="definition"> - <attribution license="cc4" from="Microsoft" modified="false" />The import to match.</param> - </Docs> - </Member> - <Member MemberName="IncludeDependencies"> - <MemberSignature Language="C#" Value="public System.ComponentModel.Composition.Hosting.FilteredCatalog IncludeDependencies ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.ComponentModel.Composition.Hosting.FilteredCatalog IncludeDependencies() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Hosting.FilteredCatalog</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a new <see cref="T:System.ComponentModel.Composition.Hosting.FilteredCatalog" /> object that contains all the parts from this catalog and all their dependencies.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The new catalog.</para> - </returns> - </Docs> - </Member> - <Member MemberName="IncludeDependencies"> - <MemberSignature Language="C#" Value="public System.ComponentModel.Composition.Hosting.FilteredCatalog IncludeDependencies (Func<System.ComponentModel.Composition.Primitives.ImportDefinition,bool> importFilter);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.ComponentModel.Composition.Hosting.FilteredCatalog IncludeDependencies(class System.Func`2<class System.ComponentModel.Composition.Primitives.ImportDefinition, bool> importFilter) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Hosting.FilteredCatalog</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="importFilter" Type="System.Func<System.ComponentModel.Composition.Primitives.ImportDefinition,System.Boolean>" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a new <see cref="T:System.ComponentModel.Composition.Hosting.FilteredCatalog" /> object that contains all the parts from this catalog and all dependencies that can be reached through imports that match the specified filter.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The new catalog.</para> - </returns> - <param name="importFilter"> - <attribution license="cc4" from="Microsoft" modified="false" />The filter for imports.</param> - </Docs> - </Member> - <Member MemberName="IncludeDependents"> - <MemberSignature Language="C#" Value="public System.ComponentModel.Composition.Hosting.FilteredCatalog IncludeDependents ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.ComponentModel.Composition.Hosting.FilteredCatalog IncludeDependents() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Hosting.FilteredCatalog</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a new <see cref="T:System.ComponentModel.Composition.Hosting.FilteredCatalog" /> object that contains all the parts from this catalog and all their dependents.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The new catalog.</para> - </returns> - </Docs> - </Member> - <Member MemberName="IncludeDependents"> - <MemberSignature Language="C#" Value="public System.ComponentModel.Composition.Hosting.FilteredCatalog IncludeDependents (Func<System.ComponentModel.Composition.Primitives.ImportDefinition,bool> importFilter);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.ComponentModel.Composition.Hosting.FilteredCatalog IncludeDependents(class System.Func`2<class System.ComponentModel.Composition.Primitives.ImportDefinition, bool> importFilter) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Hosting.FilteredCatalog</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="importFilter" Type="System.Func<System.ComponentModel.Composition.Primitives.ImportDefinition,System.Boolean>" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a new <see cref="T:System.ComponentModel.Composition.Hosting.FilteredCatalog" /> object that contains all the parts from this catalog and all dependents that can be reached through imports that match the specified filter.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The new catalog.</para> - </returns> - <param name="importFilter"> - <attribution license="cc4" from="Microsoft" modified="false" />The filter for imports.</param> - </Docs> - </Member> - <Member MemberName="OnChanged"> - <MemberSignature Language="C#" Value="protected virtual void OnChanged (System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs e);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void OnChanged(class System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs e) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="e" Type="System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Raises the <see cref="E:System.ComponentModel.Composition.Hosting.FilteredCatalog.Changed" /> event.</para> - </summary> - <param name="e"> - <attribution license="cc4" from="Microsoft" modified="false" />Provides data for the event.</param> - </Docs> - </Member> - <Member MemberName="OnChanging"> - <MemberSignature Language="C#" Value="protected virtual void OnChanging (System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs e);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void OnChanging(class System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs e) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="e" Type="System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Raises the <see cref="E:System.ComponentModel.Composition.Hosting.FilteredCatalog.Changing" /> event.</para> - </summary> - <param name="e"> - <attribution license="cc4" from="Microsoft" modified="false" />Provides data for the event.</param> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/INotifyComposablePartCatalogChanged.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/INotifyComposablePartCatalogChanged.xml deleted file mode 100644 index 566aa4b6831..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/INotifyComposablePartCatalogChanged.xml +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="INotifyComposablePartCatalogChanged" FullName="System.ComponentModel.Composition.Hosting.INotifyComposablePartCatalogChanged"> - <TypeSignature Language="C#" Value="public interface INotifyComposablePartCatalogChanged" /> - <TypeSignature Language="ILAsm" Value=".class public interface auto ansi abstract INotifyComposablePartCatalogChanged" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Interfaces /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Provides notifications when a <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> changes.</para> - </summary> - </Docs> - <Members> - <Member MemberName="Changed"> - <MemberSignature Language="C#" Value="public event EventHandler<System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs> Changed;" /> - <MemberSignature Language="ILAsm" Value=".event class System.EventHandler`1<class System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs> Changed" /> - <MemberType>Event</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.EventHandler<System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs></ReturnType> - </ReturnValue> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Occurs when a <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> has changed.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Changing"> - <MemberSignature Language="C#" Value="public event EventHandler<System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs> Changing;" /> - <MemberSignature Language="ILAsm" Value=".event class System.EventHandler`1<class System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs> Changing" /> - <MemberType>Event</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.EventHandler<System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs></ReturnType> - </ReturnValue> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Occurs when a <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> is changing.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/ImportEngine.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/ImportEngine.xml deleted file mode 100644 index fb30567d6df..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/ImportEngine.xml +++ /dev/null @@ -1,245 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ImportEngine" FullName="System.ComponentModel.Composition.Hosting.ImportEngine"> - <TypeSignature Language="C#" Value="public class ImportEngine : IDisposable, System.ComponentModel.Composition.ICompositionService" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit ImportEngine extends System.Object implements class System.ComponentModel.Composition.ICompositionService, class System.IDisposable" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Object</BaseTypeName> - </Base> - <Interfaces> - <Interface> - <InterfaceName>System.ComponentModel.Composition.ICompositionService</InterfaceName> - </Interface> - <Interface> - <InterfaceName>System.IDisposable</InterfaceName> - </Interface> - </Interfaces> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This class is used internally by <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" />. You should generally not use it unless you are authoring a container.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Performs composition for containers.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ImportEngine (System.ComponentModel.Composition.Hosting.ExportProvider sourceProvider);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.ComponentModel.Composition.Hosting.ExportProvider sourceProvider) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="sourceProvider" Type="System.ComponentModel.Composition.Hosting.ExportProvider" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.ImportEngine" /> class. </para> - </summary> - <param name="sourceProvider"> - <attribution license="cc4" from="Microsoft" modified="false" />The <see cref="T:System.ComponentModel.Composition.Hosting.ExportProvider" /> that provides the <see cref="T:System.ComponentModel.Composition.Hosting.ImportEngine" /> access to <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ImportEngine (System.ComponentModel.Composition.Hosting.ExportProvider sourceProvider, bool isThreadSafe);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.ComponentModel.Composition.Hosting.ExportProvider sourceProvider, bool isThreadSafe) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="sourceProvider" Type="System.ComponentModel.Composition.Hosting.ExportProvider" /> - <Parameter Name="isThreadSafe" Type="System.Boolean" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.ImportEngine" /> class, optionally in thread-safe mode.</para> - </summary> - <param name="sourceProvider"> - <attribution license="cc4" from="Microsoft" modified="false" />The <see cref="T:System.ComponentModel.Composition.Hosting.ExportProvider" /> that provides the <see cref="T:System.ComponentModel.Composition.Hosting.ImportEngine" /> access to <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects.</param> - <param name="isThreadSafe"> - <attribution license="cc4" from="Microsoft" modified="false" />true if thread safety is required; otherwise, false.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ImportEngine (System.ComponentModel.Composition.Hosting.ExportProvider sourceProvider, System.ComponentModel.Composition.Hosting.CompositionOptions compositionOptions);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.ComponentModel.Composition.Hosting.ExportProvider sourceProvider, valuetype System.ComponentModel.Composition.Hosting.CompositionOptions compositionOptions) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="sourceProvider" Type="System.ComponentModel.Composition.Hosting.ExportProvider" /> - <Parameter Name="compositionOptions" Type="System.ComponentModel.Composition.Hosting.CompositionOptions" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.ImportEngine" /> class with the specified options.</para> - </summary> - <param name="sourceProvider"> - <attribution license="cc4" from="Microsoft" modified="false" />The <see cref="T:System.ComponentModel.Composition.Hosting.ExportProvider" /> that provides the <see cref="T:System.ComponentModel.Composition.Hosting.ImportEngine" /> access to <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects.</param> - <param name="compositionOptions"> - <attribution license="cc4" from="Microsoft" modified="false" />An object that specifies options that affect the behavior of the engine.</param> - </Docs> - </Member> - <Member MemberName="Dispose"> - <MemberSignature Language="C#" Value="public void Dispose ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Dispose() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Call Dispose when you are finished using the <see cref="T:System.ComponentModel.Composition.Hosting.ImportEngine" />. The Dispose method leaves the <see cref="T:System.ComponentModel.Composition.Hosting.ImportEngine" /> in an unusable state. After calling Dispose, you must release all references to the <see cref="T:System.ComponentModel.Composition.Hosting.ImportEngine" /> so the garbage collector can reclaim the memory that the <see cref="T:System.ComponentModel.Composition.Hosting.ImportEngine" /> was occupying.</para> - <para>For more information, see <format type="text/html"><a href="A17B0066-71C2-4BA4-9822-8E19332FC213">Cleaning Up Unmanaged Resources</a></format> and <format type="text/html"><a href="eb4e1af0-3b48-4fbc-ad4e-fc2f64138bf9">Implementing a Dispose Method</a></format>.</para> - <block subset="none" type="note"> - <para>Always call Dispose before you release your last reference to the <see cref="T:System.ComponentModel.Composition.Hosting.ImportEngine" />. Otherwise, the resources it is using will not be freed until the garbage collector calls the <see cref="T:System.ComponentModel.Composition.Hosting.ImportEngine" /> object's Finalize method.</para> - </block> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Releases all resources used by the current instance of the <see cref="T:System.ComponentModel.Composition.Hosting.ImportEngine" /> class.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Dispose"> - <MemberSignature Language="C#" Value="protected virtual void Dispose (bool disposing);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void Dispose(bool disposing) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="disposing" Type="System.Boolean" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Releases the unmanaged resources used by the <see cref="T:System.ComponentModel.Composition.Hosting.ImportEngine" /> and optionally releases the managed resources. </para> - </summary> - <param name="disposing"> - <attribution license="cc4" from="Microsoft" modified="false" />true to release both managed and unmanaged resources; false to release only unmanaged resources. </param> - </Docs> - </Member> - <Member MemberName="PreviewImports"> - <MemberSignature Language="C#" Value="public void PreviewImports (System.ComponentModel.Composition.Primitives.ComposablePart part, System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void PreviewImports(class System.ComponentModel.Composition.Primitives.ComposablePart part, class System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePart" /> - <Parameter Name="atomicComposition" Type="System.ComponentModel.Composition.Hosting.AtomicComposition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Previews all the required imports for the specified part to make sure that they can be satisfied, without actually setting them.</para> - </summary> - <param name="part"> - <attribution license="cc4" from="Microsoft" modified="false" />The part to preview the imports of.</param> - <param name="atomicComposition"> - <attribution license="cc4" from="Microsoft" modified="false" />The composition transaction to use, or null for no composition transaction.</param> - </Docs> - </Member> - <Member MemberName="ReleaseImports"> - <MemberSignature Language="C#" Value="public void ReleaseImports (System.ComponentModel.Composition.Primitives.ComposablePart part, System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void ReleaseImports(class System.ComponentModel.Composition.Primitives.ComposablePart part, class System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePart" /> - <Parameter Name="atomicComposition" Type="System.ComponentModel.Composition.Hosting.AtomicComposition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Releases all the exports used to satisfy the imports of the specified part.</para> - </summary> - <param name="part"> - <attribution license="cc4" from="Microsoft" modified="false" />The part to release the imports of.</param> - <param name="atomicComposition"> - <attribution license="cc4" from="Microsoft" modified="false" />The composition transaction to use, or null for no composition transaction.</param> - </Docs> - </Member> - <Member MemberName="SatisfyImports"> - <MemberSignature Language="C#" Value="public void SatisfyImports (System.ComponentModel.Composition.Primitives.ComposablePart part);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void SatisfyImports(class System.ComponentModel.Composition.Primitives.ComposablePart part) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePart" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Satisfies the imports of the specified part.</para> - </summary> - <param name="part"> - <attribution license="cc4" from="Microsoft" modified="false" />The part to satisfy the imports of.</param> - </Docs> - </Member> - <Member MemberName="SatisfyImportsOnce"> - <MemberSignature Language="C#" Value="public void SatisfyImportsOnce (System.ComponentModel.Composition.Primitives.ComposablePart part);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void SatisfyImportsOnce(class System.ComponentModel.Composition.Primitives.ComposablePart part) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePart" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Satisfies the imports of the specified part without registering them for recomposition.</para> - </summary> - <param name="part"> - <attribution license="cc4" from="Microsoft" modified="false" />The part to satisfy the imports of.</param> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/ScopingExtensions.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/ScopingExtensions.xml deleted file mode 100644 index 2a3cdbeb43f..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/ScopingExtensions.xml +++ /dev/null @@ -1,203 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ScopingExtensions" FullName="System.ComponentModel.Composition.Hosting.ScopingExtensions"> - <TypeSignature Language="C#" Value="public static class ScopingExtensions" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi abstract sealed beforefieldinit ScopingExtensions extends System.Object" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Object</BaseTypeName> - </Base> - <Interfaces /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Defines static convenience methods for scoping.</para> - </summary> - </Docs> - <Members> - <Member MemberName="ContainsPartMetadata<T>"> - <MemberSignature Language="C#" Value="public static bool ContainsPartMetadata<T> (this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string key, T value);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool ContainsPartMetadata<T>(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string key, !!T value) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" RefType="this" /> - <Parameter Name="key" Type="System.String" /> - <Parameter Name="value" Type="T" /> - </Parameters> - <Docs> - <typeparam name="T">To be added.</typeparam> - <param name="part">To be added.</param> - <param name="key">To be added.</param> - <param name="value">To be added.</param> - <summary>To be added.</summary> - <returns>To be added.</returns> - <remarks>To be added.</remarks> - </Docs> - </Member> - <Member MemberName="ContainsPartMetadataWithKey"> - <MemberSignature Language="C#" Value="public static bool ContainsPartMetadataWithKey (this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string key);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool ContainsPartMetadataWithKey(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string key) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" RefType="this" /> - <Parameter Name="key" Type="System.String" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a value that indicates whether the specified part contains metadata that has the specified key.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>true if <paramref name="part" /> contains metadata that has the specified key; otherwise, false.</para> - </returns> - <param name="part"> - <attribution license="cc4" from="Microsoft" modified="false" />The part to search.</param> - <param name="key"> - <attribution license="cc4" from="Microsoft" modified="false" />The metadata key.</param> - </Docs> - </Member> - <Member MemberName="Exports"> - <MemberSignature Language="C#" Value="public static bool Exports (this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string contractName);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool Exports(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string contractName) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" RefType="this" /> - <Parameter Name="contractName" Type="System.String" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a value that indicates whether the specified part exports the specified contract.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>true if <paramref name="part" /> exports the specified contract; otherwise, false.</para> - </returns> - <param name="part"> - <attribution license="cc4" from="Microsoft" modified="false" />The part to search.</param> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The name of the contract.</param> - </Docs> - </Member> - <Member MemberName="Filter"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Hosting.FilteredCatalog Filter (this System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, Func<System.ComponentModel.Composition.Primitives.ComposablePartDefinition,bool> filter);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Hosting.FilteredCatalog Filter(class System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, class System.Func`2<class System.ComponentModel.Composition.Primitives.ComposablePartDefinition, bool> filter) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Hosting.FilteredCatalog</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="catalog" Type="System.ComponentModel.Composition.Primitives.ComposablePartCatalog" RefType="this" /> - <Parameter Name="filter" Type="System.Func<System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.Boolean>" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Filters the specified catalog with the specified filter function.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A new catalog filtered by using the specified filter.</para> - </returns> - <param name="catalog"> - <attribution license="cc4" from="Microsoft" modified="false" />The catalog to filter.</param> - <param name="filter"> - <attribution license="cc4" from="Microsoft" modified="false" />The filter function.</param> - </Docs> - </Member> - <Member MemberName="Imports"> - <MemberSignature Language="C#" Value="public static bool Imports (this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string contractName);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool Imports(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string contractName) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" RefType="this" /> - <Parameter Name="contractName" Type="System.String" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Determines whether the specified part imports the specified contract.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>true if <paramref name="part" /> imports the specified contract; otherwise, false.</para> - </returns> - <param name="part"> - <attribution license="cc4" from="Microsoft" modified="false" />The part to search.</param> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The name of the contract.</param> - </Docs> - </Member> - <Member MemberName="Imports"> - <MemberSignature Language="C#" Value="public static bool Imports (this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string contractName, System.ComponentModel.Composition.Primitives.ImportCardinality importCardinality);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool Imports(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string contractName, valuetype System.ComponentModel.Composition.Primitives.ImportCardinality importCardinality) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" RefType="this" /> - <Parameter Name="contractName" Type="System.String" /> - <Parameter Name="importCardinality" Type="System.ComponentModel.Composition.Primitives.ImportCardinality" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Determines whether the specified part imports the specified contract with the specified cardinality.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>true if <paramref name="part" /> imports a contract that has the specified name and cardinality; otherwise, false.</para> - </returns> - <param name="part"> - <attribution license="cc4" from="Microsoft" modified="false" />The part to search.</param> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The name of the contract.</param> - <param name="importCardinality"> - <attribution license="cc4" from="Microsoft" modified="false" />The cardinality of the contract.</param> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/TypeCatalog.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/TypeCatalog.xml deleted file mode 100644 index a41e0f93513..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Hosting/TypeCatalog.xml +++ /dev/null @@ -1,265 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="TypeCatalog" FullName="System.ComponentModel.Composition.Hosting.TypeCatalog"> - <TypeSignature Language="C#" Value="public class TypeCatalog : System.ComponentModel.Composition.Primitives.ComposablePartCatalog, System.ComponentModel.Composition.Primitives.ICompositionElement" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit TypeCatalog extends System.ComponentModel.Composition.Primitives.ComposablePartCatalog implements class System.ComponentModel.Composition.Primitives.ICompositionElement" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.ComponentModel.Composition.Primitives.ComposablePartCatalog</BaseTypeName> - </Base> - <Interfaces> - <Interface> - <InterfaceName>System.ComponentModel.Composition.Primitives.ICompositionElement</InterfaceName> - </Interface> - </Interfaces> - <Attributes> - <Attribute> - <AttributeName>System.Diagnostics.DebuggerTypeProxy(typeof(System.ComponentModel.Composition.Primitives.ComposablePartCatalogDebuggerProxy))</AttributeName> - </Attribute> - </Attributes> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This class is thread safe.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Discovers attributed parts from a collection of types.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public TypeCatalog (System.Collections.Generic.IEnumerable<Type> types);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Collections.Generic.IEnumerable`1<class System.Type> types) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="types" Type="System.Collections.Generic.IEnumerable<System.Type>" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.TypeCatalog" /> class with the specified types.</para> - </summary> - <param name="types"> - <attribution license="cc4" from="Microsoft" modified="false" />A collection of attributed <see cref="T:System.Type" /> objects to add to the <see cref="T:System.ComponentModel.Composition.Hosting.TypeCatalog" /> object.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public TypeCatalog (Type[] types);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Type[] types) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="types" Type="System.Type[]"> - <Attributes> - <Attribute> - <AttributeName>System.ParamArray</AttributeName> - </Attribute> - </Attributes> - </Parameter> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.TypeCatalog" /> class with the specified types.</para> - </summary> - <param name="types"> - <attribution license="cc4" from="Microsoft" modified="false" />An array of attributed <see cref="T:System.Type" /> objects to add to the <see cref="T:System.ComponentModel.Composition.Hosting.TypeCatalog" /> object.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public TypeCatalog (System.Collections.Generic.IEnumerable<Type> types, System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Collections.Generic.IEnumerable`1<class System.Type> types, class System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="types" Type="System.Collections.Generic.IEnumerable<System.Type>" /> - <Parameter Name="definitionOrigin" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.TypeCatalog" /> class with the specified types and source for parts.</para> - </summary> - <param name="types"> - <attribution license="cc4" from="Microsoft" modified="false" />A collection of attributed <see cref="T:System.Type" /> objects to add to the <see cref="T:System.ComponentModel.Composition.Hosting.TypeCatalog" /> object.</param> - <param name="definitionOrigin"> - <attribution license="cc4" from="Microsoft" modified="false" />An element used by diagnostics to identify the source for parts.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public TypeCatalog (System.Collections.Generic.IEnumerable<Type> types, System.Reflection.ReflectionContext reflectionContext);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Collections.Generic.IEnumerable`1<class System.Type> types, class System.Reflection.ReflectionContext reflectionContext) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="types" Type="System.Collections.Generic.IEnumerable<System.Type>" /> - <Parameter Name="reflectionContext" Type="System.Reflection.ReflectionContext" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.TypeCatalog" /> class with the specified types in the specified reflection context.</para> - </summary> - <param name="types"> - <attribution license="cc4" from="Microsoft" modified="false" />A collection of attributed <see cref="T:System.Type" /> objects to add to the <see cref="T:System.ComponentModel.Composition.Hosting.TypeCatalog" /> object.</param> - <param name="reflectionContext"> - <attribution license="cc4" from="Microsoft" modified="false" />The context used to interpret the types.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public TypeCatalog (System.Collections.Generic.IEnumerable<Type> types, System.Reflection.ReflectionContext reflectionContext, System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Collections.Generic.IEnumerable`1<class System.Type> types, class System.Reflection.ReflectionContext reflectionContext, class System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="types" Type="System.Collections.Generic.IEnumerable<System.Type>" /> - <Parameter Name="reflectionContext" Type="System.Reflection.ReflectionContext" /> - <Parameter Name="definitionOrigin" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.TypeCatalog" /> class with the specified types in the specified reflection context and source for parts.</para> - </summary> - <param name="types"> - <attribution license="cc4" from="Microsoft" modified="false" />A collection of attributed <see cref="T:System.Type" /> objects to add to the <see cref="T:System.ComponentModel.Composition.Hosting.TypeCatalog" /> object.</param> - <param name="reflectionContext"> - <attribution license="cc4" from="Microsoft" modified="false" />The context used to interpret the types.</param> - <param name="definitionOrigin"> - <attribution license="cc4" from="Microsoft" modified="false" />An element used by diagnostics to identify the source for parts.</param> - </Docs> - </Member> - <Member MemberName="Dispose"> - <MemberSignature Language="C#" Value="protected override void Dispose (bool disposing);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void Dispose(bool disposing) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="disposing" Type="System.Boolean" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Releases the unmanaged resources used by the <see cref="T:System.ComponentModel.Composition.Hosting.TypeCatalog" /> and optionally releases the managed resources. </para> - </summary> - <param name="disposing"> - <attribution license="cc4" from="Microsoft" modified="false" />true to release both managed and unmanaged resources; false to release only unmanaged resources. </param> - </Docs> - </Member> - <Member MemberName="GetEnumerator"> - <MemberSignature Language="C#" Value="public override System.Collections.Generic.IEnumerator<System.ComponentModel.Composition.Primitives.ComposablePartDefinition> GetEnumerator ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance class System.Collections.Generic.IEnumerator`1<class System.ComponentModel.Composition.Primitives.ComposablePartDefinition> GetEnumerator() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerator<System.ComponentModel.Composition.Primitives.ComposablePartDefinition></ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns an enumerator that iterates through the catalog.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>An enumerator that can be used to iterate through the catalog.</para> - </returns> - </Docs> - </Member> - <Member MemberName="System.ComponentModel.Composition.Primitives.ICompositionElement.DisplayName"> - <MemberSignature Language="C#" Value="string System.ComponentModel.Composition.Primitives.ICompositionElement.DisplayName { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance string System.ComponentModel.Composition.Primitives.ICompositionElement.DisplayName" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This member is an explicit interface member implementation. It can be used only when the <see cref="T:System.ComponentModel.Composition.Hosting.TypeCatalog" /> instance is cast to an <see cref="T:System.ComponentModel.Composition.Primitives.ICompositionElement" /> interface.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the display name of the type catalog.</para> - </summary> - </Docs> - </Member> - <Member MemberName="System.ComponentModel.Composition.Primitives.ICompositionElement.Origin"> - <MemberSignature Language="C#" Value="System.ComponentModel.Composition.Primitives.ICompositionElement System.ComponentModel.Composition.Primitives.ICompositionElement.Origin { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.ComponentModel.Composition.Primitives.ICompositionElement System.ComponentModel.Composition.Primitives.ICompositionElement.Origin" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ICompositionElement</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This member is an explicit interface member implementation. It can be used only when the <see cref="T:System.ComponentModel.Composition.Hosting.TypeCatalog" /> instance is cast to an <see cref="T:System.ComponentModel.Composition.Primitives.ICompositionElement" /> interface.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the composition element from which the type catalog originated.</para> - </summary> - </Docs> - </Member> - <Member MemberName="ToString"> - <MemberSignature Language="C#" Value="public override string ToString ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance string ToString() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns a string representation of the type catalog.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A string representation of the type catalog.</para> - </returns> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ComposablePart.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ComposablePart.xml deleted file mode 100644 index 5ff46c2e5fc..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ComposablePart.xml +++ /dev/null @@ -1,182 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ComposablePart" FullName="System.ComponentModel.Composition.Primitives.ComposablePart"> - <TypeSignature Language="C#" Value="public abstract class ComposablePart" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi abstract beforefieldinit ComposablePart extends System.Object" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Object</BaseTypeName> - </Base> - <Interfaces /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Defines the abstract base class for composable parts, which import objects and produce exported objects.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="protected ComposablePart ();" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> class.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Activate"> - <MemberSignature Language="C#" Value="public virtual void Activate ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Activate() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Once this method is called, no further imports can be set unless a call is made to Deactivate.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Called when all the imports of the part have been set, and exports can be retrieved.</para> - </summary> - </Docs> - </Member> - <Member MemberName="ExportDefinitions"> - <MemberSignature Language="C#" Value="public abstract System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ExportDefinition> ExportDefinitions { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.ExportDefinition> ExportDefinitions" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ExportDefinition></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>If the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> object was created from a <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> object, this property should return the result of <see cref="P:System.ComponentModel.Composition.Primitives.ComposablePartDefinition.ExportDefinitions" />.</para> - <para>Overrides of this property should never return null. If the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> does not have exports, return an empty <see cref="T:System.Collections.Generic.IEnumerable`1" /> collection instead.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a collection of the <see cref="T:System.ComponentModel.Composition.Primitives.ExportDefinition" /> objects that describe the exported objects provided by the part.</para> - </summary> - </Docs> - </Member> - <Member MemberName="GetExportedValue"> - <MemberSignature Language="C#" Value="public abstract object GetExportedValue (System.ComponentModel.Composition.Primitives.ExportDefinition definition);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance object GetExportedValue(class System.ComponentModel.Composition.Primitives.ExportDefinition definition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Object</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="definition" Type="System.ComponentModel.Composition.Primitives.ExportDefinition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the exported object described by the specified <see cref="T:System.ComponentModel.Composition.Primitives.ExportDefinition" /> object.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The exported object described by <paramref name="definition" />.</para> - </returns> - <param name="definition"> - <attribution license="cc4" from="Microsoft" modified="false" />One of the <see cref="T:System.ComponentModel.Composition.Primitives.ExportDefinition" /> objects from the <see cref="P:System.ComponentModel.Composition.Primitives.ComposablePart.ExportDefinitions" /> property that describes the exported object to return.</param> - </Docs> - </Member> - <Member MemberName="ImportDefinitions"> - <MemberSignature Language="C#" Value="public abstract System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ImportDefinition> ImportDefinitions { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.ImportDefinition> ImportDefinitions" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ImportDefinition></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>If the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> object was created from a <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> object, this property should return the result of <see cref="P:System.ComponentModel.Composition.Primitives.ComposablePartDefinition.ImportDefinitions" />.</para> - <para>Overrides of this property should never return null. If the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> does not have imports, return an empty <see cref="T:System.Collections.Generic.IEnumerable`1" /> collection instead.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a collection of the <see cref="T:System.ComponentModel.Composition.Primitives.ImportDefinition" /> objects that describe the imported objects required by the part.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Metadata"> - <MemberSignature Language="C#" Value="public virtual System.Collections.Generic.IDictionary<string,object> Metadata { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IDictionary`2<string, object> Metadata" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IDictionary<System.String,System.Object></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>If the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> object was created from a <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> object, this property should return the result of <see cref="P:System.ComponentModel.Composition.Primitives.ComposablePartDefinition.Metadata" />.</para> - <para>Overrides of this property should return a read-only <see cref="T:System.Collections.Generic.IDictionary`2" /> object with a case-sensitive, non-linguistic comparer, such as <see cref="P:System.StringComparer.Ordinal" />, and should never return null. If the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> does not contain metadata, return an empty <see cref="T:System.Collections.Generic.IDictionary`2" /> instead.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the metadata of the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> object.</para> - </summary> - </Docs> - </Member> - <Member MemberName="SetImport"> - <MemberSignature Language="C#" Value="public abstract void SetImport (System.ComponentModel.Composition.Primitives.ImportDefinition definition, System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.Export> exports);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void SetImport(class System.ComponentModel.Composition.Primitives.ImportDefinition definition, class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.Export> exports) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="definition" Type="System.ComponentModel.Composition.Primitives.ImportDefinition" /> - <Parameter Name="exports" Type="System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.Export>" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Sets the import described by the specified <see cref="T:System.ComponentModel.Composition.Primitives.ImportDefinition" /> object to be satisfied by the specified exports.</para> - </summary> - <param name="definition"> - <attribution license="cc4" from="Microsoft" modified="false" />One of the objects from the <see cref="P:System.ComponentModel.Composition.Primitives.ComposablePart.ImportDefinitions" /> property that specifies the import to be set.</param> - <param name="exports"> - <attribution license="cc4" from="Microsoft" modified="false" />A collection of <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects of which to set the import described by <paramref name="definition" />.</param> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ComposablePartCatalog.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ComposablePartCatalog.xml deleted file mode 100644 index f127d93bbed..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ComposablePartCatalog.xml +++ /dev/null @@ -1,208 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ComposablePartCatalog" FullName="System.ComponentModel.Composition.Primitives.ComposablePartCatalog"> - <TypeSignature Language="C#" Value="public abstract class ComposablePartCatalog : IDisposable, System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ComposablePartDefinition>" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi abstract beforefieldinit ComposablePartCatalog extends System.Object implements class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.ComposablePartDefinition>, class System.Collections.IEnumerable, class System.IDisposable" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Object</BaseTypeName> - </Base> - <Interfaces> - <Interface> - <InterfaceName>System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ComposablePartDefinition></InterfaceName> - </Interface> - <Interface> - <InterfaceName>System.IDisposable</InterfaceName> - </Interface> - </Interfaces> - <Attributes> - <Attribute> - <AttributeName>System.Diagnostics.DebuggerTypeProxy(typeof(System.ComponentModel.Composition.Primitives.ComposablePartCatalogDebuggerProxy))</AttributeName> - </Attribute> - </Attributes> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This type is thread safe.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Represents the abstract base class for composable part catalogs, which collect and return <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> objects.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="protected ComposablePartCatalog ();" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> class.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Dispose"> - <MemberSignature Language="C#" Value="public void Dispose ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Dispose() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Call Dispose when you are finished using the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartCatalog" />. The Dispose method leaves the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> in an unusable state. After calling Dispose, you must release all references to the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> so the garbage collector can reclaim the memory that the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> was occupying.</para> - <para>For more information, see <format type="text/html"><a href="A17B0066-71C2-4BA4-9822-8E19332FC213">Cleaning Up Unmanaged Resources</a></format> and <format type="text/html"><a href="eb4e1af0-3b48-4fbc-ad4e-fc2f64138bf9">Implementing a Dispose Method</a></format>.</para> - <block subset="none" type="note"> - <para>Always call Dispose before you release your last reference to the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartCatalog" />. Otherwise, the resources it is using will not be freed until the garbage collector calls the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> object's Finalize method.</para> - </block> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Releases all resources used by the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartCatalog" />.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Dispose"> - <MemberSignature Language="C#" Value="protected virtual void Dispose (bool disposing);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void Dispose(bool disposing) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="disposing" Type="System.Boolean" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Releases the unmanaged resources used by the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> and optionally releases the managed resources. </para> - </summary> - <param name="disposing"> - <attribution license="cc4" from="Microsoft" modified="false" />true to release both managed and unmanaged resources; false to release only unmanaged resources. </param> - </Docs> - </Member> - <Member MemberName="GetEnumerator"> - <MemberSignature Language="C#" Value="public virtual System.Collections.Generic.IEnumerator<System.ComponentModel.Composition.Primitives.ComposablePartDefinition> GetEnumerator ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Collections.Generic.IEnumerator`1<class System.ComponentModel.Composition.Primitives.ComposablePartDefinition> GetEnumerator() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerator<System.ComponentModel.Composition.Primitives.ComposablePartDefinition></ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns an enumerator that iterates through the catalog.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>An enumerator that can be used to iterate through the catalog.</para> - </returns> - </Docs> - </Member> - <Member MemberName="GetExports"> - <MemberSignature Language="C#" Value="public virtual System.Collections.Generic.IEnumerable<Tuple<System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.ComponentModel.Composition.Primitives.ExportDefinition>> GetExports (System.ComponentModel.Composition.Primitives.ImportDefinition definition);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Collections.Generic.IEnumerable`1<class System.Tuple`2<class System.ComponentModel.Composition.Primitives.ComposablePartDefinition, class System.ComponentModel.Composition.Primitives.ExportDefinition>> GetExports(class System.ComponentModel.Composition.Primitives.ImportDefinition definition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.Tuple<System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.ComponentModel.Composition.Primitives.ExportDefinition>></ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="definition" Type="System.ComponentModel.Composition.Primitives.ImportDefinition" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Overrides of this method should never return null. If no <see cref="T:System.ComponentModel.Composition.Primitives.ExportDefinition" /> matches the conditions defined by <paramref name="definition" />, return an empty <see cref="T:System.Collections.Generic.IEnumerable`1" /> object.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a list of export definitions that match the constraint defined by the specified <see cref="T:System.ComponentModel.Composition.Primitives.ImportDefinition" /> object.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A collection of <see cref="T:System.Tuple`2" /> containing the <see cref="T:System.ComponentModel.Composition.Primitives.ExportDefinition" /> objects and their associated <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> objects for objects that match the constraint specified by <paramref name="definition" />.</para> - </returns> - <param name="definition"> - <attribution license="cc4" from="Microsoft" modified="false" />The conditions of the <see cref="T:System.ComponentModel.Composition.Primitives.ExportDefinition" /> objects to be returned.</param> - </Docs> - </Member> - <Member MemberName="Parts"> - <MemberSignature Language="C#" Value="public virtual System.Linq.IQueryable<System.ComponentModel.Composition.Primitives.ComposablePartDefinition> Parts { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Linq.IQueryable`1<class System.ComponentModel.Composition.Primitives.ComposablePartDefinition> Parts" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Attributes> - <Attribute> - <AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)</AttributeName> - </Attribute> - </Attributes> - <ReturnValue> - <ReturnType>System.Linq.IQueryable<System.ComponentModel.Composition.Primitives.ComposablePartDefinition></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Overrides of this property should never return null.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the part definitions that are contained in the catalog.</para> - </summary> - </Docs> - </Member> - <Member MemberName="System.Collections.IEnumerable.GetEnumerator"> - <MemberSignature Language="C#" Value="System.Collections.IEnumerator IEnumerable.GetEnumerator ();" /> - <MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance class System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.IEnumerator</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This member is an explicit interface member implementation. It can be used only when the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> instance is cast to an <see cref="T:System.Collections.IEnumerable" /> interface.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns an enumerator that iterates through the catalog.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>An enumerator that can be used to iterate through the catalog.</para> - </returns> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ComposablePartDefinition.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ComposablePartDefinition.xml deleted file mode 100644 index 97b9ceb9c04..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ComposablePartDefinition.xml +++ /dev/null @@ -1,130 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ComposablePartDefinition" FullName="System.ComponentModel.Composition.Primitives.ComposablePartDefinition"> - <TypeSignature Language="C#" Value="public abstract class ComposablePartDefinition" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi abstract beforefieldinit ComposablePartDefinition extends System.Object" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Object</BaseTypeName> - </Base> - <Interfaces /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Defines an abstract base class for composable part definitions, which describe and enable the creation of <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> objects.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="protected ComposablePartDefinition ();" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> class.</para> - </summary> - </Docs> - </Member> - <Member MemberName="CreatePart"> - <MemberSignature Language="C#" Value="public abstract System.ComponentModel.Composition.Primitives.ComposablePart CreatePart ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.ComponentModel.Composition.Primitives.ComposablePart CreatePart() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ComposablePart</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Derived types that override this method should return a new instance of a <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> object every time that the method is invoked and should never return null.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Creates a new instance of a part that the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> describes.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The created part.</para> - </returns> - </Docs> - </Member> - <Member MemberName="ExportDefinitions"> - <MemberSignature Language="C#" Value="public abstract System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ExportDefinition> ExportDefinitions { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.ExportDefinition> ExportDefinitions" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ExportDefinition></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Overrides of this property should never return null. If the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> objects created by the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> do not provide exported objects, return an empty <see cref="T:System.Collections.Generic.IEnumerable`1" /> collection instead.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a collection of <see cref="T:System.ComponentModel.Composition.Primitives.ExportDefinition" /> objects that describe the objects exported by the part defined by this <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> object.</para> - </summary> - </Docs> - </Member> - <Member MemberName="ImportDefinitions"> - <MemberSignature Language="C#" Value="public abstract System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ImportDefinition> ImportDefinitions { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.ImportDefinition> ImportDefinitions" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ImportDefinition></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Overrides of this property should never return null. If the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> objects created by the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> do not have imports, return an empty <see cref="T:System.Collections.Generic.IEnumerable`1" /> collection instead.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a collection of <see cref="T:System.ComponentModel.Composition.Primitives.ImportDefinition" /> objects that describe the imports required by the part defined by this <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> object.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Metadata"> - <MemberSignature Language="C#" Value="public virtual System.Collections.Generic.IDictionary<string,object> Metadata { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IDictionary`2<string, object> Metadata" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IDictionary<System.String,System.Object></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Overrides of this property should return a read-only <see cref="T:System.Collections.Generic.IDictionary`2" /> object with a case-sensitive, non-linguistic comparer, such as <see cref="P:System.StringComparer.Ordinal" />, and should never return null. If the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> does not contain metadata, return an empty <see cref="T:System.Collections.Generic.IDictionary`2" /> object instead.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a collection of the metadata for this <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> object.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ComposablePartException.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ComposablePartException.xml deleted file mode 100644 index e0924e9db55..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ComposablePartException.xml +++ /dev/null @@ -1,216 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ComposablePartException" FullName="System.ComponentModel.Composition.Primitives.ComposablePartException"> - <TypeSignature Language="C#" Value="public class ComposablePartException : Exception" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi serializable beforefieldinit ComposablePartException extends System.Exception" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Exception</BaseTypeName> - </Base> - <Interfaces /> - <Attributes> - <Attribute> - <AttributeName>System.Diagnostics.DebuggerDisplay("{Message}")</AttributeName> - </Attribute> - <Attribute> - <AttributeName>System.Diagnostics.DebuggerTypeProxy(typeof(System.ComponentModel.Composition.Primitives.ComposablePartExceptionDebuggerProxy))</AttributeName> - </Attribute> - </Attributes> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The exception that is thrown when an error occurs when calling methods on a <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> object.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ComposablePartException ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartException" /> class.</para> - </summary> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ComposablePartException (string message);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string message) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="message" Type="System.String" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartException" /> class with the specified error message.</para> - </summary> - <param name="message"> - <attribution license="cc4" from="Microsoft" modified="false" />A message that describes the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartException" />, or null to set the <see cref="P:System.Exception.Message" /> property to its default value.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="protected ComposablePartException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor(class System.Runtime.Serialization.SerializationInfo info, valuetype System.Runtime.Serialization.StreamingContext context) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Attributes> - <Attribute> - <AttributeName>System.Security.SecuritySafeCritical</AttributeName> - </Attribute> - </Attributes> - <Parameters> - <Parameter Name="info" Type="System.Runtime.Serialization.SerializationInfo" /> - <Parameter Name="context" Type="System.Runtime.Serialization.StreamingContext" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartException" /> class with the specified serialization data.</para> - </summary> - <param name="info"> - <attribution license="cc4" from="Microsoft" modified="false" />An object that holds the serialized object data for the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartException" />.</param> - <param name="context"> - <attribution license="cc4" from="Microsoft" modified="false" />An object that contains contextual information about the source or destination.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ComposablePartException (string message, System.ComponentModel.Composition.Primitives.ICompositionElement element);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string message, class System.ComponentModel.Composition.Primitives.ICompositionElement element) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="message" Type="System.String" /> - <Parameter Name="element" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartException" /> class with the specified error message and the composition element that is the cause of the exception.</para> - </summary> - <param name="message"> - <attribution license="cc4" from="Microsoft" modified="false" />A message that describes the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartException" />, or null to set the <see cref="P:System.Exception.Message" /> property to its default value.</param> - <param name="element"> - <attribution license="cc4" from="Microsoft" modified="false" />The composition element that is the cause of the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartException" />, or null to set the <see cref="P:System.ComponentModel.Composition.Primitives.ComposablePartException.Element" /> property to null.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ComposablePartException (string message, Exception innerException);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string message, class System.Exception innerException) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="message" Type="System.String" /> - <Parameter Name="innerException" Type="System.Exception" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartException" /> class with the specified error message and the exception that is the cause of this exception.</para> - </summary> - <param name="message"> - <attribution license="cc4" from="Microsoft" modified="false" />A message that describes the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartException" />, or null to set the <see cref="P:System.Exception.Message" /> property to its default value.</param> - <param name="innerException"> - <attribution license="cc4" from="Microsoft" modified="false" />The exception that is the underlying cause of the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartException" />, or null to set the <see cref="P:System.Exception.InnerException" /> property to null.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ComposablePartException (string message, System.ComponentModel.Composition.Primitives.ICompositionElement element, Exception innerException);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string message, class System.ComponentModel.Composition.Primitives.ICompositionElement element, class System.Exception innerException) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="message" Type="System.String" /> - <Parameter Name="element" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - <Parameter Name="innerException" Type="System.Exception" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartException" /> class with the specified error message, and the composition element and exception that are the cause of this exception.</para> - </summary> - <param name="message"> - <attribution license="cc4" from="Microsoft" modified="false" />A message that describes the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartException" />, or null to set the <see cref="P:System.Exception.Message" /> property to its default value.</param> - <param name="element"> - <attribution license="cc4" from="Microsoft" modified="false" />The composition element that is the cause of the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartException" />, or null to set the <see cref="P:System.ComponentModel.Composition.Primitives.ComposablePartException.Element" /> property to null.</param> - <param name="innerException"> - <attribution license="cc4" from="Microsoft" modified="false" />The exception that is the underlying cause of the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartException" />, or null to set the <see cref="P:System.Exception.InnerException" /> property to null.</param> - </Docs> - </Member> - <Member MemberName="Element"> - <MemberSignature Language="C#" Value="public System.ComponentModel.Composition.Primitives.ICompositionElement Element { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.ComponentModel.Composition.Primitives.ICompositionElement Element" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ICompositionElement</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the composition element that is the cause of the exception.</para> - </summary> - </Docs> - </Member> - <Member MemberName="GetObjectData"> - <MemberSignature Language="C#" Value="public override void GetObjectData (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance void GetObjectData(class System.Runtime.Serialization.SerializationInfo info, valuetype System.Runtime.Serialization.StreamingContext context) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Attributes> - <Attribute> - <AttributeName>System.Security.SecurityCritical</AttributeName> - </Attribute> - </Attributes> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="info" Type="System.Runtime.Serialization.SerializationInfo" /> - <Parameter Name="context" Type="System.Runtime.Serialization.StreamingContext" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the serialization data for the exception.</para> - </summary> - <param name="info"> - <attribution license="cc4" from="Microsoft" modified="false" />After calling the method, contains serialized object data about the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartException" />.</param> - <param name="context"> - <attribution license="cc4" from="Microsoft" modified="false" />After calling the method, contains contextual information about the source or destination.</param> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ContractBasedImportDefinition.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ContractBasedImportDefinition.xml deleted file mode 100644 index 10b6e3e57fe..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ContractBasedImportDefinition.xml +++ /dev/null @@ -1,243 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ContractBasedImportDefinition" FullName="System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition"> - <TypeSignature Language="C#" Value="public class ContractBasedImportDefinition : System.ComponentModel.Composition.Primitives.ImportDefinition" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit ContractBasedImportDefinition extends System.ComponentModel.Composition.Primitives.ImportDefinition" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.ComponentModel.Composition.Primitives.ImportDefinition</BaseTypeName> - </Base> - <Interfaces /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Represents an import that is required by a <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> object and that can specify both a contract name and metadata.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="protected ContractBasedImportDefinition ();" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition" /> class.</para> - </summary> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ContractBasedImportDefinition (string contractName, string requiredTypeIdentity, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,Type>> requiredMetadata, System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite, System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string contractName, string requiredTypeIdentity, class System.Collections.Generic.IEnumerable`1<valuetype System.Collections.Generic.KeyValuePair`2<string, class System.Type>> requiredMetadata, valuetype System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite, valuetype System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="contractName" Type="System.String" /> - <Parameter Name="requiredTypeIdentity" Type="System.String" /> - <Parameter Name="requiredMetadata" Type="System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String,System.Type>>" /> - <Parameter Name="cardinality" Type="System.ComponentModel.Composition.Primitives.ImportCardinality" /> - <Parameter Name="isRecomposable" Type="System.Boolean" /> - <Parameter Name="isPrerequisite" Type="System.Boolean" /> - <Parameter Name="requiredCreationPolicy" Type="System.ComponentModel.Composition.CreationPolicy" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition" /> class with the specified contract name, required type identity, required metadata, cardinality, and creation policy, and indicates whether the import definition is recomposable or a prerequisite.</para> - </summary> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> object required by the import definition.</param> - <param name="requiredTypeIdentity"> - <attribution license="cc4" from="Microsoft" modified="false" />The type identity of the export type expected. Use the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetTypeIdentity(System.Type)" /> method to generate a type identity for a given type. If no specific type is required, use null.</param> - <param name="requiredMetadata"> - <attribution license="cc4" from="Microsoft" modified="false" />A collection of key/value pairs that contain the metadata names and types required by the import definition; or null to set the <see cref="P:System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition.RequiredMetadata" /> property to an empty <see cref="T:System.Collections.Generic.IEnumerable`1" /> collection.</param> - <param name="cardinality"> - <attribution license="cc4" from="Microsoft" modified="false" />One of the enumeration values that indicates the cardinality of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects required by the import definition.</param> - <param name="isRecomposable"> - <attribution license="cc4" from="Microsoft" modified="false" />true to specify that the import definition can be satisfied multiple times throughout the lifetime of a <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" />; otherwise, false.</param> - <param name="isPrerequisite"> - <attribution license="cc4" from="Microsoft" modified="false" />true to specify that the import definition is required to be satisfied before a <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> can start producing exported objects; otherwise, false.</param> - <param name="requiredCreationPolicy"> - <attribution license="cc4" from="Microsoft" modified="false" />A value that indicates that the importer requires a specific creation policy for the exports used to satisfy this import. If no specific creation policy is needed, the default is <see cref="F:System.ComponentModel.Composition.CreationPolicy.Any" />.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ContractBasedImportDefinition (string contractName, string requiredTypeIdentity, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,Type>> requiredMetadata, System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite, System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy, System.Collections.Generic.IDictionary<string,object> metadata);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string contractName, string requiredTypeIdentity, class System.Collections.Generic.IEnumerable`1<valuetype System.Collections.Generic.KeyValuePair`2<string, class System.Type>> requiredMetadata, valuetype System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite, valuetype System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy, class System.Collections.Generic.IDictionary`2<string, object> metadata) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="contractName" Type="System.String" /> - <Parameter Name="requiredTypeIdentity" Type="System.String" /> - <Parameter Name="requiredMetadata" Type="System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String,System.Type>>" /> - <Parameter Name="cardinality" Type="System.ComponentModel.Composition.Primitives.ImportCardinality" /> - <Parameter Name="isRecomposable" Type="System.Boolean" /> - <Parameter Name="isPrerequisite" Type="System.Boolean" /> - <Parameter Name="requiredCreationPolicy" Type="System.ComponentModel.Composition.CreationPolicy" /> - <Parameter Name="metadata" Type="System.Collections.Generic.IDictionary<System.String,System.Object>" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition" /> class with the specified contract name, required type identity, required and optional metadata, cardinality, and creation policy, and indicates whether the import definition is recomposable or a prerequisite.</para> - </summary> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> object required by the import definition.</param> - <param name="requiredTypeIdentity"> - <attribution license="cc4" from="Microsoft" modified="false" />The type identity of the export type expected. Use the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetTypeIdentity(System.Type)" /> method to generate a type identity for a given type. If no specific type is required, use null.</param> - <param name="requiredMetadata"> - <attribution license="cc4" from="Microsoft" modified="false" />A collection of key/value pairs that contain the metadata names and types required by the import definition; or null to set the <see cref="P:System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition.RequiredMetadata" /> property to an empty <see cref="T:System.Collections.Generic.IEnumerable`1" /> collection.</param> - <param name="cardinality"> - <attribution license="cc4" from="Microsoft" modified="false" />One of the enumeration values that indicates the cardinality of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects required by the import definition.</param> - <param name="isRecomposable"> - <attribution license="cc4" from="Microsoft" modified="false" />true to specify that the import definition can be satisfied multiple times throughout the lifetime of a <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" />; otherwise, false.</param> - <param name="isPrerequisite"> - <attribution license="cc4" from="Microsoft" modified="false" />true to specify that the import definition is required to be satisfied before a <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> can start producing exported objects; otherwise, false.</param> - <param name="requiredCreationPolicy"> - <attribution license="cc4" from="Microsoft" modified="false" />A value that indicates that the importer requires a specific creation policy for the exports used to satisfy this import. If no specific creation policy is needed, the default is <see cref="F:System.ComponentModel.Composition.CreationPolicy.Any" />.</param> - <param name="metadata"> - <attribution license="cc4" from="Microsoft" modified="false" />The metadata associated with this import.</param> - </Docs> - </Member> - <Member MemberName="Constraint"> - <MemberSignature Language="C#" Value="public override System.Linq.Expressions.Expression<Func<System.ComponentModel.Composition.Primitives.ExportDefinition,bool>> Constraint { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Linq.Expressions.Expression`1<class System.Func`2<class System.ComponentModel.Composition.Primitives.ExportDefinition, bool>> Constraint" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Linq.Expressions.Expression<System.Func<System.ComponentModel.Composition.Primitives.ExportDefinition,System.Boolean>></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets an expression that defines conditions that must be matched to satisfy the import described by this import definition.</para> - </summary> - </Docs> - </Member> - <Member MemberName="IsConstraintSatisfiedBy"> - <MemberSignature Language="C#" Value="public override bool IsConstraintSatisfiedBy (System.ComponentModel.Composition.Primitives.ExportDefinition exportDefinition);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance bool IsConstraintSatisfiedBy(class System.ComponentModel.Composition.Primitives.ExportDefinition exportDefinition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="exportDefinition" Type="System.ComponentModel.Composition.Primitives.ExportDefinition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns a value indicating whether the constraint represented by this object is satisfied by the export represented by the given export definition.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>true if the constraint is satisfied; otherwise, false.</para> - </returns> - <param name="exportDefinition"> - <attribution license="cc4" from="Microsoft" modified="false" />The export definition to test.</param> - </Docs> - </Member> - <Member MemberName="RequiredCreationPolicy"> - <MemberSignature Language="C#" Value="public virtual System.ComponentModel.Composition.CreationPolicy RequiredCreationPolicy { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance valuetype System.ComponentModel.Composition.CreationPolicy RequiredCreationPolicy" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.CreationPolicy</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets or sets a value that indicates that the importer requires a specific <see cref="T:System.ComponentModel.Composition.CreationPolicy" /> for the exports used to satisfy this import. </para> - </summary> - </Docs> - </Member> - <Member MemberName="RequiredMetadata"> - <MemberSignature Language="C#" Value="public virtual System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,Type>> RequiredMetadata { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IEnumerable`1<valuetype System.Collections.Generic.KeyValuePair`2<string, class System.Type>> RequiredMetadata" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String,System.Type>></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Overrides of this property should never return null or return an <see cref="T:System.Collections.Generic.IEnumerable`1" /> collection that contains an element that is null. If the definition does not contain required metadata, return an empty <see cref="T:System.Collections.Generic.IEnumerable`1" /> collection instead.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the metadata names of the export required by the import definition.</para> - </summary> - </Docs> - </Member> - <Member MemberName="RequiredTypeIdentity"> - <MemberSignature Language="C#" Value="public virtual string RequiredTypeIdentity { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance string RequiredTypeIdentity" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the expected type of the export that matches this <see cref="T:System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition" />.</para> - </summary> - </Docs> - </Member> - <Member MemberName="ToString"> - <MemberSignature Language="C#" Value="public override string ToString ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance string ToString() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <summary>To be added.</summary> - <remarks>To be added.</remarks> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns <see cref="T:System.String" />.</para> - </returns> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/Export.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/Export.xml deleted file mode 100644 index b76750e5ec0..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/Export.xml +++ /dev/null @@ -1,199 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="Export" FullName="System.ComponentModel.Composition.Primitives.Export"> - <TypeSignature Language="C#" Value="public class Export" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit Export extends System.Object" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Object</BaseTypeName> - </Base> - <Interfaces /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Represents an export, which is a type that consists of a delay-created exported object and the metadata that describes that object.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="protected Export ();" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Derived types that call this constructor must override the <see cref="P:System.ComponentModel.Composition.Primitives.Export.Definition" /> property and the <see cref="M:System.ComponentModel.Composition.Primitives.Export.GetExportedValueCore" /> method.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> class.</para> - </summary> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public Export (System.ComponentModel.Composition.Primitives.ExportDefinition definition, Func<object> exportedValueGetter);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.ComponentModel.Composition.Primitives.ExportDefinition definition, class System.Func`1<object> exportedValueGetter) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="definition" Type="System.ComponentModel.Composition.Primitives.ExportDefinition" /> - <Parameter Name="exportedValueGetter" Type="System.Func<System.Object>" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> class with the specified export definition and exported object getter.</para> - </summary> - <param name="definition"> - <attribution license="cc4" from="Microsoft" modified="false" />An object that describes the contract that the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> object satisfies.</param> - <param name="exportedValueGetter"> - <attribution license="cc4" from="Microsoft" modified="false" />A method that is called to create the exported object of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" />. This delays the creation of the object until the <see cref="P:System.ComponentModel.Composition.Primitives.Export.Value" /> property is called. </param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public Export (string contractName, Func<object> exportedValueGetter);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string contractName, class System.Func`1<object> exportedValueGetter) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="contractName" Type="System.String" /> - <Parameter Name="exportedValueGetter" Type="System.Func<System.Object>" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> class with the specified contract name and exported value getter.</para> - </summary> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> object.</param> - <param name="exportedValueGetter"> - <attribution license="cc4" from="Microsoft" modified="false" />A method that is called to create the exported object of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" />. This delays the creation of the object until the <see cref="P:System.ComponentModel.Composition.Primitives.Export.Value" /> method is called.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public Export (string contractName, System.Collections.Generic.IDictionary<string,object> metadata, Func<object> exportedValueGetter);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string contractName, class System.Collections.Generic.IDictionary`2<string, object> metadata, class System.Func`1<object> exportedValueGetter) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="contractName" Type="System.String" /> - <Parameter Name="metadata" Type="System.Collections.Generic.IDictionary<System.String,System.Object>" /> - <Parameter Name="exportedValueGetter" Type="System.Func<System.Object>" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> class with the specified contract name, metadata, and exported value getter.</para> - </summary> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> object.</param> - <param name="metadata"> - <attribution license="cc4" from="Microsoft" modified="false" />The metadata of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> object or null to set the <see cref="P:System.ComponentModel.Composition.Primitives.Export.Metadata" /> property to an empty, read-only <see cref="T:System.Collections.Generic.IDictionary`2" /> object.</param> - <param name="exportedValueGetter"> - <attribution license="cc4" from="Microsoft" modified="false" />A method that is called to create the exported object of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" />. This delays the creation of the object until the <see cref="P:System.ComponentModel.Composition.Primitives.Export.Value" /> method is called.</param> - </Docs> - </Member> - <Member MemberName="Definition"> - <MemberSignature Language="C#" Value="public virtual System.ComponentModel.Composition.Primitives.ExportDefinition Definition { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.ComponentModel.Composition.Primitives.ExportDefinition Definition" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ExportDefinition</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Overrides of this property should never return null.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the definition that describes the contract that the export satisfies.</para> - </summary> - </Docs> - </Member> - <Member MemberName="GetExportedValueCore"> - <MemberSignature Language="C#" Value="protected virtual object GetExportedValueCore ();" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance object GetExportedValueCore() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Object</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns the exported object the export provides.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The exported object the export provides.</para> - </returns> - </Docs> - </Member> - <Member MemberName="Metadata"> - <MemberSignature Language="C#" Value="public System.Collections.Generic.IDictionary<string,object> Metadata { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IDictionary`2<string, object> Metadata" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IDictionary<System.String,System.Object></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This property returns the value of <see cref="P:System.ComponentModel.Composition.Primitives.ExportDefinition.Metadata" /> of the <see cref="P:System.ComponentModel.Composition.Primitives.Export.Definition" /> property.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the metadata for the export.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Value"> - <MemberSignature Language="C#" Value="public object Value { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance object Value" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Object</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Provides the object this export represents.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ExportDefinition.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ExportDefinition.xml deleted file mode 100644 index 33b735e3a46..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ExportDefinition.xml +++ /dev/null @@ -1,132 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ExportDefinition" FullName="System.ComponentModel.Composition.Primitives.ExportDefinition"> - <TypeSignature Language="C#" Value="public class ExportDefinition" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit ExportDefinition extends System.Object" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Object</BaseTypeName> - </Base> - <Interfaces /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Describes the contract that a particular <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> object satisfies.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="protected ExportDefinition ();" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Derived types that call this constructor must override the <see cref="P:System.ComponentModel.Composition.Primitives.ExportDefinition.ContractName" /> property and optionally, the <see cref="P:System.ComponentModel.Composition.Primitives.ExportDefinition.Metadata" /> property. By default, <see cref="P:System.ComponentModel.Composition.Primitives.ExportDefinition.Metadata" /> returns an empty, read-only dictionary.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Primitives.ExportDefinition" /> class.</para> - </summary> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ExportDefinition (string contractName, System.Collections.Generic.IDictionary<string,object> metadata);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string contractName, class System.Collections.Generic.IDictionary`2<string, object> metadata) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="contractName" Type="System.String" /> - <Parameter Name="metadata" Type="System.Collections.Generic.IDictionary<System.String,System.Object>" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Primitives.ExportDefinition" /> class with the specified contract name and metadata.</para> - </summary> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name of the <see cref="T:System.ComponentModel.Composition.Primitives.ExportDefinition" /> object.</param> - <param name="metadata"> - <attribution license="cc4" from="Microsoft" modified="false" />The metadata of the <see cref="T:System.ComponentModel.Composition.Primitives.ExportDefinition" /> or null to set the <see cref="P:System.ComponentModel.Composition.Primitives.ExportDefinition.Metadata" /> property to an empty, read-only <see cref="T:System.Collections.Generic.IDictionary`2" /> object.</param> - </Docs> - </Member> - <Member MemberName="ContractName"> - <MemberSignature Language="C#" Value="public virtual string ContractName { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance string ContractName" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Overrides of this property should never return null or an empty string ("").</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the contract name.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Metadata"> - <MemberSignature Language="C#" Value="public virtual System.Collections.Generic.IDictionary<string,object> Metadata { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IDictionary`2<string, object> Metadata" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IDictionary<System.String,System.Object></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Overrides of this property should return a read-only <see cref="T:System.Collections.Generic.IDictionary`2" /> object with a case-sensitive, non-linguistic comparer, such as <see cref="P:System.StringComparer.Ordinal" />, and should never return null.</para> - <para>If the <see cref="T:System.ComponentModel.Composition.Primitives.ExportDefinition" /> does not contain metadata, return an empty <see cref="T:System.Collections.Generic.IDictionary`2" /> instead.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the contract metadata.</para> - </summary> - </Docs> - </Member> - <Member MemberName="ToString"> - <MemberSignature Language="C#" Value="public override string ToString ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance string ToString() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns a string representation of the export definition.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A string representation of the export definition.</para> - </returns> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ExportedDelegate.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ExportedDelegate.xml deleted file mode 100644 index 34386727d0f..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ExportedDelegate.xml +++ /dev/null @@ -1,88 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ExportedDelegate" FullName="System.ComponentModel.Composition.Primitives.ExportedDelegate"> - <TypeSignature Language="C#" Value="public class ExportedDelegate" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit ExportedDelegate extends System.Object" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Object</BaseTypeName> - </Base> - <Interfaces /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Represents a function exported by a <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" />.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="protected ExportedDelegate ();" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Primitives.ExportedDelegate" /> class. </para> - </summary> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ExportedDelegate (object instance, System.Reflection.MethodInfo method);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(object instance, class System.Reflection.MethodInfo method) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="instance" Type="System.Object" /> - <Parameter Name="method" Type="System.Reflection.MethodInfo" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Primitives.ExportedDelegate" /> class for the specified part and method. </para> - </summary> - <param name="instance"> - <attribution license="cc4" from="Microsoft" modified="false" />The part exporting the method.</param> - <param name="method"> - <attribution license="cc4" from="Microsoft" modified="false" />The method to be exported.</param> - </Docs> - </Member> - <Member MemberName="CreateDelegate"> - <MemberSignature Language="C#" Value="public virtual Delegate CreateDelegate (Type delegateType);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Delegate CreateDelegate(class System.Type delegateType) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Delegate</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="delegateType" Type="System.Type" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a delegate of the specified type.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A delegate of the specified type, or null if no such delegate can be created.</para> - </returns> - <param name="delegateType"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the delegate to return.</param> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ICompositionElement.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ICompositionElement.xml deleted file mode 100644 index 957386ece9a..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ICompositionElement.xml +++ /dev/null @@ -1,60 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ICompositionElement" FullName="System.ComponentModel.Composition.Primitives.ICompositionElement"> - <TypeSignature Language="C#" Value="public interface ICompositionElement" /> - <TypeSignature Language="ILAsm" Value=".class public interface auto ansi abstract ICompositionElement" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Interfaces /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Represents an element that participates in composition.</para> - </summary> - </Docs> - <Members> - <Member MemberName="DisplayName"> - <MemberSignature Language="C#" Value="public string DisplayName { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance string DisplayName" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Implementers of this property should never return null or an empty string ("").</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the display name of the composition element.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Origin"> - <MemberSignature Language="C#" Value="public System.ComponentModel.Composition.Primitives.ICompositionElement Origin { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.ComponentModel.Composition.Primitives.ICompositionElement Origin" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ICompositionElement</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the composition element from which the current composition element originated.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ImportCardinality.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ImportCardinality.xml deleted file mode 100644 index 87bd4da3b7b..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ImportCardinality.xml +++ /dev/null @@ -1,72 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ImportCardinality" FullName="System.ComponentModel.Composition.Primitives.ImportCardinality"> - <TypeSignature Language="C#" Value="public enum ImportCardinality" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed ImportCardinality extends System.Enum" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Enum</BaseTypeName> - </Base> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Indicates the cardinality of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects required by an <see cref="T:System.ComponentModel.Composition.Primitives.ImportDefinition" />.</para> - </summary> - </Docs> - <Members> - <Member MemberName="ExactlyOne"> - <MemberSignature Language="C#" Value="ExactlyOne" /> - <MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.ComponentModel.Composition.Primitives.ImportCardinality ExactlyOne = int32(1)" /> - <MemberType>Field</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ImportCardinality</ReturnType> - </ReturnValue> - <Docs> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Exactly one <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> object is required by the <see cref="T:System.ComponentModel.Composition.Primitives.ImportDefinition" />.</para> - </summary> - </Docs> - </Member> - <Member MemberName="ZeroOrMore"> - <MemberSignature Language="C#" Value="ZeroOrMore" /> - <MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.ComponentModel.Composition.Primitives.ImportCardinality ZeroOrMore = int32(2)" /> - <MemberType>Field</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ImportCardinality</ReturnType> - </ReturnValue> - <Docs> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Zero or more <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects are required by the <see cref="T:System.ComponentModel.Composition.Primitives.ImportDefinition" />.</para> - </summary> - </Docs> - </Member> - <Member MemberName="ZeroOrOne"> - <MemberSignature Language="C#" Value="ZeroOrOne" /> - <MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.ComponentModel.Composition.Primitives.ImportCardinality ZeroOrOne = int32(0)" /> - <MemberType>Field</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ImportCardinality</ReturnType> - </ReturnValue> - <Docs> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Zero or one <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects are required by the <see cref="T:System.ComponentModel.Composition.Primitives.ImportDefinition" />.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ImportDefinition.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ImportDefinition.xml deleted file mode 100644 index f34b992f456..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.Primitives/ImportDefinition.xml +++ /dev/null @@ -1,278 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ImportDefinition" FullName="System.ComponentModel.Composition.Primitives.ImportDefinition"> - <TypeSignature Language="C#" Value="public class ImportDefinition" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit ImportDefinition extends System.Object" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Object</BaseTypeName> - </Base> - <Interfaces /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Represents an import that is required by a <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> object.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="protected ImportDefinition ();" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Derived types that call this constructor must override the <see cref="P:System.ComponentModel.Composition.Primitives.ImportDefinition.Constraint" /> property, and optionally, the <see cref="P:System.ComponentModel.Composition.Primitives.ImportDefinition.Cardinality" />, <see cref="P:System.ComponentModel.Composition.Primitives.ImportDefinition.IsPrerequisite" /> and <see cref="P:System.ComponentModel.Composition.Primitives.ImportDefinition.IsRecomposable" /> properties.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Primitives.ImportDefinition" /> class.</para> - </summary> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ImportDefinition (System.Linq.Expressions.Expression<Func<System.ComponentModel.Composition.Primitives.ExportDefinition,bool>> constraint, string contractName, System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Linq.Expressions.Expression`1<class System.Func`2<class System.ComponentModel.Composition.Primitives.ExportDefinition, bool>> constraint, string contractName, valuetype System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="constraint" Type="System.Linq.Expressions.Expression<System.Func<System.ComponentModel.Composition.Primitives.ExportDefinition,System.Boolean>>" /> - <Parameter Name="contractName" Type="System.String" /> - <Parameter Name="cardinality" Type="System.ComponentModel.Composition.Primitives.ImportCardinality" /> - <Parameter Name="isRecomposable" Type="System.Boolean" /> - <Parameter Name="isPrerequisite" Type="System.Boolean" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Primitives.ImportDefinition" /> class with the specified constraint, contract name, and cardinality, and indicates whether the import definition is recomposable or a prerequisite.</para> - </summary> - <param name="constraint"> - <attribution license="cc4" from="Microsoft" modified="false" />An expression that contains a <see cref="T:System.Func`2" /> object that defines the conditions an <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> must match to satisfy the import definition.</param> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name.</param> - <param name="cardinality"> - <attribution license="cc4" from="Microsoft" modified="false" />One of the enumeration values that indicates the cardinality of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects required by the import definition.</param> - <param name="isRecomposable"> - <attribution license="cc4" from="Microsoft" modified="false" />true to specify that the import definition can be satisfied multiple times throughout the lifetime of a <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> object; otherwise, false.</param> - <param name="isPrerequisite"> - <attribution license="cc4" from="Microsoft" modified="false" />true to specify that the import definition must be satisfied before a <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> can start producing exported objects; otherwise, false.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ImportDefinition (System.Linq.Expressions.Expression<Func<System.ComponentModel.Composition.Primitives.ExportDefinition,bool>> constraint, string contractName, System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite, System.Collections.Generic.IDictionary<string,object> metadata);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Linq.Expressions.Expression`1<class System.Func`2<class System.ComponentModel.Composition.Primitives.ExportDefinition, bool>> constraint, string contractName, valuetype System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite, class System.Collections.Generic.IDictionary`2<string, object> metadata) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="constraint" Type="System.Linq.Expressions.Expression<System.Func<System.ComponentModel.Composition.Primitives.ExportDefinition,System.Boolean>>" /> - <Parameter Name="contractName" Type="System.String" /> - <Parameter Name="cardinality" Type="System.ComponentModel.Composition.Primitives.ImportCardinality" /> - <Parameter Name="isRecomposable" Type="System.Boolean" /> - <Parameter Name="isPrerequisite" Type="System.Boolean" /> - <Parameter Name="metadata" Type="System.Collections.Generic.IDictionary<System.String,System.Object>" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Primitives.ImportDefinition" /> class with the specified constraint, contract name, cardinality, and metadata, and indicates whether the import definition is recomposable or a prerequisite.</para> - </summary> - <param name="constraint"> - <attribution license="cc4" from="Microsoft" modified="false" />An expression that contains a <see cref="T:System.Func`2" /> object that defines the conditions an <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> must match to satisfy the import definition.</param> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name.</param> - <param name="cardinality"> - <attribution license="cc4" from="Microsoft" modified="false" />One of the enumeration values that indicates the cardinality of the <see cref="T:System.ComponentModel.Composition.Primitives.Export" /> objects required by the import definition.</param> - <param name="isRecomposable"> - <attribution license="cc4" from="Microsoft" modified="false" />true to specify that the import definition can be satisfied multiple times throughout the lifetime of a <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> object; otherwise, false.</param> - <param name="isPrerequisite"> - <attribution license="cc4" from="Microsoft" modified="false" />true to specify that the import definition must be satisfied before a <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> can start producing exported objects; otherwise, false.</param> - <param name="metadata"> - <attribution license="cc4" from="Microsoft" modified="false" />The metadata associated with the import.</param> - </Docs> - </Member> - <Member MemberName="Cardinality"> - <MemberSignature Language="C#" Value="public virtual System.ComponentModel.Composition.Primitives.ImportCardinality Cardinality { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance valuetype System.ComponentModel.Composition.Primitives.ImportCardinality Cardinality" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ImportCardinality</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the cardinality of the exports required by the import definition.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Constraint"> - <MemberSignature Language="C#" Value="public virtual System.Linq.Expressions.Expression<Func<System.ComponentModel.Composition.Primitives.ExportDefinition,bool>> Constraint { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Linq.Expressions.Expression`1<class System.Func`2<class System.ComponentModel.Composition.Primitives.ExportDefinition, bool>> Constraint" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Linq.Expressions.Expression<System.Func<System.ComponentModel.Composition.Primitives.ExportDefinition,System.Boolean>></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Overrides of this property should never return null.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets an expression that defines conditions that the import must satisfy to match the import definition.</para> - </summary> - </Docs> - </Member> - <Member MemberName="ContractName"> - <MemberSignature Language="C#" Value="public virtual string ContractName { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance string ContractName" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the name of the contract.</para> - </summary> - </Docs> - </Member> - <Member MemberName="IsConstraintSatisfiedBy"> - <MemberSignature Language="C#" Value="public virtual bool IsConstraintSatisfiedBy (System.ComponentModel.Composition.Primitives.ExportDefinition exportDefinition);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance bool IsConstraintSatisfiedBy(class System.ComponentModel.Composition.Primitives.ExportDefinition exportDefinition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="exportDefinition" Type="System.ComponentModel.Composition.Primitives.ExportDefinition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a value that indicates whether the export represented by the specified definition satisfies the constraints of this import definition.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>true if the constraints are satisfied; otherwise, false.</para> - </returns> - <param name="exportDefinition"> - <attribution license="cc4" from="Microsoft" modified="false" />The export definition to test.</param> - </Docs> - </Member> - <Member MemberName="IsPrerequisite"> - <MemberSignature Language="C#" Value="public virtual bool IsPrerequisite { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance bool IsPrerequisite" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a value that indicates whether the import definition must be satisfied before a part can start producing exported objects.</para> - </summary> - </Docs> - </Member> - <Member MemberName="IsRecomposable"> - <MemberSignature Language="C#" Value="public virtual bool IsRecomposable { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance bool IsRecomposable" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a value that indicates whether the import definition can be satisfied multiple times.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Metadata"> - <MemberSignature Language="C#" Value="public virtual System.Collections.Generic.IDictionary<string,object> Metadata { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IDictionary`2<string, object> Metadata" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.Generic.IDictionary<System.String,System.Object></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This property should never return null. Imports with no metadata should return an empty <see cref="T:System.Collections.Generic.IDictionary`2" /> collection.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the metadata associated with this import.</para> - </summary> - </Docs> - </Member> - <Member MemberName="ToString"> - <MemberSignature Language="C#" Value="public override string ToString ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance string ToString() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns a string representation of the import definition.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A string representation of the import definition.</para> - </returns> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.ReflectionModel/LazyMemberInfo.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.ReflectionModel/LazyMemberInfo.xml deleted file mode 100644 index a9407513ea3..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.ReflectionModel/LazyMemberInfo.xml +++ /dev/null @@ -1,234 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="LazyMemberInfo" FullName="System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo"> - <TypeSignature Language="C#" Value="public struct LazyMemberInfo" /> - <TypeSignature Language="ILAsm" Value=".class public sequential ansi sealed beforefieldinit LazyMemberInfo extends System.ValueType" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.ValueType</BaseTypeName> - </Base> - <Interfaces /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Represents a <see cref="T:System.Reflection.MemberInfo" /> object that does not load assemblies or create objects until requested.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public LazyMemberInfo (System.Reflection.MemberInfo member);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Reflection.MemberInfo member) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="member" Type="System.Reflection.MemberInfo" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo" /> class, representing the specified member.</para> - </summary> - <param name="member"> - <attribution license="cc4" from="Microsoft" modified="false" />The member to represent.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public LazyMemberInfo (System.Reflection.MemberTypes memberType, Func<System.Reflection.MemberInfo[]> accessorsCreator);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(valuetype System.Reflection.MemberTypes memberType, class System.Func`1<class System.Reflection.MemberInfo[]> accessorsCreator) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="memberType" Type="System.Reflection.MemberTypes" /> - <Parameter Name="accessorsCreator" Type="System.Func<System.Reflection.MemberInfo[]>" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo" /> class for a member of the specified type with the specified accessors.</para> - </summary> - <param name="memberType"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the represented member.</param> - <param name="accessorsCreator"> - <attribution license="cc4" from="Microsoft" modified="false" />A function whose return value is a collection of the accessors for the represented member.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public LazyMemberInfo (System.Reflection.MemberTypes memberType, System.Reflection.MemberInfo[] accessors);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(valuetype System.Reflection.MemberTypes memberType, class System.Reflection.MemberInfo[] accessors) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="memberType" Type="System.Reflection.MemberTypes" /> - <Parameter Name="accessors" Type="System.Reflection.MemberInfo[]"> - <Attributes> - <Attribute> - <AttributeName>System.ParamArray</AttributeName> - </Attribute> - </Attributes> - </Parameter> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo" /> class for a member of the specified type with the specified accessors.</para> - </summary> - <param name="memberType"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the represented member.</param> - <param name="accessors"> - <attribution license="cc4" from="Microsoft" modified="false" />An array of the accessors for the represented member.</param> - </Docs> - </Member> - <Member MemberName="Equals"> - <MemberSignature Language="C#" Value="public override bool Equals (object obj);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance bool Equals(object obj) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="obj" Type="System.Object" /> - </Parameters> - <Docs> - <summary>To be added.</summary> - <returns>To be added.</returns> - <remarks>To be added.</remarks> - <param name="obj"> - <attribution license="cc4" from="Microsoft" modified="false" />The other object.</param> - </Docs> - </Member> - <Member MemberName="GetAccessors"> - <MemberSignature Language="C#" Value="public System.Reflection.MemberInfo[] GetAccessors ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Reflection.MemberInfo[] GetAccessors() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Reflection.MemberInfo[]</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets an array of the accessors for the represented member.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>An array of the accessors for the represented member.</para> - </returns> - </Docs> - </Member> - <Member MemberName="GetHashCode"> - <MemberSignature Language="C#" Value="public override int GetHashCode ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance int32 GetHashCode() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Int32</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <summary>To be added.</summary> - <returns>To be added.</returns> - <remarks>To be added.</remarks> - </Docs> - </Member> - <Member MemberName="MemberType"> - <MemberSignature Language="C#" Value="public System.Reflection.MemberTypes MemberType { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance valuetype System.Reflection.MemberTypes MemberType" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Reflection.MemberTypes</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the type of the represented member.</para> - </summary> - </Docs> - </Member> - <Member MemberName="op_Equality"> - <MemberSignature Language="C#" Value="public static bool op_Equality (System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo left, System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo right);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig specialname bool op_Equality(valuetype System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo left, valuetype System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo right) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="left" Type="System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo" /> - <Parameter Name="right" Type="System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Determines whether the two specified <see cref="T:System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo" /> objects are equal.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>true if the objects are equal; otherwise, false.</para> - </returns> - <param name="left"> - <attribution license="cc4" from="Microsoft" modified="false" />The first object to test.</param> - <param name="right"> - <attribution license="cc4" from="Microsoft" modified="false" />The second object to test.</param> - </Docs> - </Member> - <Member MemberName="op_Inequality"> - <MemberSignature Language="C#" Value="public static bool op_Inequality (System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo left, System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo right);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig specialname bool op_Inequality(valuetype System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo left, valuetype System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo right) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="left" Type="System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo" /> - <Parameter Name="right" Type="System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Determines whether the two specified <see cref="T:System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo" /> objects are not equal.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>true if the objects are equal; otherwise, false.</para> - </returns> - <param name="left"> - <attribution license="cc4" from="Microsoft" modified="false" />The first object to test.</param> - <param name="right"> - <attribution license="cc4" from="Microsoft" modified="false" />The second object to test.</param> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.ReflectionModel/ReflectionModelServices.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.ReflectionModel/ReflectionModelServices.xml deleted file mode 100644 index 47c235f067f..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition.ReflectionModel/ReflectionModelServices.xml +++ /dev/null @@ -1,595 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ReflectionModelServices" FullName="System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices"> - <TypeSignature Language="C#" Value="public static class ReflectionModelServices" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi abstract sealed beforefieldinit ReflectionModelServices extends System.Object" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Object</BaseTypeName> - </Base> - <Interfaces /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Provides extension methods to create and retrieve reflection-based parts.</para> - </summary> - </Docs> - <Members> - <Member MemberName="CreateExportDefinition"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Primitives.ExportDefinition CreateExportDefinition (System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo exportingMember, string contractName, Lazy<System.Collections.Generic.IDictionary<string,object>> metadata, System.ComponentModel.Composition.Primitives.ICompositionElement origin);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Primitives.ExportDefinition CreateExportDefinition(valuetype System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo exportingMember, string contractName, class System.Lazy`1<class System.Collections.Generic.IDictionary`2<string, object>> metadata, class System.ComponentModel.Composition.Primitives.ICompositionElement origin) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ExportDefinition</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="exportingMember" Type="System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo" /> - <Parameter Name="contractName" Type="System.String" /> - <Parameter Name="metadata" Type="System.Lazy<System.Collections.Generic.IDictionary<System.String,System.Object>>" /> - <Parameter Name="origin" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Creates an export definition from the specified member, with the specified contract name, metadata, and origin.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>An export definition created from the specified parameters.</para> - </returns> - <param name="exportingMember"> - <attribution license="cc4" from="Microsoft" modified="false" />The member to export.</param> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name to use for the export.</param> - <param name="metadata"> - <attribution license="cc4" from="Microsoft" modified="false" />The metadata for the export.</param> - <param name="origin"> - <attribution license="cc4" from="Microsoft" modified="false" />The object that the export originates from.</param> - </Docs> - </Member> - <Member MemberName="CreateImportDefinition"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition CreateImportDefinition (Lazy<System.Reflection.ParameterInfo> parameter, string contractName, string requiredTypeIdentity, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,Type>> requiredMetadata, System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy, System.ComponentModel.Composition.Primitives.ICompositionElement origin);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition CreateImportDefinition(class System.Lazy`1<class System.Reflection.ParameterInfo> parameter, string contractName, string requiredTypeIdentity, class System.Collections.Generic.IEnumerable`1<valuetype System.Collections.Generic.KeyValuePair`2<string, class System.Type>> requiredMetadata, valuetype System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, valuetype System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy, class System.ComponentModel.Composition.Primitives.ICompositionElement origin) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="parameter" Type="System.Lazy<System.Reflection.ParameterInfo>" /> - <Parameter Name="contractName" Type="System.String" /> - <Parameter Name="requiredTypeIdentity" Type="System.String" /> - <Parameter Name="requiredMetadata" Type="System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String,System.Type>>" /> - <Parameter Name="cardinality" Type="System.ComponentModel.Composition.Primitives.ImportCardinality" /> - <Parameter Name="requiredCreationPolicy" Type="System.ComponentModel.Composition.CreationPolicy" /> - <Parameter Name="origin" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Creates an import definition for the specified parameter by using the specified contract name, type identity, import metadata, cardinality, and creation policy.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>An import definition created from the specified parameters.</para> - </returns> - <param name="parameter"> - <attribution license="cc4" from="Microsoft" modified="false" />The parameter to import.</param> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name to use for the import.</param> - <param name="requiredTypeIdentity"> - <attribution license="cc4" from="Microsoft" modified="false" />The required type identity for the import.</param> - <param name="requiredMetadata"> - <attribution license="cc4" from="Microsoft" modified="false" />The required metadata for the import.</param> - <param name="cardinality"> - <attribution license="cc4" from="Microsoft" modified="false" />The cardinality of the import.</param> - <param name="requiredCreationPolicy"> - <attribution license="cc4" from="Microsoft" modified="false" />One of the enumeration values that specifies the import's creation policy.</param> - <param name="origin"> - <attribution license="cc4" from="Microsoft" modified="false" />The object to import into.</param> - </Docs> - </Member> - <Member MemberName="CreateImportDefinition"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition CreateImportDefinition (System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo importingMember, string contractName, string requiredTypeIdentity, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,Type>> requiredMetadata, System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy, System.ComponentModel.Composition.Primitives.ICompositionElement origin);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition CreateImportDefinition(valuetype System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo importingMember, string contractName, string requiredTypeIdentity, class System.Collections.Generic.IEnumerable`1<valuetype System.Collections.Generic.KeyValuePair`2<string, class System.Type>> requiredMetadata, valuetype System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, valuetype System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy, class System.ComponentModel.Composition.Primitives.ICompositionElement origin) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="importingMember" Type="System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo" /> - <Parameter Name="contractName" Type="System.String" /> - <Parameter Name="requiredTypeIdentity" Type="System.String" /> - <Parameter Name="requiredMetadata" Type="System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String,System.Type>>" /> - <Parameter Name="cardinality" Type="System.ComponentModel.Composition.Primitives.ImportCardinality" /> - <Parameter Name="isRecomposable" Type="System.Boolean" /> - <Parameter Name="requiredCreationPolicy" Type="System.ComponentModel.Composition.CreationPolicy" /> - <Parameter Name="origin" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Creates an import definition for the specified member by using the specified contract name, type identity, import metadata, cardinality, recomposition policy, and creation policy.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>An import definition created from the specified parameters.</para> - </returns> - <param name="importingMember"> - <attribution license="cc4" from="Microsoft" modified="false" />The member to import into.</param> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name to use for the import.</param> - <param name="requiredTypeIdentity"> - <attribution license="cc4" from="Microsoft" modified="false" />The required type identity for the import.</param> - <param name="requiredMetadata"> - <attribution license="cc4" from="Microsoft" modified="false" />The required metadata for the import.</param> - <param name="cardinality"> - <attribution license="cc4" from="Microsoft" modified="false" />The cardinality of the import.</param> - <param name="isRecomposable"> - <attribution license="cc4" from="Microsoft" modified="false" />true to indicate that the import is recomposable; otherwise, false.</param> - <param name="requiredCreationPolicy"> - <attribution license="cc4" from="Microsoft" modified="false" />One of the enumeration values that specifies the import's creation policy.</param> - <param name="origin"> - <attribution license="cc4" from="Microsoft" modified="false" />The object to import into.</param> - </Docs> - </Member> - <Member MemberName="CreateImportDefinition"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition CreateImportDefinition (Lazy<System.Reflection.ParameterInfo> parameter, string contractName, string requiredTypeIdentity, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,Type>> requiredMetadata, System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy, System.Collections.Generic.IDictionary<string,object> metadata, bool isExportFactory, System.ComponentModel.Composition.Primitives.ICompositionElement origin);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition CreateImportDefinition(class System.Lazy`1<class System.Reflection.ParameterInfo> parameter, string contractName, string requiredTypeIdentity, class System.Collections.Generic.IEnumerable`1<valuetype System.Collections.Generic.KeyValuePair`2<string, class System.Type>> requiredMetadata, valuetype System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, valuetype System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy, class System.Collections.Generic.IDictionary`2<string, object> metadata, bool isExportFactory, class System.ComponentModel.Composition.Primitives.ICompositionElement origin) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="parameter" Type="System.Lazy<System.Reflection.ParameterInfo>" /> - <Parameter Name="contractName" Type="System.String" /> - <Parameter Name="requiredTypeIdentity" Type="System.String" /> - <Parameter Name="requiredMetadata" Type="System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String,System.Type>>" /> - <Parameter Name="cardinality" Type="System.ComponentModel.Composition.Primitives.ImportCardinality" /> - <Parameter Name="requiredCreationPolicy" Type="System.ComponentModel.Composition.CreationPolicy" /> - <Parameter Name="metadata" Type="System.Collections.Generic.IDictionary<System.String,System.Object>" /> - <Parameter Name="isExportFactory" Type="System.Boolean" /> - <Parameter Name="origin" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Creates an import definition for the specified parameter by using the specified contract name, type identity, import and contract metadata, cardinality, and creation policy.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>An import definition created from the specified parameters.</para> - </returns> - <param name="parameter"> - <attribution license="cc4" from="Microsoft" modified="false" />The parameter to import.</param> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name to use for the import.</param> - <param name="requiredTypeIdentity"> - <attribution license="cc4" from="Microsoft" modified="false" />The required type identity for the import.</param> - <param name="requiredMetadata"> - <attribution license="cc4" from="Microsoft" modified="false" />The required metadata for the import.</param> - <param name="cardinality"> - <attribution license="cc4" from="Microsoft" modified="false" />The cardinality of the import.</param> - <param name="requiredCreationPolicy"> - <attribution license="cc4" from="Microsoft" modified="false" />One of the enumeration values that specifies the import's creation policy.</param> - <param name="metadata"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract metadata</param> - <param name="isExportFactory"> - <attribution license="cc4" from="Microsoft" modified="false" />true to indicate that the import represents an <see cref="T:System.ComponentModel.Composition.ExportFactory`1" />; otherwise, false.</param> - <param name="origin"> - <attribution license="cc4" from="Microsoft" modified="false" />The object to import into.</param> - </Docs> - </Member> - <Member MemberName="CreateImportDefinition"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition CreateImportDefinition (System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo importingMember, string contractName, string requiredTypeIdentity, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,Type>> requiredMetadata, System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy, System.Collections.Generic.IDictionary<string,object> metadata, bool isExportFactory, System.ComponentModel.Composition.Primitives.ICompositionElement origin);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition CreateImportDefinition(valuetype System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo importingMember, string contractName, string requiredTypeIdentity, class System.Collections.Generic.IEnumerable`1<valuetype System.Collections.Generic.KeyValuePair`2<string, class System.Type>> requiredMetadata, valuetype System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, valuetype System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy, class System.Collections.Generic.IDictionary`2<string, object> metadata, bool isExportFactory, class System.ComponentModel.Composition.Primitives.ICompositionElement origin) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="importingMember" Type="System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo" /> - <Parameter Name="contractName" Type="System.String" /> - <Parameter Name="requiredTypeIdentity" Type="System.String" /> - <Parameter Name="requiredMetadata" Type="System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String,System.Type>>" /> - <Parameter Name="cardinality" Type="System.ComponentModel.Composition.Primitives.ImportCardinality" /> - <Parameter Name="isRecomposable" Type="System.Boolean" /> - <Parameter Name="requiredCreationPolicy" Type="System.ComponentModel.Composition.CreationPolicy" /> - <Parameter Name="metadata" Type="System.Collections.Generic.IDictionary<System.String,System.Object>" /> - <Parameter Name="isExportFactory" Type="System.Boolean" /> - <Parameter Name="origin" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Creates an import definition for the specified member by using the specified contract name, type identity, import and contract metadata, cardinality, recomposition policy, and creation policy.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>An import definition created from the specified parameters.</para> - </returns> - <param name="importingMember"> - <attribution license="cc4" from="Microsoft" modified="false" />The member to import into.</param> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name to use for the import.</param> - <param name="requiredTypeIdentity"> - <attribution license="cc4" from="Microsoft" modified="false" />The required type identity for the import.</param> - <param name="requiredMetadata"> - <attribution license="cc4" from="Microsoft" modified="false" />The required metadata for the import.</param> - <param name="cardinality"> - <attribution license="cc4" from="Microsoft" modified="false" />The cardinality of the import.</param> - <param name="isRecomposable"> - <attribution license="cc4" from="Microsoft" modified="false" />true to indicate that the import is recomposable; otherwise, false.</param> - <param name="requiredCreationPolicy"> - <attribution license="cc4" from="Microsoft" modified="false" />One of the enumeration values that specifies the import's creation policy.</param> - <param name="metadata"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract metadata.</param> - <param name="isExportFactory"> - <attribution license="cc4" from="Microsoft" modified="false" />true to indicate that the import represents an <see cref="T:System.ComponentModel.Composition.ExportFactory`1" />; otherwise, false.</param> - <param name="origin"> - <attribution license="cc4" from="Microsoft" modified="false" />The object to import into.</param> - </Docs> - </Member> - <Member MemberName="CreateImportDefinition"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition CreateImportDefinition (System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo importingMember, string contractName, string requiredTypeIdentity, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,Type>> requiredMetadata, System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, bool isPreRequisite, System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy, System.Collections.Generic.IDictionary<string,object> metadata, bool isExportFactory, System.ComponentModel.Composition.Primitives.ICompositionElement origin);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition CreateImportDefinition(valuetype System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo importingMember, string contractName, string requiredTypeIdentity, class System.Collections.Generic.IEnumerable`1<valuetype System.Collections.Generic.KeyValuePair`2<string, class System.Type>> requiredMetadata, valuetype System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, bool isPreRequisite, valuetype System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy, class System.Collections.Generic.IDictionary`2<string, object> metadata, bool isExportFactory, class System.ComponentModel.Composition.Primitives.ICompositionElement origin) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="importingMember" Type="System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo" /> - <Parameter Name="contractName" Type="System.String" /> - <Parameter Name="requiredTypeIdentity" Type="System.String" /> - <Parameter Name="requiredMetadata" Type="System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String,System.Type>>" /> - <Parameter Name="cardinality" Type="System.ComponentModel.Composition.Primitives.ImportCardinality" /> - <Parameter Name="isRecomposable" Type="System.Boolean" /> - <Parameter Name="isPreRequisite" Type="System.Boolean" /> - <Parameter Name="requiredCreationPolicy" Type="System.ComponentModel.Composition.CreationPolicy" /> - <Parameter Name="metadata" Type="System.Collections.Generic.IDictionary<System.String,System.Object>" /> - <Parameter Name="isExportFactory" Type="System.Boolean" /> - <Parameter Name="origin" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Creates an import definition for the specified member by using the specified contract name, type identity, import and contract metadata, cardinality, recomposition policy, and creation policy.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>An import definition created from the specified parameters.</para> - </returns> - <param name="importingMember"> - <attribution license="cc4" from="Microsoft" modified="false" />The member to import into.</param> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name to use for the import.</param> - <param name="requiredTypeIdentity"> - <attribution license="cc4" from="Microsoft" modified="false" />The required type identity for the import.</param> - <param name="requiredMetadata"> - <attribution license="cc4" from="Microsoft" modified="false" />The required metadata for the import.</param> - <param name="cardinality"> - <attribution license="cc4" from="Microsoft" modified="false" />The cardinality of the import.</param> - <param name="isRecomposable"> - <attribution license="cc4" from="Microsoft" modified="false" />true to indicate that the import is recomposable; otherwise, false.</param> - <param name="isPreRequisite"> - <attribution license="cc4" from="Microsoft" modified="false" />true to indicate that the import is a prerequisite; otherwise, false.</param> - <param name="requiredCreationPolicy"> - <attribution license="cc4" from="Microsoft" modified="false" />One of the enumeration values that specifies the import's creation policy.</param> - <param name="metadata"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract metadata.</param> - <param name="isExportFactory"> - <attribution license="cc4" from="Microsoft" modified="false" />true to indicate that the import represents an <see cref="T:System.ComponentModel.Composition.ExportFactory`1" />; otherwise, false.</param> - <param name="origin"> - <attribution license="cc4" from="Microsoft" modified="false" />The object to import into.</param> - </Docs> - </Member> - <Member MemberName="CreatePartDefinition"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Primitives.ComposablePartDefinition CreatePartDefinition (Lazy<Type> partType, bool isDisposalRequired, Lazy<System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ImportDefinition>> imports, Lazy<System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ExportDefinition>> exports, Lazy<System.Collections.Generic.IDictionary<string,object>> metadata, System.ComponentModel.Composition.Primitives.ICompositionElement origin);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Primitives.ComposablePartDefinition CreatePartDefinition(class System.Lazy`1<class System.Type> partType, bool isDisposalRequired, class System.Lazy`1<class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.ImportDefinition>> imports, class System.Lazy`1<class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.Primitives.ExportDefinition>> exports, class System.Lazy`1<class System.Collections.Generic.IDictionary`2<string, object>> metadata, class System.ComponentModel.Composition.Primitives.ICompositionElement origin) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ComposablePartDefinition</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="partType" Type="System.Lazy<System.Type>" /> - <Parameter Name="isDisposalRequired" Type="System.Boolean" /> - <Parameter Name="imports" Type="System.Lazy<System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ImportDefinition>>" /> - <Parameter Name="exports" Type="System.Lazy<System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.ExportDefinition>>" /> - <Parameter Name="metadata" Type="System.Lazy<System.Collections.Generic.IDictionary<System.String,System.Object>>" /> - <Parameter Name="origin" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Creates a part definition with the specified part type, imports, exports, metadata, and origin.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A part definition created from the specified parameters.</para> - </returns> - <param name="partType"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the part.</param> - <param name="isDisposalRequired"> - <attribution license="cc4" from="Microsoft" modified="false" />true if the part requires disposal; otherwise, false.</param> - <param name="imports"> - <attribution license="cc4" from="Microsoft" modified="false" />A collection of the part's imports.</param> - <param name="exports"> - <attribution license="cc4" from="Microsoft" modified="false" />A collection of the part's exports.</param> - <param name="metadata"> - <attribution license="cc4" from="Microsoft" modified="false" />The part's metadata.</param> - <param name="origin"> - <attribution license="cc4" from="Microsoft" modified="false" />The part's origin.</param> - </Docs> - </Member> - <Member MemberName="GetExportFactoryProductImportDefinition"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition GetExportFactoryProductImportDefinition (System.ComponentModel.Composition.Primitives.ImportDefinition importDefinition);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition GetExportFactoryProductImportDefinition(class System.ComponentModel.Composition.Primitives.ImportDefinition importDefinition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="importDefinition" Type="System.ComponentModel.Composition.Primitives.ImportDefinition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns a representation of an import definition as an export factory product.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The representation of the import definition.</para> - </returns> - <param name="importDefinition"> - <attribution license="cc4" from="Microsoft" modified="false" />The import definition to represent.</param> - </Docs> - </Member> - <Member MemberName="GetExportingMember"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo GetExportingMember (System.ComponentModel.Composition.Primitives.ExportDefinition exportDefinition);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig valuetype System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo GetExportingMember(class System.ComponentModel.Composition.Primitives.ExportDefinition exportDefinition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="exportDefinition" Type="System.ComponentModel.Composition.Primitives.ExportDefinition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the exporting member from a specified export definition.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The member specified in the export definition.</para> - </returns> - <param name="exportDefinition"> - <attribution license="cc4" from="Microsoft" modified="false" />The export definition to examine.</param> - </Docs> - </Member> - <Member MemberName="GetImportingMember"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo GetImportingMember (System.ComponentModel.Composition.Primitives.ImportDefinition importDefinition);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig valuetype System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo GetImportingMember(class System.ComponentModel.Composition.Primitives.ImportDefinition importDefinition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="importDefinition" Type="System.ComponentModel.Composition.Primitives.ImportDefinition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the importing member from a specified import definition.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The member specified in the import definition.</para> - </returns> - <param name="importDefinition"> - <attribution license="cc4" from="Microsoft" modified="false" />The import definition to examine.</param> - </Docs> - </Member> - <Member MemberName="GetImportingParameter"> - <MemberSignature Language="C#" Value="public static Lazy<System.Reflection.ParameterInfo> GetImportingParameter (System.ComponentModel.Composition.Primitives.ImportDefinition importDefinition);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Lazy`1<class System.Reflection.ParameterInfo> GetImportingParameter(class System.ComponentModel.Composition.Primitives.ImportDefinition importDefinition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Lazy<System.Reflection.ParameterInfo></ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="importDefinition" Type="System.ComponentModel.Composition.Primitives.ImportDefinition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the importing parameter from a specified import definition.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The parameter specified in the import definition.</para> - </returns> - <param name="importDefinition"> - <attribution license="cc4" from="Microsoft" modified="false" />The import definition to examine.</param> - </Docs> - </Member> - <Member MemberName="GetPartType"> - <MemberSignature Language="C#" Value="public static Lazy<Type> GetPartType (System.ComponentModel.Composition.Primitives.ComposablePartDefinition partDefinition);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Lazy`1<class System.Type> GetPartType(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition partDefinition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Lazy<System.Type></ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="partDefinition" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the type of a part from a specified part definition.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The type of the defined part.</para> - </returns> - <param name="partDefinition"> - <attribution license="cc4" from="Microsoft" modified="false" />The part definition to examine.</param> - </Docs> - </Member> - <Member MemberName="IsDisposalRequired"> - <MemberSignature Language="C#" Value="public static bool IsDisposalRequired (System.ComponentModel.Composition.Primitives.ComposablePartDefinition partDefinition);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool IsDisposalRequired(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition partDefinition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="partDefinition" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Determines whether the specified part requires disposal.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>true if the part requires disposal; otherwise, false.</para> - </returns> - <param name="partDefinition"> - <attribution license="cc4" from="Microsoft" modified="false" />The part to examine.</param> - </Docs> - </Member> - <Member MemberName="IsExportFactoryImportDefinition"> - <MemberSignature Language="C#" Value="public static bool IsExportFactoryImportDefinition (System.ComponentModel.Composition.Primitives.ImportDefinition importDefinition);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool IsExportFactoryImportDefinition(class System.ComponentModel.Composition.Primitives.ImportDefinition importDefinition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="importDefinition" Type="System.ComponentModel.Composition.Primitives.ImportDefinition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Indicates whether a specified import definition represents an export factory (<see cref="T:System.ComponentModel.Composition.ExportFactory`1" /> or <see cref="T:System.ComponentModel.Composition.ExportFactory`2" /> object).</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>true if the specified import definition represents an export factory; otherwise, false.</para> - </returns> - <param name="importDefinition"> - <attribution license="cc4" from="Microsoft" modified="false" />The import definition to check.</param> - </Docs> - </Member> - <Member MemberName="IsImportingParameter"> - <MemberSignature Language="C#" Value="public static bool IsImportingParameter (System.ComponentModel.Composition.Primitives.ImportDefinition importDefinition);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool IsImportingParameter(class System.ComponentModel.Composition.Primitives.ImportDefinition importDefinition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="importDefinition" Type="System.ComponentModel.Composition.Primitives.ImportDefinition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Determines whether an import definition represents a member or a parameter.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>true if the import definition represents a parameter; otherwise, false.</para> - </returns> - <param name="importDefinition"> - <attribution license="cc4" from="Microsoft" modified="false" />The import definition to examine.</param> - </Docs> - </Member> - <Member MemberName="TryMakeGenericPartDefinition"> - <MemberSignature Language="C#" Value="public static bool TryMakeGenericPartDefinition (System.ComponentModel.Composition.Primitives.ComposablePartDefinition partDefinition, System.Collections.Generic.IEnumerable<Type> genericParameters, out System.ComponentModel.Composition.Primitives.ComposablePartDefinition specialization);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool TryMakeGenericPartDefinition(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition partDefinition, class System.Collections.Generic.IEnumerable`1<class System.Type> genericParameters, class System.ComponentModel.Composition.Primitives.ComposablePartDefinition specialization) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="partDefinition" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> - <Parameter Name="genericParameters" Type="System.Collections.Generic.IEnumerable<System.Type>" /> - <Parameter Name="specialization" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition&" RefType="out" /> - </Parameters> - <Docs> - <param name="partDefinition">To be added.</param> - <param name="genericParameters">To be added.</param> - <param name="specialization">To be added.</param> - <summary>To be added.</summary> - <returns>To be added.</returns> - <remarks>To be added.</remarks> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/AttributedModelServices.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/AttributedModelServices.xml deleted file mode 100644 index d83a1c426ec..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/AttributedModelServices.xml +++ /dev/null @@ -1,711 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="AttributedModelServices" FullName="System.ComponentModel.Composition.AttributedModelServices"> - <TypeSignature Language="C#" Value="public static class AttributedModelServices" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi abstract sealed beforefieldinit AttributedModelServices extends System.Object" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Object</BaseTypeName> - </Base> - <Interfaces /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Contains helper methods for using the MEF attributed programming model with composition.</para> - </summary> - </Docs> - <Members> - <Member MemberName="AddExportedValue<T>"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Primitives.ComposablePart AddExportedValue<T> (this System.ComponentModel.Composition.Hosting.CompositionBatch batch, T exportedValue);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Primitives.ComposablePart AddExportedValue<T>(class System.ComponentModel.Composition.Hosting.CompositionBatch batch, !!T exportedValue) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ComposablePart</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="batch" Type="System.ComponentModel.Composition.Hosting.CompositionBatch" RefType="this" /> - <Parameter Name="exportedValue" Type="T" /> - </Parameters> - <Docs> - <typeparam name="T">To be added.</typeparam> - <param name="batch">To be added.</param> - <param name="exportedValue">To be added.</param> - <summary>To be added.</summary> - <returns>To be added.</returns> - <remarks>To be added.</remarks> - </Docs> - </Member> - <Member MemberName="AddExportedValue<T>"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Primitives.ComposablePart AddExportedValue<T> (this System.ComponentModel.Composition.Hosting.CompositionBatch batch, string contractName, T exportedValue);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Primitives.ComposablePart AddExportedValue<T>(class System.ComponentModel.Composition.Hosting.CompositionBatch batch, string contractName, !!T exportedValue) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ComposablePart</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="batch" Type="System.ComponentModel.Composition.Hosting.CompositionBatch" RefType="this" /> - <Parameter Name="contractName" Type="System.String" /> - <Parameter Name="exportedValue" Type="T" /> - </Parameters> - <Docs> - <typeparam name="T">To be added.</typeparam> - <param name="batch">To be added.</param> - <param name="contractName">To be added.</param> - <param name="exportedValue">To be added.</param> - <summary>To be added.</summary> - <returns>To be added.</returns> - <remarks>To be added.</remarks> - </Docs> - </Member> - <Member MemberName="AddPart"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Primitives.ComposablePart AddPart (this System.ComponentModel.Composition.Hosting.CompositionBatch batch, object attributedPart);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Primitives.ComposablePart AddPart(class System.ComponentModel.Composition.Hosting.CompositionBatch batch, object attributedPart) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ComposablePart</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="batch" Type="System.ComponentModel.Composition.Hosting.CompositionBatch" RefType="this" /> - <Parameter Name="attributedPart" Type="System.Object" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Creates a composable part from the specified attributed object, and adds it to the specified composition batch.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The new part.</para> - </returns> - <param name="batch"> - <attribution license="cc4" from="Microsoft" modified="false" />The batch to add to.</param> - <param name="attributedPart"> - <attribution license="cc4" from="Microsoft" modified="false" />The object to add.</param> - </Docs> - </Member> - <Member MemberName="ComposeExportedValue<T>"> - <MemberSignature Language="C#" Value="public static void ComposeExportedValue<T> (this System.ComponentModel.Composition.Hosting.CompositionContainer container, T exportedValue);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig void ComposeExportedValue<T>(class System.ComponentModel.Composition.Hosting.CompositionContainer container, !!T exportedValue) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="container" Type="System.ComponentModel.Composition.Hosting.CompositionContainer" RefType="this" /> - <Parameter Name="exportedValue" Type="T" /> - </Parameters> - <Docs> - <typeparam name="T">To be added.</typeparam> - <param name="container">To be added.</param> - <param name="exportedValue">To be added.</param> - <summary>To be added.</summary> - <remarks>To be added.</remarks> - </Docs> - </Member> - <Member MemberName="ComposeExportedValue<T>"> - <MemberSignature Language="C#" Value="public static void ComposeExportedValue<T> (this System.ComponentModel.Composition.Hosting.CompositionContainer container, string contractName, T exportedValue);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig void ComposeExportedValue<T>(class System.ComponentModel.Composition.Hosting.CompositionContainer container, string contractName, !!T exportedValue) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="container" Type="System.ComponentModel.Composition.Hosting.CompositionContainer" RefType="this" /> - <Parameter Name="contractName" Type="System.String" /> - <Parameter Name="exportedValue" Type="T" /> - </Parameters> - <Docs> - <typeparam name="T">To be added.</typeparam> - <param name="container">To be added.</param> - <param name="contractName">To be added.</param> - <param name="exportedValue">To be added.</param> - <summary>To be added.</summary> - <remarks>To be added.</remarks> - </Docs> - </Member> - <Member MemberName="ComposeParts"> - <MemberSignature Language="C#" Value="public static void ComposeParts (this System.ComponentModel.Composition.Hosting.CompositionContainer container, object[] attributedParts);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig void ComposeParts(class System.ComponentModel.Composition.Hosting.CompositionContainer container, object[] attributedParts) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="container" Type="System.ComponentModel.Composition.Hosting.CompositionContainer" RefType="this" /> - <Parameter Name="attributedParts" Type="System.Object[]"> - <Attributes> - <Attribute> - <AttributeName>System.ParamArray</AttributeName> - </Attribute> - </Attributes> - </Parameter> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Creates composable parts from an array of attributed objects and composes them in the specified composition container.</para> - </summary> - <param name="container"> - <attribution license="cc4" from="Microsoft" modified="false" />The composition container to perform composition in.</param> - <param name="attributedParts"> - <attribution license="cc4" from="Microsoft" modified="false" />An array of attributed objects to compose.</param> - </Docs> - </Member> - <Member MemberName="CreatePart"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Primitives.ComposablePart CreatePart (object attributedPart);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Primitives.ComposablePart CreatePart(object attributedPart) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ComposablePart</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="attributedPart" Type="System.Object" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Creates a composable part from the specified attributed object.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The created part.</para> - </returns> - <param name="attributedPart"> - <attribution license="cc4" from="Microsoft" modified="false" />The attributed object.</param> - </Docs> - </Member> - <Member MemberName="CreatePart"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Primitives.ComposablePart CreatePart (System.ComponentModel.Composition.Primitives.ComposablePartDefinition partDefinition, object attributedPart);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Primitives.ComposablePart CreatePart(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition partDefinition, object attributedPart) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ComposablePart</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="partDefinition" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> - <Parameter Name="attributedPart" Type="System.Object" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Creates a composable part from the specified attributed object, using the specified part definition.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The created part.</para> - </returns> - <param name="partDefinition"> - <attribution license="cc4" from="Microsoft" modified="false" />The definition of the new part.</param> - <param name="attributedPart"> - <attribution license="cc4" from="Microsoft" modified="false" />The attributed object.</param> - </Docs> - </Member> - <Member MemberName="CreatePart"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Primitives.ComposablePart CreatePart (object attributedPart, System.Reflection.ReflectionContext reflectionContext);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Primitives.ComposablePart CreatePart(object attributedPart, class System.Reflection.ReflectionContext reflectionContext) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ComposablePart</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="attributedPart" Type="System.Object" /> - <Parameter Name="reflectionContext" Type="System.Reflection.ReflectionContext" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Creates a composable part from the specified attributed object, using the specified reflection context.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The created part.</para> - </returns> - <param name="attributedPart"> - <attribution license="cc4" from="Microsoft" modified="false" />The attributed object.</param> - <param name="reflectionContext"> - <attribution license="cc4" from="Microsoft" modified="false" />The reflection context for the part.</param> - </Docs> - </Member> - <Member MemberName="CreatePartDefinition"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Primitives.ComposablePartDefinition CreatePartDefinition (Type type, System.ComponentModel.Composition.Primitives.ICompositionElement origin);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Primitives.ComposablePartDefinition CreatePartDefinition(class System.Type type, class System.ComponentModel.Composition.Primitives.ICompositionElement origin) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ComposablePartDefinition</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="type" Type="System.Type" /> - <Parameter Name="origin" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Creates a part definition with the specified type and origin.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The new part definition.</para> - </returns> - <param name="type"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the definition.</param> - <param name="origin"> - <attribution license="cc4" from="Microsoft" modified="false" />The origin of the definition.</param> - </Docs> - </Member> - <Member MemberName="CreatePartDefinition"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Primitives.ComposablePartDefinition CreatePartDefinition (Type type, System.ComponentModel.Composition.Primitives.ICompositionElement origin, bool ensureIsDiscoverable);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Primitives.ComposablePartDefinition CreatePartDefinition(class System.Type type, class System.ComponentModel.Composition.Primitives.ICompositionElement origin, bool ensureIsDiscoverable) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ComposablePartDefinition</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="type" Type="System.Type" /> - <Parameter Name="origin" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - <Parameter Name="ensureIsDiscoverable" Type="System.Boolean" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Creates a part definition with the specified type and origin.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The new part definition.</para> - </returns> - <param name="type"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the definition.</param> - <param name="origin"> - <attribution license="cc4" from="Microsoft" modified="false" />The origin of the definition.</param> - <param name="ensureIsDiscoverable"> - <attribution license="cc4" from="Microsoft" modified="false" />A value indicating whether or not the new definition should be discoverable.</param> - </Docs> - </Member> - <Member MemberName="Exports"> - <MemberSignature Language="C#" Value="public static bool Exports (this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, Type contractType);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool Exports(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, class System.Type contractType) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" RefType="this" /> - <Parameter Name="contractType" Type="System.Type" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns a value that indicates whether the specified part contains an export that matches the specified contract type.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>true if <paramref name="part" /> contains an export definition that matches <paramref name="contractType" />; otherwise, false.</para> - </returns> - <param name="part"> - <attribution license="cc4" from="Microsoft" modified="false" />The part to search.</param> - <param name="contractType"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract type.</param> - </Docs> - </Member> - <Member MemberName="Exports<T>"> - <MemberSignature Language="C#" Value="public static bool Exports<T> (this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool Exports<T>(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition part) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" RefType="this" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns a value that indicates whether the specified part contains an export that matches the specified contract type.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>true if <paramref name="part" /> contains an export definition of type <paramref name="T" />; otherwise, false.</para> - </returns> - <param name="part"> - <attribution license="cc4" from="Microsoft" modified="false" />The part to search.</param> - <typeparam name="T"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract type.</typeparam> - </Docs> - </Member> - <Member MemberName="GetContractName"> - <MemberSignature Language="C#" Value="public static string GetContractName (Type type);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig string GetContractName(class System.Type type) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="type" Type="System.Type" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a canonical contract name for the specified type.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A contract name created from the specified type.</para> - </returns> - <param name="type"> - <attribution license="cc4" from="Microsoft" modified="false" />The type to use.</param> - </Docs> - </Member> - <Member MemberName="GetMetadataView<TMetadataView>"> - <MemberSignature Language="C#" Value="public static TMetadataView GetMetadataView<TMetadataView> (System.Collections.Generic.IDictionary<string,object> metadata);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig !!TMetadataView GetMetadataView<TMetadataView>(class System.Collections.Generic.IDictionary`2<string, object> metadata) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>TMetadataView</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="TMetadataView" /> - </TypeParameters> - <Parameters> - <Parameter Name="metadata" Type="System.Collections.Generic.IDictionary<System.String,System.Object>" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a metadata view object from a dictionary of loose metadata.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A metadata view containing the specified metadata.</para> - </returns> - <param name="metadata"> - <attribution license="cc4" from="Microsoft" modified="false" />A collection of loose metadata.</param> - <typeparam name="TMetadataView"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the metadata view object to get.</typeparam> - </Docs> - </Member> - <Member MemberName="GetTypeIdentity"> - <MemberSignature Language="C#" Value="public static string GetTypeIdentity (System.Reflection.MethodInfo method);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig string GetTypeIdentity(class System.Reflection.MethodInfo method) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="method" Type="System.Reflection.MethodInfo" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the unique identifier for the specified method.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The unique identifier for the method.</para> - </returns> - <param name="method"> - <attribution license="cc4" from="Microsoft" modified="false" />The method to examine.</param> - </Docs> - </Member> - <Member MemberName="GetTypeIdentity"> - <MemberSignature Language="C#" Value="public static string GetTypeIdentity (Type type);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig string GetTypeIdentity(class System.Type type) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="type" Type="System.Type" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the unique identifier for the specified type.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The unique identifier for the type.</para> - </returns> - <param name="type"> - <attribution license="cc4" from="Microsoft" modified="false" />The type to examine.</param> - </Docs> - </Member> - <Member MemberName="Imports"> - <MemberSignature Language="C#" Value="public static bool Imports (this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, Type contractType);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool Imports(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, class System.Type contractType) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" RefType="this" /> - <Parameter Name="contractType" Type="System.Type" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns a value that indicates whether the specified part contains an import that matches the specified contract type.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>true if <paramref name="part" /> contains an import definition that matches <paramref name="contractType" />; otherwise, false.</para> - </returns> - <param name="part"> - <attribution license="cc4" from="Microsoft" modified="false" />The part to search.</param> - <param name="contractType"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract type.</param> - </Docs> - </Member> - <Member MemberName="Imports"> - <MemberSignature Language="C#" Value="public static bool Imports (this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, Type contractType, System.ComponentModel.Composition.Primitives.ImportCardinality importCardinality);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool Imports(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, class System.Type contractType, valuetype System.ComponentModel.Composition.Primitives.ImportCardinality importCardinality) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" RefType="this" /> - <Parameter Name="contractType" Type="System.Type" /> - <Parameter Name="importCardinality" Type="System.ComponentModel.Composition.Primitives.ImportCardinality" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns a value that indicates whether the specified part contains an import that matches the specified contract type and import cardinality.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>true if <paramref name="part" /> contains an import definition that matches <paramref name="contractType" /> and <paramref name="importCardinality" />; otherwise, false.</para> - </returns> - <param name="part"> - <attribution license="cc4" from="Microsoft" modified="false" />The part to search.</param> - <param name="contractType"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract type.</param> - <param name="importCardinality"> - <attribution license="cc4" from="Microsoft" modified="false" />The import cardinality.</param> - </Docs> - </Member> - <Member MemberName="Imports<T>"> - <MemberSignature Language="C#" Value="public static bool Imports<T> (this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool Imports<T>(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition part) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" RefType="this" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns a value that indicates whether the specified part contains an import that matches the specified contract type.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>true if <paramref name="part" /> contains an import definition of type <paramref name="T" />; otherwise, false.</para> - </returns> - <param name="part"> - <attribution license="cc4" from="Microsoft" modified="false" />The part to search.</param> - <typeparam name="T"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract type.</typeparam> - </Docs> - </Member> - <Member MemberName="Imports<T>"> - <MemberSignature Language="C#" Value="public static bool Imports<T> (this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, System.ComponentModel.Composition.Primitives.ImportCardinality importCardinality);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool Imports<T>(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, valuetype System.ComponentModel.Composition.Primitives.ImportCardinality importCardinality) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" RefType="this" /> - <Parameter Name="importCardinality" Type="System.ComponentModel.Composition.Primitives.ImportCardinality" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns a value that indicates whether the specified part contains an import that matches the specified contract type and import cardinality.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>true if <paramref name="part" /> contains an import definition of type <paramref name="T" /> that has the specified import cardinality; otherwise, false.</para> - </returns> - <param name="part"> - <attribution license="cc4" from="Microsoft" modified="false" />The part to search.</param> - <param name="importCardinality"> - <attribution license="cc4" from="Microsoft" modified="false" />The import cardinality.</param> - <typeparam name="T"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract type.</typeparam> - </Docs> - </Member> - <Member MemberName="SatisfyImportsOnce"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Primitives.ComposablePart SatisfyImportsOnce (this System.ComponentModel.Composition.ICompositionService compositionService, object attributedPart);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Primitives.ComposablePart SatisfyImportsOnce(class System.ComponentModel.Composition.ICompositionService compositionService, object attributedPart) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ComposablePart</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="compositionService" Type="System.ComponentModel.Composition.ICompositionService" RefType="this" /> - <Parameter Name="attributedPart" Type="System.Object" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Unlike ordinary composition, parts composed with this method are not guaranteed to remain valid if the catalog behind <paramref name="compositionService" /> changes.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Composes the specified part by using the specified composition service, with recomposition disabled.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The composed part.</para> - </returns> - <param name="compositionService"> - <attribution license="cc4" from="Microsoft" modified="false" />The composition service to use.</param> - <param name="attributedPart"> - <attribution license="cc4" from="Microsoft" modified="false" />The part to compose.</param> - </Docs> - </Member> - <Member MemberName="SatisfyImportsOnce"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Primitives.ComposablePart SatisfyImportsOnce (this System.ComponentModel.Composition.ICompositionService compositionService, object attributedPart, System.Reflection.ReflectionContext reflectionContext);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Primitives.ComposablePart SatisfyImportsOnce(class System.ComponentModel.Composition.ICompositionService compositionService, object attributedPart, class System.Reflection.ReflectionContext reflectionContext) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ComposablePart</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="compositionService" Type="System.ComponentModel.Composition.ICompositionService" RefType="this" /> - <Parameter Name="attributedPart" Type="System.Object" /> - <Parameter Name="reflectionContext" Type="System.Reflection.ReflectionContext" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Composes the specified part by using the specified composition service, with recomposition disabled and using the specified reflection context.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The composed part.</para> - </returns> - <param name="compositionService"> - <attribution license="cc4" from="Microsoft" modified="false" />The composition service to use.</param> - <param name="attributedPart"> - <attribution license="cc4" from="Microsoft" modified="false" />The part to compose.</param> - <param name="reflectionContext"> - <attribution license="cc4" from="Microsoft" modified="false" />The reflection context for the part.</param> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/CatalogReflectionContextAttribute.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/CatalogReflectionContextAttribute.xml deleted file mode 100644 index e4500e9a8c2..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/CatalogReflectionContextAttribute.xml +++ /dev/null @@ -1,70 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="CatalogReflectionContextAttribute" FullName="System.ComponentModel.Composition.CatalogReflectionContextAttribute"> - <TypeSignature Language="C#" Value="public class CatalogReflectionContextAttribute : Attribute" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit CatalogReflectionContextAttribute extends System.Attribute" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Attribute</BaseTypeName> - </Base> - <Interfaces /> - <Attributes> - <Attribute> - <AttributeName>System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=true)</AttributeName> - </Attribute> - </Attributes> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>When applied to a <see cref="T:System.Reflection.Assembly" /> object, enables an <see cref="T:System.ComponentModel.Composition.Hosting.AssemblyCatalog" /> object to discover custom <see cref="T:System.Reflection.ReflectionContext" /> objects.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CatalogReflectionContextAttribute (Type reflectionContextType);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Type reflectionContextType) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="reflectionContextType" Type="System.Type" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.Hosting.AssemblyCatalog" /> class with the specified <see cref="T:System.Reflection.ReflectionContext" /> type.</para> - </summary> - <param name="reflectionContextType"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the reflection context.</param> - </Docs> - </Member> - <Member MemberName="CreateReflectionContext"> - <MemberSignature Language="C#" Value="public System.Reflection.ReflectionContext CreateReflectionContext ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Reflection.ReflectionContext CreateReflectionContext() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Reflection.ReflectionContext</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Creates an instance of the custom <see cref="T:System.Reflection.ReflectionContext" /> object.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>An instance of the custom reflection context.</para> - </returns> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ChangeRejectedException.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ChangeRejectedException.xml deleted file mode 100644 index 9f8ca2a5054..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ChangeRejectedException.xml +++ /dev/null @@ -1,227 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ChangeRejectedException" FullName="System.ComponentModel.Composition.ChangeRejectedException"> - <TypeSignature Language="C#" Value="public class ChangeRejectedException : System.ComponentModel.Composition.CompositionException" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi serializable beforefieldinit ChangeRejectedException extends System.ComponentModel.Composition.CompositionException" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.ComponentModel.Composition.CompositionException</BaseTypeName> - </Base> - <Interfaces /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>An exception that indicates whether a part has been rejected during composition.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ChangeRejectedException ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This constructor initializes the <see cref="P:System.Exception.Message" /> property of the new instance to a system-supplied message that describes the error, such as "DefaultMessageDisplayedByParameterlessCtorWriterMustSupply" This message takes into account the current system culture.</para> - <para>The following table shows the initial property values for an instance of <see cref="T:System.InsufficientMemoryException" />.</para> - <list type="table"> - <listheader> - <item> - <term> - <para>Property </para> - </term> - <description> - <para>Value </para> - </description> - </item> - </listheader> - <item> - <term> - <para> - <see cref="P:System.Exception.InnerException" /> - </para> - </term> - <description> - <para>null.</para> - </description> - </item> - <item> - <term> - <para> - <see cref="P:System.Exception.Message" /> - </para> - </term> - <description> - <para>The localized error message string. </para> - </description> - </item> - </list> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ChangeRejectedException" /> class with a system-supplied message that describes the error.</para> - </summary> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ChangeRejectedException (System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.CompositionError> errors);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.CompositionError> errors) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="errors" Type="System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.CompositionError>" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ChangeRejectedException" /> class with a list of composition errors. </para> - </summary> - <param name="errors"> - <attribution license="cc4" from="Microsoft" modified="false" />A collection of errors that occurred during composition.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ChangeRejectedException (string message);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string message) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="message" Type="System.String" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The following table shows the initial property values for an instance of <see cref="T:System.ComponentModel.Composition.ChangeRejectedException" />.</para> - <list type="table"> - <listheader> - <item> - <term> - <para>Property </para> - </term> - <description> - <para>Value </para> - </description> - </item> - </listheader> - <item> - <term> - <para> - <see cref="P:System.Exception.InnerException" /> - </para> - </term> - <description> - <para>null.</para> - </description> - </item> - <item> - <term> - <para> - <see cref="P:System.Exception.Message" /> - </para> - </term> - <description> - <para>The error message string specified in <paramref name="message" />. </para> - </description> - </item> - </list> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ChangeRejectedException" /> class with a specified message that describes the error.</para> - </summary> - <param name="message"> - <attribution license="cc4" from="Microsoft" modified="false" />The message that describes the exception. The caller of this constructor is required to ensure that this string has been localized for the current system culture.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ChangeRejectedException (string message, Exception innerException);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string message, class System.Exception innerException) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="message" Type="System.String" /> - <Parameter Name="innerException" Type="System.Exception" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>An exception that is thrown as a direct result of a previous exception should include a reference to the previous exception in the <see cref="P:System.Exception.InnerException" /> property. The <see cref="P:System.Exception.InnerException" /> property returns the same value that is passed to the constructor, or null if the <see cref="P:System.Exception.InnerException" /> property does not supply the inner exception value to the constructor.</para> - <para>The following table shows the initial property values for an instance of <see cref="T:System.ComponentModel.Composition.ChangeRejectedException" />.</para> - <list type="table"> - <listheader> - <item> - <term> - <para>Property </para> - </term> - <description> - <para>Value </para> - </description> - </item> - </listheader> - <item> - <term> - <para> - <see cref="P:System.Exception.InnerException" /> - </para> - </term> - <description> - <para>null. </para> - </description> - </item> - <item> - <term> - <para> - <see cref="P:System.Exception.Message" /> - </para> - </term> - <description> - <para>The error message string specified in <paramref name="message" />. </para> - </description> - </item> - </list> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ChangeRejectedException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.</para> - </summary> - <param name="message"> - <attribution license="cc4" from="Microsoft" modified="false" />The message that describes the exception. The caller of this constructor is required to ensure that this string has been localized for the current system culture. </param> - <param name="innerException"> - <attribution license="cc4" from="Microsoft" modified="false" />The exception that is the cause of the current exception. If the <paramref name="innerException" /> parameter is not null, the current exception is raised in a catch block that handles the inner exception. </param> - </Docs> - </Member> - <Member MemberName="Message"> - <MemberSignature Language="C#" Value="public override string Message { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance string Message" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets or sets the message associated with the component rejection.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/CompositionContractMismatchException.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/CompositionContractMismatchException.xml deleted file mode 100644 index 663127276cf..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/CompositionContractMismatchException.xml +++ /dev/null @@ -1,219 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="CompositionContractMismatchException" FullName="System.ComponentModel.Composition.CompositionContractMismatchException"> - <TypeSignature Language="C#" Value="public class CompositionContractMismatchException : Exception" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi serializable beforefieldinit CompositionContractMismatchException extends System.Exception" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Exception</BaseTypeName> - </Base> - <Interfaces /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The exception that is thrown when the underlying exported value or metadata of a <see cref="T:System.Lazy`1" /> or <see cref="T:System.Lazy`2" /> object cannot be cast to T or TMetadataView, respectively.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CompositionContractMismatchException ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This constructor initializes the <see cref="P:System.Exception.Message" /> property of the new instance to a system-supplied message that describes the error, such as "DefaultMessageDisplayedByParameterlessCtorWriterMustSupply". This message takes into account the current system culture.</para> - <para>The following table shows the initial property values for an instance of <see cref="T:System.InsufficientMemoryException" />.</para> - <list type="table"> - <listheader> - <item> - <term> - <para>Property </para> - </term> - <description> - <para>Value </para> - </description> - </item> - </listheader> - <item> - <term> - <para> - <see cref="P:System.Exception.InnerException" /> - </para> - </term> - <description> - <para>null.</para> - </description> - </item> - <item> - <term> - <para> - <see cref="P:System.Exception.Message" /> - </para> - </term> - <description> - <para>The localized error message string. </para> - </description> - </item> - </list> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.CompositionContractMismatchException" /> class with a system-supplied message that describes the error.</para> - </summary> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CompositionContractMismatchException (string message);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string message) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="message" Type="System.String" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The following table shows the initial property values for an instance of <see cref="T:System.ComponentModel.Composition.CompositionContractMismatchException" />.</para> - <list type="table"> - <listheader> - <item> - <term> - <para>Property </para> - </term> - <description> - <para>Value </para> - </description> - </item> - </listheader> - <item> - <term> - <para> - <see cref="P:System.Exception.InnerException" /> - </para> - </term> - <description> - <para>null.</para> - </description> - </item> - <item> - <term> - <para> - <see cref="P:System.Exception.Message" /> - </para> - </term> - <description> - <para>The error message string specified in <paramref name="message" />. </para> - </description> - </item> - </list> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.CompositionContractMismatchException" /> class with a specified message that describes the error.</para> - </summary> - <param name="message"> - <attribution license="cc4" from="Microsoft" modified="false" />The message that describes the exception. The caller of this constructor is required to ensure that this string has been localized for the current system culture.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="protected CompositionContractMismatchException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor(class System.Runtime.Serialization.SerializationInfo info, valuetype System.Runtime.Serialization.StreamingContext context) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Attributes> - <Attribute> - <AttributeName>System.Security.SecuritySafeCritical</AttributeName> - </Attribute> - </Attributes> - <Parameters> - <Parameter Name="info" Type="System.Runtime.Serialization.SerializationInfo" /> - <Parameter Name="context" Type="System.Runtime.Serialization.StreamingContext" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This constructor is called during deserialization to reconstitute the exception object transmitted over a stream. For more information, see <format type="text/html"><a href="832ac524-21bc-419a-a27b-ca8bfc45840f">XML and Soap Serialization</a></format>.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.CompositionContractMismatchException" /> class with serialized data.</para> - </summary> - <param name="info"> - <attribution license="cc4" from="Microsoft" modified="false" />The object that holds the serialized object data. </param> - <param name="context"> - <attribution license="cc4" from="Microsoft" modified="false" />The contextual information about the source or destination. </param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CompositionContractMismatchException (string message, Exception innerException);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string message, class System.Exception innerException) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="message" Type="System.String" /> - <Parameter Name="innerException" Type="System.Exception" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>An exception that is thrown as a direct result of a previous exception should include a reference to the previous exception in the <see cref="P:System.Exception.InnerException" /> property. The <see cref="P:System.Exception.InnerException" /> property returns the same value that is passed into the constructor, or null if the <see cref="P:System.Exception.InnerException" /> property does not supply the inner exception value to the constructor.</para> - <para>The following table shows the initial property values for an instance of <see cref="T:System.ComponentModel.Composition.CompositionContractMismatchException" />.</para> - <list type="table"> - <listheader> - <item> - <term> - <para>Property </para> - </term> - <description> - <para>Value </para> - </description> - </item> - </listheader> - <item> - <term> - <para> - <see cref="P:System.Exception.InnerException" /> - </para> - </term> - <description> - <para>null. </para> - </description> - </item> - <item> - <term> - <para> - <see cref="P:System.Exception.Message" /> - </para> - </term> - <description> - <para>The error message string specified in <paramref name="message" />. </para> - </description> - </item> - </list> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.CompositionContractMismatchException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.</para> - </summary> - <param name="message"> - <attribution license="cc4" from="Microsoft" modified="false" />The message that describes the exception. The caller of this constructor is required to ensure that this string has been localized for the current system culture. </param> - <param name="innerException"> - <attribution license="cc4" from="Microsoft" modified="false" />The exception that is the cause of the current exception. If the <paramref name="innerException" /> parameter is not null, the current exception is raised in a catch block that handles the inner exception. </param> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/CompositionError.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/CompositionError.xml deleted file mode 100644 index 24e67be6a23..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/CompositionError.xml +++ /dev/null @@ -1,199 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="CompositionError" FullName="System.ComponentModel.Composition.CompositionError"> - <TypeSignature Language="C#" Value="public class CompositionError" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi serializable beforefieldinit CompositionError extends System.Object" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Object</BaseTypeName> - </Base> - <Interfaces /> - <Attributes> - <Attribute> - <AttributeName>System.Diagnostics.DebuggerTypeProxy(typeof(System.ComponentModel.Composition.CompositionErrorDebuggerProxy))</AttributeName> - </Attribute> - </Attributes> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Represents an error that occurred during composition.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CompositionError (string message);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string message) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="message" Type="System.String" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.CompositionError" /> class with the specified error message.</para> - </summary> - <param name="message"> - <attribution license="cc4" from="Microsoft" modified="false" />A message that describes the <see cref="T:System.ComponentModel.Composition.CompositionError" /> or null to set the <see cref="P:System.ComponentModel.Composition.CompositionError.Description" /> property to an empty string ("").</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CompositionError (string message, System.ComponentModel.Composition.Primitives.ICompositionElement element);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string message, class System.ComponentModel.Composition.Primitives.ICompositionElement element) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="message" Type="System.String" /> - <Parameter Name="element" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.CompositionError" /> class with the specified error message and the composition element that is the cause of the composition error.</para> - </summary> - <param name="message"> - <attribution license="cc4" from="Microsoft" modified="false" />A message that describes the <see cref="T:System.ComponentModel.Composition.CompositionError" /> or null to set the <see cref="P:System.ComponentModel.Composition.CompositionError.Description" /> property to an empty string ("").</param> - <param name="element"> - <attribution license="cc4" from="Microsoft" modified="false" />The composition element that is the cause of the <see cref="T:System.ComponentModel.Composition.CompositionError" /> or null to set the <see cref="P:System.ComponentModel.Composition.CompositionError.Element" /> property to null.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CompositionError (string message, Exception exception);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string message, class System.Exception exception) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="message" Type="System.String" /> - <Parameter Name="exception" Type="System.Exception" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.CompositionError" /> class with the specified error message and the exception that is the cause of the composition error.</para> - </summary> - <param name="message"> - <attribution license="cc4" from="Microsoft" modified="false" />A message that describes the <see cref="T:System.ComponentModel.Composition.CompositionError" /> or null to set the <see cref="P:System.ComponentModel.Composition.CompositionError.Description" /> property to an empty string ("").</param> - <param name="exception"> - <attribution license="cc4" from="Microsoft" modified="false" />The <see cref="P:System.ComponentModel.Composition.CompositionError.Exception" /> that is the underlying cause of the <see cref="T:System.ComponentModel.Composition.CompositionError" /> or null to set the <see cref="P:System.ComponentModel.Composition.CompositionError.Exception" /> property to null.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CompositionError (string message, System.ComponentModel.Composition.Primitives.ICompositionElement element, Exception exception);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string message, class System.ComponentModel.Composition.Primitives.ICompositionElement element, class System.Exception exception) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="message" Type="System.String" /> - <Parameter Name="element" Type="System.ComponentModel.Composition.Primitives.ICompositionElement" /> - <Parameter Name="exception" Type="System.Exception" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.CompositionError" /> class with the specified error message, and the composition element and exception that are the cause of the composition error.</para> - </summary> - <param name="message"> - <attribution license="cc4" from="Microsoft" modified="false" />A message that describes the <see cref="T:System.ComponentModel.Composition.CompositionError" /> or null to set the <see cref="P:System.ComponentModel.Composition.CompositionError.Description" /> property to an empty string ("").</param> - <param name="element"> - <attribution license="cc4" from="Microsoft" modified="false" />The composition element that is the cause of the <see cref="T:System.ComponentModel.Composition.CompositionError" /> or null to set the <see cref="P:System.ComponentModel.Composition.CompositionError.Element" /> property to null.</param> - <param name="exception"> - <attribution license="cc4" from="Microsoft" modified="false" />The <see cref="P:System.ComponentModel.Composition.CompositionError.Exception" /> that is the underlying cause of the <see cref="T:System.ComponentModel.Composition.CompositionError" /> or null to set the <see cref="P:System.ComponentModel.Composition.CompositionError.Exception" /> property to null.</param> - </Docs> - </Member> - <Member MemberName="Description"> - <MemberSignature Language="C#" Value="public string Description { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance string Description" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a description of the composition error.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Element"> - <MemberSignature Language="C#" Value="public System.ComponentModel.Composition.Primitives.ICompositionElement Element { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.ComponentModel.Composition.Primitives.ICompositionElement Element" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ICompositionElement</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the composition element that is the cause of the error.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Exception"> - <MemberSignature Language="C#" Value="public Exception Exception { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Exception Exception" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Exception</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the exception that is the underlying cause of the composition error.</para> - </summary> - </Docs> - </Member> - <Member MemberName="ToString"> - <MemberSignature Language="C#" Value="public override string ToString ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance string ToString() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Returns a string representation of the composition error.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A string that contains the <see cref="P:System.ComponentModel.Composition.CompositionError.Description" /> property.</para> - </returns> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/CompositionException.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/CompositionException.xml deleted file mode 100644 index 80af0091e07..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/CompositionException.xml +++ /dev/null @@ -1,147 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="CompositionException" FullName="System.ComponentModel.Composition.CompositionException"> - <TypeSignature Language="C#" Value="public class CompositionException : Exception" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi serializable beforefieldinit CompositionException extends System.Exception" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Exception</BaseTypeName> - </Base> - <Interfaces /> - <Attributes> - <Attribute> - <AttributeName>System.Diagnostics.DebuggerDisplay("{Message}")</AttributeName> - </Attribute> - <Attribute> - <AttributeName>System.Diagnostics.DebuggerTypeProxy(typeof(System.ComponentModel.Composition.CompositionExceptionDebuggerProxy))</AttributeName> - </Attribute> - </Attributes> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Represents the exception that is thrown when one or more errors occur during composition in a <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> object.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CompositionException ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.CompositionException" /> class.</para> - </summary> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CompositionException (System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.CompositionError> errors);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Collections.Generic.IEnumerable`1<class System.ComponentModel.Composition.CompositionError> errors) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="errors" Type="System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.CompositionError>" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.CompositionException" /> class with the specified collection of composition errors.</para> - </summary> - <param name="errors"> - <attribution license="cc4" from="Microsoft" modified="false" />A collection of <see cref="T:System.ComponentModel.Composition.CompositionError" /> objects that represent problems during composition.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CompositionException (string message);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string message) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="message" Type="System.String" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.CompositionException" /> class with the specified error message.</para> - </summary> - <param name="message"> - <attribution license="cc4" from="Microsoft" modified="false" />A message that describes the <see cref="T:System.ComponentModel.Composition.CompositionException" /> or null to set the <see cref="P:System.Exception.Message" /> property to its default value.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public CompositionException (string message, Exception innerException);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string message, class System.Exception innerException) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="message" Type="System.String" /> - <Parameter Name="innerException" Type="System.Exception" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.CompositionException" /> class with the specified error message and the exception that is the cause of this exception.</para> - </summary> - <param name="message"> - <attribution license="cc4" from="Microsoft" modified="false" />A message that describes the <see cref="T:System.ComponentModel.Composition.CompositionException" /> or null to set the <see cref="P:System.Exception.Message" /> property to its default value.</param> - <param name="innerException"> - <attribution license="cc4" from="Microsoft" modified="false" />The exception that is the underlying cause of the <see cref="T:System.ComponentModel.Composition.CompositionException" /> or null to set the <see cref="P:System.Exception.InnerException" /> property to null.</param> - </Docs> - </Member> - <Member MemberName="Errors"> - <MemberSignature Language="C#" Value="public System.Collections.ObjectModel.ReadOnlyCollection<System.ComponentModel.Composition.CompositionError> Errors { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.ObjectModel.ReadOnlyCollection`1<class System.ComponentModel.Composition.CompositionError> Errors" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Collections.ObjectModel.ReadOnlyCollection<System.ComponentModel.Composition.CompositionError></ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets or sets a collection of <see cref="T:System.ComponentModel.Composition.CompositionError" /> objects that describe the errors associated with the <see cref="T:System.ComponentModel.Composition.CompositionException" />.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Message"> - <MemberSignature Language="C#" Value="public override string Message { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance string Message" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets a message that describes the exception.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/CreationPolicy.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/CreationPolicy.xml deleted file mode 100644 index dc41e32676f..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/CreationPolicy.xml +++ /dev/null @@ -1,158 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="CreationPolicy" FullName="System.ComponentModel.Composition.CreationPolicy"> - <TypeSignature Language="C#" Value="public enum CreationPolicy" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed CreationPolicy extends System.Enum" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Enum</BaseTypeName> - </Base> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>In the course of composition, the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> needs instances of the objects described by exports in order to fill imports. If a one export is used to fill multiple imports, there are two possible behaviors. Either a single instance of the exported object is created, and a reference to the same object is given to every importer, or a separate instance of the exported object is created for each importer. </para> - <para>Which behavior occurs depends on the <see cref="P:System.ComponentModel.Composition.PartCreationPolicyAttribute.CreationPolicy" /> property of the <see cref="T:System.ComponentModel.Composition.PartCreationPolicyAttribute" /> attached to the export and the <see cref="P:System.ComponentModel.Composition.ImportAttribute.RequiredCreationPolicy" /> of the <see cref="T:System.ComponentModel.Composition.ImportAttribute" />. Both of which will contain a value from the <see cref="T:System.ComponentModel.Composition.CreationPolicy" /> enumeration. If the policies are incompatible, that export will not be considered a match for the given import. The following table summarizes the interaction of these two properties.</para> - <list type="table"> - <listheader> - <item> - <term> - <para> - <see cref="P:System.ComponentModel.Composition.ImportAttribute.RequiredCreationPolicy" /> - </para> - </term> - <description> - <para>Export's <see cref="P:System.ComponentModel.Composition.PartCreationPolicyAttribute.CreationPolicy" /> specifies <see cref="F:System.ComponentModel.Composition.CreationPolicy.Any" /> or none specified.</para> - </description> - <description> - <para>Export's <see cref="P:System.ComponentModel.Composition.PartCreationPolicyAttribute.CreationPolicy" /> specifies <see cref="F:System.ComponentModel.Composition.CreationPolicy.Shared" /></para> - </description> - <description> - <para>Export's <see cref="P:System.ComponentModel.Composition.PartCreationPolicyAttribute.CreationPolicy" /> specifies <see cref="F:System.ComponentModel.Composition.CreationPolicy.NonShared" /></para> - </description> - </item> - </listheader> - <item> - <term> - <para> - <see cref="F:System.ComponentModel.Composition.CreationPolicy.Any" /> - </para> - </term> - <description> - <para>A single, shared instance of the exported object will be created.</para> - </description> - <description> - <para>A single, shared instance of the exported object will be created.</para> - </description> - <description> - <para>A new instance of the exported object will be created for each importer.</para> - </description> - </item> - <item> - <term> - <para> - <see cref="F:System.ComponentModel.Composition.CreationPolicy.Shared" /> - </para> - </term> - <description> - <para>A single, shared instance of the exported object will be created.</para> - </description> - <description> - <para>A single, shared instance of the exported object will be created.</para> - </description> - <description> - <para>The export will not be considered a match for the import.</para> - </description> - </item> - <item> - <term> - <para> - <see cref="F:System.ComponentModel.Composition.CreationPolicy.NonShared" /> - </para> - </term> - <description> - <para>A new instance of the exported object will be created for each importer.</para> - </description> - <description> - <para>The export will not be considered a match for the import.</para> - </description> - <description> - <para>A new instance of the exported object will be created for each importer.</para> - </description> - </item> - </list> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Specifies when and how a part will be instantiated.</para> - </summary> - </Docs> - <Members> - <Member MemberName="Any"> - <MemberSignature Language="C#" Value="Any" /> - <MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.ComponentModel.Composition.CreationPolicy Any = int32(0)" /> - <MemberType>Field</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.CreationPolicy</ReturnType> - </ReturnValue> - <Docs> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Specifies that the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> will use the most appropriate <see cref="T:System.ComponentModel.Composition.CreationPolicy" /> for the part given the current context. This is the default <see cref="T:System.ComponentModel.Composition.CreationPolicy" />. By default, <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> will use <see cref="F:System.ComponentModel.Composition.CreationPolicy.Shared" />, unless the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> or importer requests <see cref="F:System.ComponentModel.Composition.CreationPolicy.NonShared" />.</para> - </summary> - </Docs> - </Member> - <Member MemberName="NewScope"> - <MemberSignature Language="C#" Value="NewScope" /> - <MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.ComponentModel.Composition.CreationPolicy NewScope = int32(3)" /> - <MemberType>Field</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.CreationPolicy</ReturnType> - </ReturnValue> - <Docs> - <summary>To be added.</summary> - </Docs> - </Member> - <Member MemberName="NonShared"> - <MemberSignature Language="C#" Value="NonShared" /> - <MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.ComponentModel.Composition.CreationPolicy NonShared = int32(2)" /> - <MemberType>Field</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.CreationPolicy</ReturnType> - </ReturnValue> - <Docs> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Specifies that a new non-shared instance of the associated <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> will be created by the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> for every requestor.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Shared"> - <MemberSignature Language="C#" Value="Shared" /> - <MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.ComponentModel.Composition.CreationPolicy Shared = int32(1)" /> - <MemberType>Field</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.CreationPolicy</ReturnType> - </ReturnValue> - <Docs> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Specifies that a single shared instance of the associated <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> will be created by the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> and shared by all requestors.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ExportAttribute.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ExportAttribute.xml deleted file mode 100644 index f11134e56d4..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ExportAttribute.xml +++ /dev/null @@ -1,166 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ExportAttribute" FullName="System.ComponentModel.Composition.ExportAttribute"> - <TypeSignature Language="C#" Value="public class ExportAttribute : Attribute" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit ExportAttribute extends System.Attribute" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Attribute</BaseTypeName> - </Base> - <Interfaces /> - <Attributes> - <Attribute> - <AttributeName>System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Field | System.AttributeTargets.All, AllowMultiple=true, Inherited=false)</AttributeName> - </Attribute> - </Attributes> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>In the Attributed Programming Model, the <see cref="T:System.ComponentModel.Composition.ExportAttribute" /> declares that a part exports, or provides to the composition container, an object that fulfills a particular contract. During composition, parts with imports that have matching contracts will have those dependencies filled by the exported object.</para> - <para>The <see cref="T:System.ComponentModel.Composition.ExportAttribute" /> can decorate either an entire class, or a property, field, or method of a class. If the entire class is decorated, an instance of the class is the exported object. If a member of a class is decorated, the exported object will be the value of the decorated member.</para> - <para>Whether or not a contract matches is determined primarily by the contract name and the contract type. For more information, see <see cref="T:System.ComponentModel.Composition.ImportAttribute" />.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Specifies that a type, property, field, or method provides a particular export.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ExportAttribute ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The default contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on the property or field type, or on the type that is marked with this attribute. </para> - <para>Methods marked with this attribute must specify a contract name or a type by using either <see cref="M:System.ComponentModel.Composition.ExportAttribute.#ctor(System.String)" /> or <see cref="M:System.ComponentModel.Composition.ExportAttribute.#ctor(System.Type)" />.</para> - <para>The contract name is compared by using the <see cref="P:System.StringComparer.Ordinal" /> property to perform a case-sensitive, non-linguistic comparison.</para> - <para> </para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ExportAttribute" /> class, exporting the type or member marked with this attribute under the default contract name.</para> - </summary> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ExportAttribute (string contractName);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string contractName) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="contractName" Type="System.String" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The default contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on the property or field type, or on the type that this is marked with this attribute. </para> - <para>Methods marked with this attribute must specify a contract name or a type by using either <see cref="M:System.ComponentModel.Composition.ExportAttribute.#ctor(System.String)" /> or <see cref="M:System.ComponentModel.Composition.ExportAttribute.#ctor(System.Type)" />.</para> - <para>The contract name is compared by using the <see cref="P:System.StringComparer.Ordinal" /> property to perform a case-sensitive, non-linguistic comparison.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ExportAttribute" /> class, exporting the type or member marked with this attribute under the specified contract name.</para> - </summary> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name that is used to export the type or member marked with this attribute, or null or an empty string ("") to use the default contract name.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ExportAttribute (Type contractType);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Type contractType) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="contractType" Type="System.Type" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on <paramref name="contractType" />.</para> - <para>The default contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on the property or field type, or on the type that is marked with this attribute. </para> - <para>Methods marked with this attribute must specify a contract name or a type by using either <see cref="M:System.ComponentModel.Composition.ExportAttribute.#ctor(System.String)" /> or <see cref="M:System.ComponentModel.Composition.ExportAttribute.#ctor(System.Type)" />.</para> - <para>The contract name is compared by using the <see cref="P:System.StringComparer.Ordinal" /> property to perform a case-sensitive, non-linguistic comparison.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ExportAttribute" /> class, exporting the type or member marked with this attribute under a contract name derived from the specified type.</para> - </summary> - <param name="contractType"> - <attribution license="cc4" from="Microsoft" modified="false" />A type from which to derive the contract name that is used to export the type or member marked with this attribute, or null to use the default contract name.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ExportAttribute (string contractName, Type contractType);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string contractName, class System.Type contractType) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="contractName" Type="System.String" /> - <Parameter Name="contractType" Type="System.Type" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ExportAttribute" /> class, exporting the specified type under the specified contract name.</para> - </summary> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name that is used to export the type or member marked with this attribute, or null or an empty string ("") to use the default contract name.</param> - <param name="contractType"> - <attribution license="cc4" from="Microsoft" modified="false" />The type to export.</param> - </Docs> - </Member> - <Member MemberName="ContractName"> - <MemberSignature Language="C#" Value="public string ContractName { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance string ContractName" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the contract name that is used to export the type or member marked with this attribute.</para> - </summary> - </Docs> - </Member> - <Member MemberName="ContractType"> - <MemberSignature Language="C#" Value="public Type ContractType { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Type ContractType" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Type</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the contract type that is exported by the member that this attribute is attached to.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ExportFactory`1.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ExportFactory`1.xml deleted file mode 100644 index 1b2b95edc66..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ExportFactory`1.xml +++ /dev/null @@ -1,108 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ExportFactory<T>" FullName="System.ComponentModel.Composition.ExportFactory<T>"> - <TypeSignature Language="C#" Value="public class ExportFactory<T>" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit ExportFactory`1<T> extends System.Object" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Base> - <BaseTypeName>System.Object</BaseTypeName> - </Base> - <Interfaces /> - <Docs> - <typeparam name="T">To be added.</typeparam> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>When you refer indirectly to a part by using a <see cref="T:System.Lazy`1" /> object, the <see cref="P:System.Lazy`1.Value" /> property always returns a reference to the same object. In some circumstances, you might want each reference to result in the creation of a new object. <see cref="T:System.ComponentModel.Composition.ExportFactory`1" /> is designed for those scenarios.</para> - <para> - <see cref="T:System.ComponentModel.Composition.ExportFactory`1" /> can be used in a similar fashion to <see cref="T:System.Lazy`1" /> when creating attributed parts. That is, an import contract that is defined on <see cref="T:System.ComponentModel.Composition.ExportFactory`1" /> with a generic parameter of <paramref name="T" /> will match an export that is defined on <paramref name="T" />. For example, the follow export and import match:</para> - <code>[Export] -public String myData = "Example Data."; - -[Import] -public ExportFactory<String> theData { get; set; }</code> - <code><Export()> -Public myData As String = "Example Data." - -<Import()> -Public Property theData As ExportFactory(Of String)</code> - <para>The <see cref="M:System.ComponentModel.Composition.ExportFactory`1.CreateExport" /> method returns an <see cref="T:System.ComponentModel.Composition.ExportLifetimeContext`1" /> object, which has two pieces. The <see cref="P:System.ComponentModel.Composition.ExportLifetimeContext`1.Value" /> property provides access to the created part. Calling the <see cref="M:System.ComponentModel.Composition.ExportLifetimeContext`1.Dispose" /> method of the <see cref="T:System.ComponentModel.Composition.ExportLifetimeContext`1" /> object cleans up the created part and all of its dependencies, thereby allowing the part's lifetime to be managed without reference to the container that created it.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A factory that creates new instances of a part that provides the specified export.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ExportFactory (Func<Tuple<T,Action>> exportLifetimeContextCreator);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Func`1<class System.Tuple`2<!T, class System.Action>> exportLifetimeContextCreator) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="exportLifetimeContextCreator" Type="System.Func<System.Tuple<T,System.Action>>" /> - </Parameters> - <Docs> - <param name="exportLifetimeContextCreator">To be added.</param> - <summary>To be added.</summary> - <remarks>To be added.</remarks> - </Docs> - </Member> - <Member MemberName="CreateExport"> - <MemberSignature Language="C#" Value="public System.ComponentModel.Composition.ExportLifetimeContext<T> CreateExport ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.ComponentModel.Composition.ExportLifetimeContext`1<!T> CreateExport() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.ExportLifetimeContext<T></ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Creates an instance of the factory's export type.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A valid instance of the factory's exported type.</para> - </returns> - </Docs> - </Member> - <Member MemberName="OnFilterScopedCatalog"> - <MemberSignature Language="C#" Value="protected virtual bool OnFilterScopedCatalog (System.ComponentModel.Composition.Primitives.ComposablePartDefinition composablePartDefinition);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance bool OnFilterScopedCatalog(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition composablePartDefinition) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="composablePartDefinition" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>When overridden in a derived class, filters part definitions in the scope of the <see cref="T:System.ComponentModel.Composition.ExportFactory`1" /> object.</para> - </summary> - <returns> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>true if the part definition should be included in the scope; otherwise, false.</para> - </returns> - <param name="composablePartDefinition"> - <attribution license="cc4" from="Microsoft" modified="false" />The part definition to filter.</param> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ExportFactory`2.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ExportFactory`2.xml deleted file mode 100644 index aef99868c3a..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ExportFactory`2.xml +++ /dev/null @@ -1,72 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ExportFactory<T,TMetadata>" FullName="System.ComponentModel.Composition.ExportFactory<T,TMetadata>"> - <TypeSignature Language="C#" Value="public class ExportFactory<T,TMetadata> : System.ComponentModel.Composition.ExportFactory<T>" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit ExportFactory`2<T, TMetadata> extends System.ComponentModel.Composition.ExportFactory`1<!T>" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <TypeParameters> - <TypeParameter Name="T" /> - <TypeParameter Name="TMetadata" /> - </TypeParameters> - <Base> - <BaseTypeName>System.ComponentModel.Composition.ExportFactory<T></BaseTypeName> - <BaseTypeArguments> - <BaseTypeArgument TypeParamName="T">T</BaseTypeArgument> - </BaseTypeArguments> - </Base> - <Interfaces /> - <Docs> - <typeparam name="T">To be added.</typeparam> - <typeparam name="TMetadata">To be added.</typeparam> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para> - <see cref="T:System.ComponentModel.Composition.ExportFactory`2" /> extends <see cref="T:System.ComponentModel.Composition.ExportFactory`1" /> to include a metadata object, in much the same way that <see cref="T:System.Lazy`2" /> extends <see cref="T:System.Lazy`1" />. For more information, see <see cref="T:System.ComponentModel.Composition.ExportFactory`1" /> and <see cref="T:System.Lazy`1" />.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>A factory that creates new instances of a part that provides the specified export, with attached metadata.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ExportFactory (Func<Tuple<T,Action>> exportLifetimeContextCreator, TMetadata metadata);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Func`1<class System.Tuple`2<!T, class System.Action>> exportLifetimeContextCreator, !TMetadata metadata) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="exportLifetimeContextCreator" Type="System.Func<System.Tuple<T,System.Action>>" /> - <Parameter Name="metadata" Type="TMetadata" /> - </Parameters> - <Docs> - <param name="exportLifetimeContextCreator">To be added.</param> - <param name="metadata">To be added.</param> - <summary>To be added.</summary> - <remarks>To be added.</remarks> - </Docs> - </Member> - <Member MemberName="Metadata"> - <MemberSignature Language="C#" Value="public TMetadata Metadata { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance !TMetadata Metadata" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>TMetadata</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the metadata to be attached to the created parts.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ExportLifetimeContext`1.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ExportLifetimeContext`1.xml deleted file mode 100644 index 18f8acb33db..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ExportLifetimeContext`1.xml +++ /dev/null @@ -1,94 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ExportLifetimeContext<T>" FullName="System.ComponentModel.Composition.ExportLifetimeContext<T>"> - <TypeSignature Language="C#" Value="public sealed class ExportLifetimeContext<T> : IDisposable" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit ExportLifetimeContext`1<T> extends System.Object implements class System.IDisposable" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Base> - <BaseTypeName>System.Object</BaseTypeName> - </Base> - <Interfaces> - <Interface> - <InterfaceName>System.IDisposable</InterfaceName> - </Interface> - </Interfaces> - <Docs> - <typeparam name="T">To be added.</typeparam> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Holds an exported value created by an <see cref="T:System.ComponentModel.Composition.ExportFactory`1" /> object and a reference to a method to release that object.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ExportLifetimeContext (T value, Action disposeAction);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(!T value, class System.Action disposeAction) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="value" Type="T" /> - <Parameter Name="disposeAction" Type="System.Action" /> - </Parameters> - <Docs> - <param name="value">To be added.</param> - <param name="disposeAction">To be added.</param> - <summary>To be added.</summary> - <remarks>To be added.</remarks> - </Docs> - </Member> - <Member MemberName="Dispose"> - <MemberSignature Language="C#" Value="public void Dispose ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Dispose() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Calling the Dispose method of a <see cref="T:System.ComponentModel.Composition.ExportLifetimeContext`1" /> object calls the referenced method to release its associated export.</para> - <para>Call Dispose when you are finished using the <see cref="T:System.ComponentModel.Composition.ExportLifetimeContext`1" />. The Dispose method leaves the <see cref="T:System.ComponentModel.Composition.ExportLifetimeContext`1" /> in an unusable state. After calling Dispose, you must release all references to the <see cref="T:System.ComponentModel.Composition.ExportLifetimeContext`1" /> so the garbage collector can reclaim the memory that the <see cref="T:System.ComponentModel.Composition.ExportLifetimeContext`1" /> was occupying.</para> - <para>For more information, see <see cref="http://go.microsoft.com/fwlink/?LinkId=187455">Cleaning Up Unmanaged Resources</see> and <see cref="http://go.microsoft.com/fwlink/?LinkId=187456">Implementing a Dispose Method</see>.</para> - <block subset="none" type="note"> - <para>Always call Dispose before you release your last reference to the <see cref="T:System.ComponentModel.Composition.ExportLifetimeContext`1" />. Otherwise, the resources it is using will not be freed until the garbage collector calls the <see cref="T:System.ComponentModel.Composition.ExportLifetimeContext`1" /> object's Finalize method.</para> - </block> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Releases all resources used by the current instance of the <see cref="T:System.ComponentModel.Composition.ExportLifetimeContext`1" /> class, including its associated export.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Value"> - <MemberSignature Language="C#" Value="public T Value { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance !T Value" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>T</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the exported value of a <see cref="T:System.ComponentModel.Composition.ExportFactory`1" /> object.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ExportMetadataAttribute.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ExportMetadataAttribute.xml deleted file mode 100644 index 04d61fae4bd..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ExportMetadataAttribute.xml +++ /dev/null @@ -1,107 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ExportMetadataAttribute" FullName="System.ComponentModel.Composition.ExportMetadataAttribute"> - <TypeSignature Language="C#" Value="public sealed class ExportMetadataAttribute : Attribute" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit ExportMetadataAttribute extends System.Attribute" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Attribute</BaseTypeName> - </Base> - <Interfaces /> - <Attributes> - <Attribute> - <AttributeName>System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.All, AllowMultiple=true, Inherited=false)</AttributeName> - </Attribute> - </Attributes> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Specifies metadata for a type, property, field, or method marked with the <see cref="T:System.ComponentModel.Composition.ExportAttribute" />.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ExportMetadataAttribute (string name, object value);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string name, object value) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="name" Type="System.String" /> - <Parameter Name="value" Type="System.Object" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ExportMetadataAttribute" /> with the specified name and metadata value.</para> - </summary> - <param name="name"> - <attribution license="cc4" from="Microsoft" modified="false" />A string that contains the name of the metadata value, or null to set the <see cref="P:System.ComponentModel.Composition.ExportMetadataAttribute.Name" /> property to an empty string ("").</param> - <param name="value"> - <attribution license="cc4" from="Microsoft" modified="false" />An object that contains the metadata value. This can be null.</param> - </Docs> - </Member> - <Member MemberName="IsMultiple"> - <MemberSignature Language="C#" Value="public bool IsMultiple { get; set; }" /> - <MemberSignature Language="ILAsm" Value=".property instance bool IsMultiple" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets or sets a value that indicates whether this item is marked with this attribute more than once.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Name"> - <MemberSignature Language="C#" Value="public string Name { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance string Name" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the name of the metadata value.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Value"> - <MemberSignature Language="C#" Value="public object Value { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance object Value" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Object</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the metadata value.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ICompositionService.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ICompositionService.xml deleted file mode 100644 index 11a30f08799..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ICompositionService.xml +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ICompositionService" FullName="System.ComponentModel.Composition.ICompositionService"> - <TypeSignature Language="C#" Value="public interface ICompositionService" /> - <TypeSignature Language="ILAsm" Value=".class public interface auto ansi abstract ICompositionService" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Interfaces /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Provides methods to satisfy imports on an existing part instance.</para> - </summary> - </Docs> - <Members> - <Member MemberName="SatisfyImportsOnce"> - <MemberSignature Language="C#" Value="public void SatisfyImportsOnce (System.ComponentModel.Composition.Primitives.ComposablePart part);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void SatisfyImportsOnce(class System.ComponentModel.Composition.Primitives.ComposablePart part) cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePart" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Composes the specified part, with recomposition and validation disabled.</para> - </summary> - <param name="part"> - <attribution license="cc4" from="Microsoft" modified="false" />The part to compose.</param> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/IPartImportsSatisfiedNotification.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/IPartImportsSatisfiedNotification.xml deleted file mode 100644 index 1ebcd6f5a64..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/IPartImportsSatisfiedNotification.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="IPartImportsSatisfiedNotification" FullName="System.ComponentModel.Composition.IPartImportsSatisfiedNotification"> - <TypeSignature Language="C#" Value="public interface IPartImportsSatisfiedNotification" /> - <TypeSignature Language="ILAsm" Value=".class public interface auto ansi abstract IPartImportsSatisfiedNotification" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Interfaces /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Notifies a part when its imports have been satisfied.</para> - </summary> - </Docs> - <Members> - <Member MemberName="OnImportsSatisfied"> - <MemberSignature Language="C#" Value="public void OnImportsSatisfied ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void OnImportsSatisfied() cil managed" /> - <MemberType>Method</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Called when a part's imports have been satisfied and it is safe to use.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ImportAttribute.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ImportAttribute.xml deleted file mode 100644 index 3a4830a2dd0..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ImportAttribute.xml +++ /dev/null @@ -1,260 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ImportAttribute" FullName="System.ComponentModel.Composition.ImportAttribute"> - <TypeSignature Language="C#" Value="public class ImportAttribute : Attribute, System.ComponentModel.Composition.IAttributedImport" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit ImportAttribute extends System.Attribute implements class System.ComponentModel.Composition.IAttributedImport" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Attribute</BaseTypeName> - </Base> - <Interfaces> - <Interface> - <InterfaceName>System.ComponentModel.Composition.IAttributedImport</InterfaceName> - </Interface> - </Interfaces> - <Attributes> - <Attribute> - <AttributeName>System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.All, AllowMultiple=false, Inherited=false)</AttributeName> - </Attribute> - </Attributes> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>In the Attributed Programming Model, the <see cref="T:System.ComponentModel.Composition.ImportAttribute" /> is used to declare the imports, or dependencies, of a given part. It can decorate a property, a field, or a method. During composition, a part's imports will be filled by the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> object to which that part belongs, by using the exports provided to that <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> object.</para> - <para>Whether an import matches a given export is determined primarily by comparing the contract name and the contract type. Ordinarily, you do not have to specify either of these when using the import attribute in code, and they will be automatically inferred from the type of the decorated member. If the import must match an export of a different type (for example, a subclass of the type of the decorated member, or an interface implemented by that member), then the contract type must be explicitly specified. The contract name can also be explicitly specified, for example to distinguish between multiple contracts with the same type, but it is usually better to do this through metadata. For more information about metadata, see <see cref="T:System.ComponentModel.Composition.PartMetadataAttribute" />.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Specifies that a property, field, or parameter value should be provided by the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" />.object</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ImportAttribute ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The default contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on the property, field, or parameter type that this is marked with this attribute.</para> - <para>The contract name is compared by using the <see cref="P:System.StringComparer.Ordinal" /> property to perform a case-sensitive, non-linguistic comparison.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ImportAttribute" /> class, importing the export with the default contract name.</para> - </summary> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ImportAttribute (string contractName);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string contractName) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="contractName" Type="System.String" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The default contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on the property, field, or parameter type that is marked with this attribute.</para> - <para>The contract name is compared by using the <see cref="P:System.StringComparer.Ordinal" /> property to perform a case-sensitive, non-linguistic comparison.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ImportAttribute" /> class, importing the export with the specified contract name.</para> - </summary> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name of the export to import, or null or an empty string ("") to use the default contract name.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ImportAttribute (Type contractType);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Type contractType) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="contractType" Type="System.Type" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on <paramref name="contractType" />.</para> - <para>The default contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on the property, field, or parameter type that is marked with this attribute.</para> - <para>The contract name is compared by using the <see cref="P:System.StringComparer.Ordinal" /> property to perform a case-sensitive, non-linguistic comparison.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ImportAttribute" /> class, importing the export with the contract name derived from the specified type.</para> - </summary> - <param name="contractType"> - <attribution license="cc4" from="Microsoft" modified="false" />The type to derive the contract name of the export from, or null to use the default contract name.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ImportAttribute (string contractName, Type contractType);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string contractName, class System.Type contractType) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="contractName" Type="System.String" /> - <Parameter Name="contractType" Type="System.Type" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ImportAttribute" /> class, importing the export with the specified contract name and type.</para> - </summary> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name of the export to import, or null or an empty string ("") to use the default contract name.</param> - <param name="contractType"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the export to import.</param> - </Docs> - </Member> - <Member MemberName="AllowDefault"> - <MemberSignature Language="C#" Value="public bool AllowDefault { get; set; }" /> - <MemberSignature Language="ILAsm" Value=".property instance bool AllowDefault" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The default value of the type of a property, field, or parameter is null for reference types and zero for numeric value types. For other value types, the default value will be each field of the value type initialized to zero if the field is a value type, or null if the field is a reference type.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets or sets a value that indicates whether the property, field, or parameter will be set to its type's default value when an export with the contract name is not present in the container.</para> - </summary> - </Docs> - </Member> - <Member MemberName="AllowRecomposition"> - <MemberSignature Language="C#" Value="public bool AllowRecomposition { get; set; }" /> - <MemberSignature Language="ILAsm" Value=".property instance bool AllowRecomposition" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets or sets a value that indicates whether the property or field will be recomposed when exports with a matching contract have changed in the container.</para> - </summary> - </Docs> - </Member> - <Member MemberName="ContractName"> - <MemberSignature Language="C#" Value="public string ContractName { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance string ContractName" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the contract name of the export to import.</para> - </summary> - </Docs> - </Member> - <Member MemberName="ContractType"> - <MemberSignature Language="C#" Value="public Type ContractType { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Type ContractType" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Type</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the type of the export to import.</para> - </summary> - </Docs> - </Member> - <Member MemberName="RequiredCreationPolicy"> - <MemberSignature Language="C#" Value="public System.ComponentModel.Composition.CreationPolicy RequiredCreationPolicy { get; set; }" /> - <MemberSignature Language="ILAsm" Value=".property instance valuetype System.ComponentModel.Composition.CreationPolicy RequiredCreationPolicy" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.CreationPolicy</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets or sets a value that indicates that the importer requires a specific <see cref="T:System.ComponentModel.Composition.CreationPolicy" /> for the exports used to satisfy this import. </para> - </summary> - </Docs> - </Member> - <Member MemberName="Source"> - <MemberSignature Language="C#" Value="public System.ComponentModel.Composition.ImportSource Source { get; set; }" /> - <MemberSignature Language="ILAsm" Value=".property instance valuetype System.ComponentModel.Composition.ImportSource Source" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.ImportSource</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets or sets a value that specifies the scopes from which this import may be satisfied.</para> - </summary> - </Docs> - </Member> - <Member MemberName="System.ComponentModel.Composition.IAttributedImport.Cardinality"> - <MemberSignature Language="C#" Value="System.ComponentModel.Composition.Primitives.ImportCardinality System.ComponentModel.Composition.IAttributedImport.Cardinality { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance valuetype System.ComponentModel.Composition.Primitives.ImportCardinality System.ComponentModel.Composition.IAttributedImport.Cardinality" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ImportCardinality</ReturnType> - </ReturnValue> - <Docs> - <summary>To be added.</summary> - <value>To be added.</value> - <remarks>To be added.</remarks> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ImportCardinalityMismatchException.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ImportCardinalityMismatchException.xml deleted file mode 100644 index 53331fd82e3..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ImportCardinalityMismatchException.xml +++ /dev/null @@ -1,227 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ImportCardinalityMismatchException" FullName="System.ComponentModel.Composition.ImportCardinalityMismatchException"> - <TypeSignature Language="C#" Value="public class ImportCardinalityMismatchException : Exception" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi serializable beforefieldinit ImportCardinalityMismatchException extends System.Exception" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Exception</BaseTypeName> - </Base> - <Interfaces /> - <Attributes> - <Attribute> - <AttributeName>System.Diagnostics.DebuggerDisplay("{Message}")</AttributeName> - </Attribute> - <Attribute> - <AttributeName>System.Diagnostics.DebuggerTypeProxy(typeof(System.ComponentModel.Composition.ImportCardinalityMismatchExceptionDebuggerProxy))</AttributeName> - </Attribute> - </Attributes> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The exception that is thrown when the cardinality of an import is not compatible with the cardinality of the matching exports.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ImportCardinalityMismatchException ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This constructor initializes the <see cref="P:System.Exception.Message" /> property of the new instance to a system-supplied message that describes the error, such as "DefaultMessageDisplayedByParameterlessCtorWriterMustSupply". This message takes into account the current system culture.</para> - <para>The following table shows the initial property values for an instance of <see cref="T:System.InsufficientMemoryException" />.</para> - <list type="table"> - <listheader> - <item> - <term> - <para>Property </para> - </term> - <description> - <para>Value </para> - </description> - </item> - </listheader> - <item> - <term> - <para> - <see cref="P:System.Exception.InnerException" /> - </para> - </term> - <description> - <para>null.</para> - </description> - </item> - <item> - <term> - <para> - <see cref="P:System.Exception.Message" /> - </para> - </term> - <description> - <para>The localized error message string. </para> - </description> - </item> - </list> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ImportCardinalityMismatchException" /> class with a system-supplied message that describes the error.</para> - </summary> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ImportCardinalityMismatchException (string message);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string message) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="message" Type="System.String" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The following table shows the initial property values for an instance of <see cref="T:System.ComponentModel.Composition.ImportCardinalityMismatchException" />.</para> - <list type="table"> - <listheader> - <item> - <term> - <para>Property </para> - </term> - <description> - <para>Value </para> - </description> - </item> - </listheader> - <item> - <term> - <para> - <see cref="P:System.Exception.InnerException" /> - </para> - </term> - <description> - <para>null.</para> - </description> - </item> - <item> - <term> - <para> - <see cref="P:System.Exception.Message" /> - </para> - </term> - <description> - <para>The error message string specified in <paramref name="message" />. </para> - </description> - </item> - </list> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ImportCardinalityMismatchException" /> class with a specified message that describes the error.</para> - </summary> - <param name="message"> - <attribution license="cc4" from="Microsoft" modified="false" />A message that describes the <see cref="T:System.ComponentModel.Composition.ImportCardinalityMismatchException" />, or null to set the <see cref="P:System.Exception.Message" /> property to its default value. </param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="protected ImportCardinalityMismatchException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);" /> - <MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor(class System.Runtime.Serialization.SerializationInfo info, valuetype System.Runtime.Serialization.StreamingContext context) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Attributes> - <Attribute> - <AttributeName>System.Security.SecuritySafeCritical</AttributeName> - </Attribute> - </Attributes> - <Parameters> - <Parameter Name="info" Type="System.Runtime.Serialization.SerializationInfo" /> - <Parameter Name="context" Type="System.Runtime.Serialization.StreamingContext" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This constructor is called during deserialization to reconstitute the exception object transmitted over a stream. For more information, see <format type="text/html"><a href="832AC524-21BC-419A-A27B-CA8BFC45840F">XML and SOAP Serialization</a></format>.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ImportCardinalityMismatchException" /> class with serialized data.</para> - </summary> - <param name="info"> - <attribution license="cc4" from="Microsoft" modified="false" />An object that holds the serialized object data about the <see cref="T:System.ComponentModel.Composition.ImportCardinalityMismatchException" />. </param> - <param name="context"> - <attribution license="cc4" from="Microsoft" modified="false" />An object that contains contextual information about the source or destination. </param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ImportCardinalityMismatchException (string message, Exception innerException);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string message, class System.Exception innerException) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="message" Type="System.String" /> - <Parameter Name="innerException" Type="System.Exception" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>An exception that is thrown as a direct result of a previous exception should include a reference to the previous exception in the <see cref="P:System.Exception.InnerException" /> property. The <see cref="P:System.Exception.InnerException" /> property returns the same value that is passed into the constructor, or null if the <see cref="P:System.Exception.InnerException" /> property does not supply the inner exception value to the constructor.</para> - <para>The following table shows the initial property values for an instance of <see cref="T:System.ComponentModel.Composition.ImportCardinalityMismatchException" />.</para> - <list type="table"> - <listheader> - <item> - <term> - <para>Property </para> - </term> - <description> - <para>Value </para> - </description> - </item> - </listheader> - <item> - <term> - <para> - <see cref="P:System.Exception.InnerException" /> - </para> - </term> - <description> - <para>null. </para> - </description> - </item> - <item> - <term> - <para> - <see cref="P:System.Exception.Message" /> - </para> - </term> - <description> - <para>The error message string specified in <paramref name="message" />. </para> - </description> - </item> - </list> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ImportCardinalityMismatchException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.</para> - </summary> - <param name="message"> - <attribution license="cc4" from="Microsoft" modified="false" />The message that describes the exception. The caller of this constructor is required to ensure that this string has been localized for the current system culture. </param> - <param name="innerException"> - <attribution license="cc4" from="Microsoft" modified="false" />The exception that is the cause of the current exception. If the <paramref name="innerException" /> parameter is not null, the current exception is raised in a catch block that handles the inner exception. </param> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ImportManyAttribute.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ImportManyAttribute.xml deleted file mode 100644 index d94d1cfc44d..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ImportManyAttribute.xml +++ /dev/null @@ -1,234 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ImportManyAttribute" FullName="System.ComponentModel.Composition.ImportManyAttribute"> - <TypeSignature Language="C#" Value="public class ImportManyAttribute : Attribute, System.ComponentModel.Composition.IAttributedImport" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit ImportManyAttribute extends System.Attribute implements class System.ComponentModel.Composition.IAttributedImport" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Attribute</BaseTypeName> - </Base> - <Interfaces> - <Interface> - <InterfaceName>System.ComponentModel.Composition.IAttributedImport</InterfaceName> - </Interface> - </Interfaces> - <Attributes> - <Attribute> - <AttributeName>System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.All, AllowMultiple=false, Inherited=false)</AttributeName> - </Attribute> - </Attributes> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Specifies that a property, field, or parameter should be populated with all matching exports by the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> object.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ImportManyAttribute ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The default contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on the type of the property, field, or parameter that is marked with this attribute.</para> - <para>The contract name is compared by using the <see cref="P:System.StringComparer.Ordinal" /> property to perform a case-sensitive, non-linguistic comparison.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ImportManyAttribute" /> class, importing the set of exports with the default contract name.</para> - </summary> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ImportManyAttribute (string contractName);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string contractName) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="contractName" Type="System.String" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The default contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on the property, field, or parameter type that is marked with this attribute.</para> - <para>The contract name is compared by using the <see cref="P:System.StringComparer.Ordinal" /> property to perform a case-sensitive, non-linguistic comparison.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ImportManyAttribute" /> class, importing the set of exports with the specified contract name.</para> - </summary> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name of the exports to import, or null or an empty string ("") to use the default contract name.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ImportManyAttribute (Type contractType);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Type contractType) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="contractType" Type="System.Type" /> - </Parameters> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on <paramref name="contractType" />.</para> - <para>The default contract name is the result of calling the <see cref="M:System.ComponentModel.Composition.AttributedModelServices.GetContractName(System.Type)" /> method on the property, field, or parameter type that is marked with this attribute.</para> - <para>The contract name is compared by using the <see cref="P:System.StringComparer.Ordinal" /> property to perform a case-sensitive, non-linguistic comparison.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ImportManyAttribute" /> class, importing the set of exports with the contract name derived from the specified type.</para> - </summary> - <param name="contractType"> - <attribution license="cc4" from="Microsoft" modified="false" />The type to derive the contract name of the exports to import, or null to use the default contract name.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ImportManyAttribute (string contractName, Type contractType);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string contractName, class System.Type contractType) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="contractName" Type="System.String" /> - <Parameter Name="contractType" Type="System.Type" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ImportManyAttribute" /> class, importing the set of exports with the specified contract name and contract type.</para> - </summary> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The contract name of the exports to import, or null or an empty string ("") to use the default contract name.</param> - <param name="contractType"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the export to import.</param> - </Docs> - </Member> - <Member MemberName="AllowRecomposition"> - <MemberSignature Language="C#" Value="public bool AllowRecomposition { get; set; }" /> - <MemberSignature Language="ILAsm" Value=".property instance bool AllowRecomposition" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets or sets a value indicating whether the decorated property or field will be recomposed when exports that provide the matching contract change.</para> - </summary> - </Docs> - </Member> - <Member MemberName="ContractName"> - <MemberSignature Language="C#" Value="public string ContractName { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance string ContractName" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the contract name of the exports to import.</para> - </summary> - </Docs> - </Member> - <Member MemberName="ContractType"> - <MemberSignature Language="C#" Value="public Type ContractType { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Type ContractType" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Type</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the contract type of the export to import.</para> - </summary> - </Docs> - </Member> - <Member MemberName="RequiredCreationPolicy"> - <MemberSignature Language="C#" Value="public System.ComponentModel.Composition.CreationPolicy RequiredCreationPolicy { get; set; }" /> - <MemberSignature Language="ILAsm" Value=".property instance valuetype System.ComponentModel.Composition.CreationPolicy RequiredCreationPolicy" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.CreationPolicy</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets or sets a value that indicates that the importer requires a specific <see cref="T:System.ComponentModel.Composition.CreationPolicy" /> for the exports used to satisfy this import. </para> - </summary> - </Docs> - </Member> - <Member MemberName="Source"> - <MemberSignature Language="C#" Value="public System.ComponentModel.Composition.ImportSource Source { get; set; }" /> - <MemberSignature Language="ILAsm" Value=".property instance valuetype System.ComponentModel.Composition.ImportSource Source" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.ImportSource</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets or sets a value that specifies the scopes from which this import may be satisfied.</para> - </summary> - </Docs> - </Member> - <Member MemberName="System.ComponentModel.Composition.IAttributedImport.Cardinality"> - <MemberSignature Language="C#" Value="System.ComponentModel.Composition.Primitives.ImportCardinality System.ComponentModel.Composition.IAttributedImport.Cardinality { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance valuetype System.ComponentModel.Composition.Primitives.ImportCardinality System.ComponentModel.Composition.IAttributedImport.Cardinality" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ImportCardinality</ReturnType> - </ReturnValue> - <Docs> - <summary>To be added.</summary> - <value>To be added.</value> - <remarks>To be added.</remarks> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ImportSource.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ImportSource.xml deleted file mode 100644 index 40e240ec56b..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ImportSource.xml +++ /dev/null @@ -1,72 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ImportSource" FullName="System.ComponentModel.Composition.ImportSource"> - <TypeSignature Language="C#" Value="public enum ImportSource" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed ImportSource extends System.Enum" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Enum</BaseTypeName> - </Base> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Specifies values that indicate how the MEF composition engine searches for imports.</para> - </summary> - </Docs> - <Members> - <Member MemberName="Any"> - <MemberSignature Language="C#" Value="Any" /> - <MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.ComponentModel.Composition.ImportSource Any = int32(0)" /> - <MemberType>Field</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.ImportSource</ReturnType> - </ReturnValue> - <Docs> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Imports may be satisfied from the current scope or any ancestor scope.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Local"> - <MemberSignature Language="C#" Value="Local" /> - <MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.ComponentModel.Composition.ImportSource Local = int32(1)" /> - <MemberType>Field</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.ImportSource</ReturnType> - </ReturnValue> - <Docs> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Imports may be satisfied only from the current scope.</para> - </summary> - </Docs> - </Member> - <Member MemberName="NonLocal"> - <MemberSignature Language="C#" Value="NonLocal" /> - <MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.ComponentModel.Composition.ImportSource NonLocal = int32(2)" /> - <MemberType>Field</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.ImportSource</ReturnType> - </ReturnValue> - <Docs> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Imports may be satisfied only from an ancestor scope.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ImportingConstructorAttribute.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ImportingConstructorAttribute.xml deleted file mode 100644 index 196be1b5693..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/ImportingConstructorAttribute.xml +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="ImportingConstructorAttribute" FullName="System.ComponentModel.Composition.ImportingConstructorAttribute"> - <TypeSignature Language="C#" Value="public class ImportingConstructorAttribute : Attribute" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit ImportingConstructorAttribute extends System.Attribute" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Attribute</BaseTypeName> - </Base> - <Interfaces /> - <Attributes> - <Attribute> - <AttributeName>System.AttributeUsage(System.AttributeTargets.Constructor, AllowMultiple=false, Inherited=false)</AttributeName> - </Attribute> - </Attributes> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>By default, only a parameter-less constructor will be used to construct an attributed part. Use <see cref="T:System.ComponentModel.Composition.ImportingConstructorAttribute" /> to indicate that a specific constructor should be used instead. Parameters to the decorated constructor will be treated as imports.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Specifies which constructor should be used when creating a part.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public ImportingConstructorAttribute ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.ImportingConstructorAttribute" /> class.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/InheritedExportAttribute.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/InheritedExportAttribute.xml deleted file mode 100644 index f95dc311b0e..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/InheritedExportAttribute.xml +++ /dev/null @@ -1,106 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="InheritedExportAttribute" FullName="System.ComponentModel.Composition.InheritedExportAttribute"> - <TypeSignature Language="C#" Value="public class InheritedExportAttribute : System.ComponentModel.Composition.ExportAttribute" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit InheritedExportAttribute extends System.ComponentModel.Composition.ExportAttribute" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.ComponentModel.Composition.ExportAttribute</BaseTypeName> - </Base> - <Interfaces /> - <Attributes> - <Attribute> - <AttributeName>System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface | System.AttributeTargets.All, AllowMultiple=true, Inherited=true)</AttributeName> - </Attribute> - </Attributes> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Specifies that a type provides a particular export, and that subclasses of that type will also provide that export.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public InheritedExportAttribute ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.InheritedExportAttribute" /> class. </para> - </summary> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public InheritedExportAttribute (string contractName);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string contractName) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="contractName" Type="System.String" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.InheritedExportAttribute" /> class with the specified contract name.</para> - </summary> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The name of the contract.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public InheritedExportAttribute (Type contractType);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Type contractType) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="contractType" Type="System.Type" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.InheritedExportAttribute" /> class with the specified contract type.</para> - </summary> - <param name="contractType"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the contract.</param> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public InheritedExportAttribute (string contractName, Type contractType);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string contractName, class System.Type contractType) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="contractName" Type="System.String" /> - <Parameter Name="contractType" Type="System.Type" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.InheritedExportAttribute" /> class with the specified contract name and type.</para> - </summary> - <param name="contractName"> - <attribution license="cc4" from="Microsoft" modified="false" />The name of the contract.</param> - <param name="contractType"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the contract.</param> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/MetadataAttributeAttribute.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/MetadataAttributeAttribute.xml deleted file mode 100644 index 50f7733a2dd..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/MetadataAttributeAttribute.xml +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="MetadataAttributeAttribute" FullName="System.ComponentModel.Composition.MetadataAttributeAttribute"> - <TypeSignature Language="C#" Value="public sealed class MetadataAttributeAttribute : Attribute" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit MetadataAttributeAttribute extends System.Attribute" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Attribute</BaseTypeName> - </Base> - <Interfaces /> - <Attributes> - <Attribute> - <AttributeName>System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false, Inherited=true)</AttributeName> - </Attribute> - </Attributes> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Specifies that a custom attribute’s properties provide metadata for exports applied to the same type, property, field, or method.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public MetadataAttributeAttribute ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.MetadataAttributeAttribute" /> class.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/MetadataViewImplementationAttribute.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/MetadataViewImplementationAttribute.xml deleted file mode 100644 index 0effc6caa76..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/MetadataViewImplementationAttribute.xml +++ /dev/null @@ -1,69 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="MetadataViewImplementationAttribute" FullName="System.ComponentModel.Composition.MetadataViewImplementationAttribute"> - <TypeSignature Language="C#" Value="public sealed class MetadataViewImplementationAttribute : Attribute" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit MetadataViewImplementationAttribute extends System.Attribute" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Attribute</BaseTypeName> - </Base> - <Interfaces /> - <Attributes> - <Attribute> - <AttributeName>System.AttributeUsage(System.AttributeTargets.Interface, AllowMultiple=false, Inherited=false)</AttributeName> - </Attribute> - </Attributes> - <Docs> - <remarks> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>By default, metadata views are created using generated types. Use this attribute to specify that a metadata view should use an existing type.</para> - </remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Specifies the type used to implement a metadata view.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public MetadataViewImplementationAttribute (Type implementationType);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Type implementationType) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="implementationType" Type="System.Type" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.MetadataViewImplementationAttribute" /> class.</para> - </summary> - <param name="implementationType"> - <attribution license="cc4" from="Microsoft" modified="false" />The type of the metadata view.</param> - </Docs> - </Member> - <Member MemberName="ImplementationType"> - <MemberSignature Language="C#" Value="public Type ImplementationType { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance class System.Type ImplementationType" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Type</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the type of the metadata view.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/PartCreationPolicyAttribute.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/PartCreationPolicyAttribute.xml deleted file mode 100644 index e5885deb216..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/PartCreationPolicyAttribute.xml +++ /dev/null @@ -1,66 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="PartCreationPolicyAttribute" FullName="System.ComponentModel.Composition.PartCreationPolicyAttribute"> - <TypeSignature Language="C#" Value="public sealed class PartCreationPolicyAttribute : Attribute" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit PartCreationPolicyAttribute extends System.Attribute" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Attribute</BaseTypeName> - </Base> - <Interfaces /> - <Attributes> - <Attribute> - <AttributeName>System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false, Inherited=false)</AttributeName> - </Attribute> - </Attributes> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Specifies the <see cref="P:System.ComponentModel.Composition.PartCreationPolicyAttribute.CreationPolicy" /> for a part.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public PartCreationPolicyAttribute (System.ComponentModel.Composition.CreationPolicy creationPolicy);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(valuetype System.ComponentModel.Composition.CreationPolicy creationPolicy) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="creationPolicy" Type="System.ComponentModel.Composition.CreationPolicy" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.PartCreationPolicyAttribute" /> class with the specified creation policy.</para> - </summary> - <param name="creationPolicy"> - <attribution license="cc4" from="Microsoft" modified="false" />The creation policy to use.</param> - </Docs> - </Member> - <Member MemberName="CreationPolicy"> - <MemberSignature Language="C#" Value="public System.ComponentModel.Composition.CreationPolicy CreationPolicy { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance valuetype System.ComponentModel.Composition.CreationPolicy CreationPolicy" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.CreationPolicy</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets or sets a value that indicates the creation policy of the attributed part.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/PartMetadataAttribute.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/PartMetadataAttribute.xml deleted file mode 100644 index f953761a9ef..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/PartMetadataAttribute.xml +++ /dev/null @@ -1,88 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="PartMetadataAttribute" FullName="System.ComponentModel.Composition.PartMetadataAttribute"> - <TypeSignature Language="C#" Value="public sealed class PartMetadataAttribute : Attribute" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit PartMetadataAttribute extends System.Attribute" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Attribute</BaseTypeName> - </Base> - <Interfaces /> - <Attributes> - <Attribute> - <AttributeName>System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=true, Inherited=false)</AttributeName> - </Attribute> - </Attributes> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Specifies metadata for a part.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public PartMetadataAttribute (string name, object value);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string name, object value) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="name" Type="System.String" /> - <Parameter Name="value" Type="System.Object" /> - </Parameters> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.PartMetadataAttribute" /> class with the specified name and metadata value.</para> - </summary> - <param name="name"> - <attribution license="cc4" from="Microsoft" modified="false" />A string that contains the name of the metadata value or null to use an empty string ("").</param> - <param name="value"> - <attribution license="cc4" from="Microsoft" modified="false" />An object that contains the metadata value. This can be null.</param> - </Docs> - </Member> - <Member MemberName="Name"> - <MemberSignature Language="C#" Value="public string Name { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance string Name" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.String</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the name of the metadata value.</para> - </summary> - </Docs> - </Member> - <Member MemberName="Value"> - <MemberSignature Language="C#" Value="public object Value { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance object Value" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>System.Object</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the metadata value.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/PartNotDiscoverableAttribute.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/PartNotDiscoverableAttribute.xml deleted file mode 100644 index 05106c2876e..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System.ComponentModel.Composition/PartNotDiscoverableAttribute.xml +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="PartNotDiscoverableAttribute" FullName="System.ComponentModel.Composition.PartNotDiscoverableAttribute"> - <TypeSignature Language="C#" Value="public sealed class PartNotDiscoverableAttribute : Attribute" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit PartNotDiscoverableAttribute extends System.Attribute" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Base> - <BaseTypeName>System.Attribute</BaseTypeName> - </Base> - <Interfaces /> - <Attributes> - <Attribute> - <AttributeName>System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false, Inherited=false)</AttributeName> - </Attribute> - </Attributes> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Specifies that this type’s exports won’t be included in a <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePartCatalog" />.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public PartNotDiscoverableAttribute ();" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters /> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Initializes a new instance of the <see cref="T:System.ComponentModel.Composition.PartNotDiscoverableAttribute" /> class.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/System/Lazy`2.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/System/Lazy`2.xml deleted file mode 100644 index 021848fad4c..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/System/Lazy`2.xml +++ /dev/null @@ -1,160 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Type Name="Lazy<T,TMetadata>" FullName="System.Lazy<T,TMetadata>"> - <TypeSignature Language="C#" Value="public class Lazy<T,TMetadata> : Lazy<T>" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi serializable beforefieldinit Lazy`2<T, TMetadata> extends System.Lazy`1<!T>" /> - <AssemblyInfo> - <AssemblyName>System.ComponentModel.Composition</AssemblyName> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <TypeParameters> - <TypeParameter Name="T" /> - <TypeParameter Name="TMetadata" /> - </TypeParameters> - <Base> - <BaseTypeName>System.Lazy<T></BaseTypeName> - <BaseTypeArguments> - <BaseTypeArgument TypeParamName="!0">T</BaseTypeArgument> - </BaseTypeArguments> - </Base> - <Interfaces /> - <Docs> - <typeparam name="T">To be added.</typeparam> - <typeparam name="TMetadata">To be added.</typeparam> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Provides a lazy indirect reference to an object and its associated metadata for use by the Managed Extensibility Framework.</para> - </summary> - </Docs> - <Members> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public Lazy (TMetadata metadata);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(!TMetadata metadata) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="metadata" Type="TMetadata" /> - </Parameters> - <Docs> - <param name="metadata">To be added.</param> - <summary>To be added.</summary> - <remarks>To be added.</remarks> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public Lazy (Func<T> valueFactory, TMetadata metadata);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Func`1<!T> valueFactory, !TMetadata metadata) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="valueFactory" Type="System.Func<T>" /> - <Parameter Name="metadata" Type="TMetadata" /> - </Parameters> - <Docs> - <param name="valueFactory">To be added.</param> - <param name="metadata">To be added.</param> - <summary>To be added.</summary> - <remarks>To be added.</remarks> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public Lazy (TMetadata metadata, bool isThreadSafe);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(!TMetadata metadata, bool isThreadSafe) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="metadata" Type="TMetadata" /> - <Parameter Name="isThreadSafe" Type="System.Boolean" /> - </Parameters> - <Docs> - <param name="metadata">To be added.</param> - <param name="isThreadSafe">To be added.</param> - <summary>To be added.</summary> - <remarks>To be added.</remarks> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public Lazy (TMetadata metadata, System.Threading.LazyThreadSafetyMode mode);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(!TMetadata metadata, valuetype System.Threading.LazyThreadSafetyMode mode) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="metadata" Type="TMetadata" /> - <Parameter Name="mode" Type="System.Threading.LazyThreadSafetyMode" /> - </Parameters> - <Docs> - <param name="metadata">To be added.</param> - <param name="mode">To be added.</param> - <summary>To be added.</summary> - <remarks>To be added.</remarks> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public Lazy (Func<T> valueFactory, TMetadata metadata, bool isThreadSafe);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Func`1<!T> valueFactory, !TMetadata metadata, bool isThreadSafe) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="valueFactory" Type="System.Func<T>" /> - <Parameter Name="metadata" Type="TMetadata" /> - <Parameter Name="isThreadSafe" Type="System.Boolean" /> - </Parameters> - <Docs> - <param name="valueFactory">To be added.</param> - <param name="metadata">To be added.</param> - <param name="isThreadSafe">To be added.</param> - <summary>To be added.</summary> - <remarks>To be added.</remarks> - </Docs> - </Member> - <Member MemberName=".ctor"> - <MemberSignature Language="C#" Value="public Lazy (Func<T> valueFactory, TMetadata metadata, System.Threading.LazyThreadSafetyMode mode);" /> - <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Func`1<!T> valueFactory, !TMetadata metadata, valuetype System.Threading.LazyThreadSafetyMode mode) cil managed" /> - <MemberType>Constructor</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <Parameters> - <Parameter Name="valueFactory" Type="System.Func<T>" /> - <Parameter Name="metadata" Type="TMetadata" /> - <Parameter Name="mode" Type="System.Threading.LazyThreadSafetyMode" /> - </Parameters> - <Docs> - <param name="valueFactory">To be added.</param> - <param name="metadata">To be added.</param> - <param name="mode">To be added.</param> - <summary>To be added.</summary> - <remarks>To be added.</remarks> - </Docs> - </Member> - <Member MemberName="Metadata"> - <MemberSignature Language="C#" Value="public TMetadata Metadata { get; }" /> - <MemberSignature Language="ILAsm" Value=".property instance !TMetadata Metadata" /> - <MemberType>Property</MemberType> - <AssemblyInfo> - <AssemblyVersion>4.0.0.0</AssemblyVersion> - </AssemblyInfo> - <ReturnValue> - <ReturnType>TMetadata</ReturnType> - </ReturnValue> - <Docs> - <value>To be added.</value> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>Gets the metadata associated with the referenced object.</para> - </summary> - </Docs> - </Member> - </Members> -</Type>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/index.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/index.xml deleted file mode 100644 index 30ef37ed61c..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/index.xml +++ /dev/null @@ -1,663 +0,0 @@ -<Overview> - <Assemblies> - <Assembly Name="System.ComponentModel.Composition" Version="4.0.0.0"> - <AssemblyPublicKey>[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ]</AssemblyPublicKey> - <Attributes> - <Attribute> - <AttributeName>System.CLSCompliant(true)</AttributeName> - </Attribute> - <Attribute> - <AttributeName>System.Diagnostics.Debuggable(System.Diagnostics.DebuggableAttribute+DebuggingModes.IgnoreSymbolStoreSequencePoints)</AttributeName> - </Attribute> - <Attribute> - <AttributeName>System.Reflection.AssemblyCompany("Mono development team")</AttributeName> - </Attribute> - <Attribute> - <AttributeName>System.Reflection.AssemblyCopyright("(c) Microsoft Corporation. All rights reserved.")</AttributeName> - </Attribute> - <Attribute> - <AttributeName>System.Reflection.AssemblyDefaultAlias("System.ComponentModel.Composition.dll")</AttributeName> - </Attribute> - <Attribute> - <AttributeName>System.Reflection.AssemblyDescription("System.ComponentModel.Composition.dll")</AttributeName> - </Attribute> - <Attribute> - <AttributeName>System.Reflection.AssemblyFileVersion("4.0.30319.17020")</AttributeName> - </Attribute> - <Attribute> - <AttributeName>System.Reflection.AssemblyInformationalVersion("4.0.30319.17020")</AttributeName> - </Attribute> - <Attribute> - <AttributeName>System.Reflection.AssemblyProduct("Mono Common Language Infrastructure")</AttributeName> - </Attribute> - <Attribute> - <AttributeName>System.Reflection.AssemblyTitle("System.ComponentModel.Composition.dll")</AttributeName> - </Attribute> - <Attribute> - <AttributeName>System.Resources.NeutralResourcesLanguage("en-US")</AttributeName> - </Attribute> - <Attribute> - <AttributeName>System.Resources.SatelliteContractVersion("4.0.0.0")</AttributeName> - </Attribute> - <Attribute> - <AttributeName>System.Runtime.CompilerServices.RuntimeCompatibility(WrapNonExceptionThrows=true)</AttributeName> - </Attribute> - <Attribute> - <AttributeName>System.Runtime.InteropServices.ComVisible(false)</AttributeName> - </Attribute> - <Attribute> - <AttributeName>System.Security.AllowPartiallyTrustedCallers</AttributeName> - </Attribute> - <Attribute> - <AttributeName>System.Security.SecurityCritical</AttributeName> - </Attribute> - </Attributes> - </Assembly> - </Assemblies> - <Remarks>To be added.</Remarks> - <Copyright>To be added.</Copyright> - <Types> - <Namespace Name="System"> - <Type Name="Lazy`2" DisplayName="Lazy<T,TMetadata>" Kind="Class" /> - </Namespace> - <Namespace Name="System.ComponentModel.Composition"> - <Type Name="AttributedModelServices" Kind="Class" /> - <Type Name="CatalogReflectionContextAttribute" Kind="Class" /> - <Type Name="ChangeRejectedException" Kind="Class" /> - <Type Name="CompositionContractMismatchException" Kind="Class" /> - <Type Name="CompositionError" Kind="Class" /> - <Type Name="CompositionException" Kind="Class" /> - <Type Name="CreationPolicy" Kind="Enumeration" /> - <Type Name="ExportAttribute" Kind="Class" /> - <Type Name="ExportFactory`1" DisplayName="ExportFactory<T>" Kind="Class" /> - <Type Name="ExportFactory`2" DisplayName="ExportFactory<T,TMetadata>" Kind="Class" /> - <Type Name="ExportLifetimeContext`1" DisplayName="ExportLifetimeContext<T>" Kind="Class" /> - <Type Name="ExportMetadataAttribute" Kind="Class" /> - <Type Name="ICompositionService" Kind="Interface" /> - <Type Name="ImportAttribute" Kind="Class" /> - <Type Name="ImportCardinalityMismatchException" Kind="Class" /> - <Type Name="ImportingConstructorAttribute" Kind="Class" /> - <Type Name="ImportManyAttribute" Kind="Class" /> - <Type Name="ImportSource" Kind="Enumeration" /> - <Type Name="InheritedExportAttribute" Kind="Class" /> - <Type Name="IPartImportsSatisfiedNotification" Kind="Interface" /> - <Type Name="MetadataAttributeAttribute" Kind="Class" /> - <Type Name="MetadataViewImplementationAttribute" Kind="Class" /> - <Type Name="PartCreationPolicyAttribute" Kind="Class" /> - <Type Name="PartMetadataAttribute" Kind="Class" /> - <Type Name="PartNotDiscoverableAttribute" Kind="Class" /> - </Namespace> - <Namespace Name="System.ComponentModel.Composition.Hosting"> - <Type Name="AggregateCatalog" Kind="Class" /> - <Type Name="AggregateExportProvider" Kind="Class" /> - <Type Name="ApplicationCatalog" Kind="Class" /> - <Type Name="AssemblyCatalog" Kind="Class" /> - <Type Name="AtomicComposition" Kind="Class" /> - <Type Name="CatalogExportProvider" Kind="Class" /> - <Type Name="CatalogExtensions" Kind="Class" /> - <Type Name="ComposablePartCatalogChangeEventArgs" Kind="Class" /> - <Type Name="ComposablePartExportProvider" Kind="Class" /> - <Type Name="CompositionBatch" Kind="Class" /> - <Type Name="CompositionConstants" Kind="Class" /> - <Type Name="CompositionContainer" Kind="Class" /> - <Type Name="CompositionOptions" Kind="Enumeration" /> - <Type Name="CompositionScopeDefinition" Kind="Class" /> - <Type Name="CompositionService" Kind="Class" /> - <Type Name="DirectoryCatalog" Kind="Class" /> - <Type Name="ExportProvider" Kind="Class" /> - <Type Name="ExportsChangeEventArgs" Kind="Class" /> - <Type Name="FilteredCatalog" Kind="Class" /> - <Type Name="ImportEngine" Kind="Class" /> - <Type Name="INotifyComposablePartCatalogChanged" Kind="Interface" /> - <Type Name="ScopingExtensions" Kind="Class" /> - <Type Name="TypeCatalog" Kind="Class" /> - </Namespace> - <Namespace Name="System.ComponentModel.Composition.Primitives"> - <Type Name="ComposablePart" Kind="Class" /> - <Type Name="ComposablePartCatalog" Kind="Class" /> - <Type Name="ComposablePartDefinition" Kind="Class" /> - <Type Name="ComposablePartException" Kind="Class" /> - <Type Name="ContractBasedImportDefinition" Kind="Class" /> - <Type Name="Export" Kind="Class" /> - <Type Name="ExportDefinition" Kind="Class" /> - <Type Name="ExportedDelegate" Kind="Class" /> - <Type Name="ICompositionElement" Kind="Interface" /> - <Type Name="ImportCardinality" Kind="Enumeration" /> - <Type Name="ImportDefinition" Kind="Class" /> - </Namespace> - <Namespace Name="System.ComponentModel.Composition.ReflectionModel"> - <Type Name="LazyMemberInfo" Kind="Structure" /> - <Type Name="ReflectionModelServices" Kind="Class" /> - </Namespace> - </Types> - <Title>System.ComponentModel.Composition</Title> - <ExtensionMethods> - <ExtensionMethod> - <Targets> - <Target Type="T:System.ComponentModel.Composition.Hosting.CompositionBatch" /> - </Targets> - <Member MemberName="AddExportedValue<T>"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Primitives.ComposablePart AddExportedValue<T> (this System.ComponentModel.Composition.Hosting.CompositionBatch batch, T exportedValue);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Primitives.ComposablePart AddExportedValue<T>(class System.ComponentModel.Composition.Hosting.CompositionBatch batch, !!T exportedValue) cil managed" /> - <MemberType>ExtensionMethod</MemberType> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ComposablePart</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="batch" Type="System.ComponentModel.Composition.Hosting.CompositionBatch" RefType="this" /> - <Parameter Name="exportedValue" Type="T" /> - </Parameters> - <Docs> - <typeparam name="T">To be added.</typeparam> - <param name="batch">To be added.</param> - <param name="exportedValue">To be added.</param> - <summary>To be added.</summary> - </Docs> - <Link Type="System.ComponentModel.Composition.AttributedModelServices" Member="M:System.ComponentModel.Composition.AttributedModelServices.AddExportedValue``1(System.ComponentModel.Composition.Hosting.CompositionBatch,``0)" /> - </Member> - </ExtensionMethod> - <ExtensionMethod> - <Targets> - <Target Type="T:System.ComponentModel.Composition.Hosting.CompositionBatch" /> - </Targets> - <Member MemberName="AddExportedValue<T>"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Primitives.ComposablePart AddExportedValue<T> (this System.ComponentModel.Composition.Hosting.CompositionBatch batch, string contractName, T exportedValue);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Primitives.ComposablePart AddExportedValue<T>(class System.ComponentModel.Composition.Hosting.CompositionBatch batch, string contractName, !!T exportedValue) cil managed" /> - <MemberType>ExtensionMethod</MemberType> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ComposablePart</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="batch" Type="System.ComponentModel.Composition.Hosting.CompositionBatch" RefType="this" /> - <Parameter Name="contractName" Type="System.String" /> - <Parameter Name="exportedValue" Type="T" /> - </Parameters> - <Docs> - <typeparam name="T">To be added.</typeparam> - <param name="batch">To be added.</param> - <param name="contractName">To be added.</param> - <param name="exportedValue">To be added.</param> - <summary>To be added.</summary> - </Docs> - <Link Type="System.ComponentModel.Composition.AttributedModelServices" Member="M:System.ComponentModel.Composition.AttributedModelServices.AddExportedValue``1(System.ComponentModel.Composition.Hosting.CompositionBatch,System.String,``0)" /> - </Member> - </ExtensionMethod> - <ExtensionMethod> - <Targets> - <Target Type="T:System.ComponentModel.Composition.Hosting.CompositionBatch" /> - </Targets> - <Member MemberName="AddPart"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Primitives.ComposablePart AddPart (this System.ComponentModel.Composition.Hosting.CompositionBatch batch, object attributedPart);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Primitives.ComposablePart AddPart(class System.ComponentModel.Composition.Hosting.CompositionBatch batch, object attributedPart) cil managed" /> - <MemberType>ExtensionMethod</MemberType> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ComposablePart</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="batch" Type="System.ComponentModel.Composition.Hosting.CompositionBatch" RefType="this" /> - <Parameter Name="attributedPart" Type="System.Object" /> - </Parameters> - <Docs> - <param name="batch">To be added.</param> - <param name="attributedPart">To be added.</param> - <summary>To be added.</summary> - </Docs> - <Link Type="System.ComponentModel.Composition.AttributedModelServices" Member="M:System.ComponentModel.Composition.AttributedModelServices.AddPart(System.ComponentModel.Composition.Hosting.CompositionBatch,System.Object)" /> - </Member> - </ExtensionMethod> - <ExtensionMethod> - <Targets> - <Target Type="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> - </Targets> - <Member MemberName="ComposeExportedValue<T>"> - <MemberSignature Language="C#" Value="public static void ComposeExportedValue<T> (this System.ComponentModel.Composition.Hosting.CompositionContainer container, T exportedValue);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig void ComposeExportedValue<T>(class System.ComponentModel.Composition.Hosting.CompositionContainer container, !!T exportedValue) cil managed" /> - <MemberType>ExtensionMethod</MemberType> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="container" Type="System.ComponentModel.Composition.Hosting.CompositionContainer" RefType="this" /> - <Parameter Name="exportedValue" Type="T" /> - </Parameters> - <Docs> - <typeparam name="T">To be added.</typeparam> - <param name="container">To be added.</param> - <param name="exportedValue">To be added.</param> - <summary>To be added.</summary> - </Docs> - <Link Type="System.ComponentModel.Composition.AttributedModelServices" Member="M:System.ComponentModel.Composition.AttributedModelServices.ComposeExportedValue``1(System.ComponentModel.Composition.Hosting.CompositionContainer,``0)" /> - </Member> - </ExtensionMethod> - <ExtensionMethod> - <Targets> - <Target Type="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> - </Targets> - <Member MemberName="ComposeExportedValue<T>"> - <MemberSignature Language="C#" Value="public static void ComposeExportedValue<T> (this System.ComponentModel.Composition.Hosting.CompositionContainer container, string contractName, T exportedValue);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig void ComposeExportedValue<T>(class System.ComponentModel.Composition.Hosting.CompositionContainer container, string contractName, !!T exportedValue) cil managed" /> - <MemberType>ExtensionMethod</MemberType> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="container" Type="System.ComponentModel.Composition.Hosting.CompositionContainer" RefType="this" /> - <Parameter Name="contractName" Type="System.String" /> - <Parameter Name="exportedValue" Type="T" /> - </Parameters> - <Docs> - <typeparam name="T">To be added.</typeparam> - <param name="container">To be added.</param> - <param name="contractName">To be added.</param> - <param name="exportedValue">To be added.</param> - <summary>To be added.</summary> - </Docs> - <Link Type="System.ComponentModel.Composition.AttributedModelServices" Member="M:System.ComponentModel.Composition.AttributedModelServices.ComposeExportedValue``1(System.ComponentModel.Composition.Hosting.CompositionContainer,System.String,``0)" /> - </Member> - </ExtensionMethod> - <ExtensionMethod> - <Targets> - <Target Type="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> - </Targets> - <Member MemberName="ComposeParts"> - <MemberSignature Language="C#" Value="public static void ComposeParts (this System.ComponentModel.Composition.Hosting.CompositionContainer container, object[] attributedParts);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig void ComposeParts(class System.ComponentModel.Composition.Hosting.CompositionContainer container, object[] attributedParts) cil managed" /> - <MemberType>ExtensionMethod</MemberType> - <ReturnValue> - <ReturnType>System.Void</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="container" Type="System.ComponentModel.Composition.Hosting.CompositionContainer" RefType="this" /> - <Parameter Name="attributedParts" Type="System.Object[]"> - <Attributes> - <Attribute> - <AttributeName>System.ParamArray</AttributeName> - </Attribute> - </Attributes> - </Parameter> - </Parameters> - <Docs> - <param name="container">To be added.</param> - <param name="attributedParts">To be added.</param> - <summary>To be added.</summary> - </Docs> - <Link Type="System.ComponentModel.Composition.AttributedModelServices" Member="M:System.ComponentModel.Composition.AttributedModelServices.ComposeParts(System.ComponentModel.Composition.Hosting.CompositionContainer,System.Object[])" /> - </Member> - </ExtensionMethod> - <ExtensionMethod> - <Targets> - <Target Type="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> - </Targets> - <Member MemberName="Exports"> - <MemberSignature Language="C#" Value="public static bool Exports (this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, Type contractType);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool Exports(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, class System.Type contractType) cil managed" /> - <MemberType>ExtensionMethod</MemberType> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" RefType="this" /> - <Parameter Name="contractType" Type="System.Type" /> - </Parameters> - <Docs> - <param name="part">To be added.</param> - <param name="contractType">To be added.</param> - <summary>To be added.</summary> - </Docs> - <Link Type="System.ComponentModel.Composition.AttributedModelServices" Member="M:System.ComponentModel.Composition.AttributedModelServices.Exports(System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.Type)" /> - </Member> - </ExtensionMethod> - <ExtensionMethod> - <Targets> - <Target Type="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> - </Targets> - <Member MemberName="Exports<T>"> - <MemberSignature Language="C#" Value="public static bool Exports<T> (this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool Exports<T>(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition part) cil managed" /> - <MemberType>ExtensionMethod</MemberType> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" RefType="this" /> - </Parameters> - <Docs> - <typeparam name="T">To be added.</typeparam> - <param name="part">To be added.</param> - <summary>To be added.</summary> - </Docs> - <Link Type="System.ComponentModel.Composition.AttributedModelServices" Member="M:System.ComponentModel.Composition.AttributedModelServices.Exports``1(System.ComponentModel.Composition.Primitives.ComposablePartDefinition)" /> - </Member> - </ExtensionMethod> - <ExtensionMethod> - <Targets> - <Target Type="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> - </Targets> - <Member MemberName="Imports"> - <MemberSignature Language="C#" Value="public static bool Imports (this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, Type contractType);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool Imports(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, class System.Type contractType) cil managed" /> - <MemberType>ExtensionMethod</MemberType> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" RefType="this" /> - <Parameter Name="contractType" Type="System.Type" /> - </Parameters> - <Docs> - <param name="part">To be added.</param> - <param name="contractType">To be added.</param> - <summary>To be added.</summary> - </Docs> - <Link Type="System.ComponentModel.Composition.AttributedModelServices" Member="M:System.ComponentModel.Composition.AttributedModelServices.Imports(System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.Type)" /> - </Member> - </ExtensionMethod> - <ExtensionMethod> - <Targets> - <Target Type="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> - </Targets> - <Member MemberName="Imports"> - <MemberSignature Language="C#" Value="public static bool Imports (this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, Type contractType, System.ComponentModel.Composition.Primitives.ImportCardinality importCardinality);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool Imports(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, class System.Type contractType, valuetype System.ComponentModel.Composition.Primitives.ImportCardinality importCardinality) cil managed" /> - <MemberType>ExtensionMethod</MemberType> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" RefType="this" /> - <Parameter Name="contractType" Type="System.Type" /> - <Parameter Name="importCardinality" Type="System.ComponentModel.Composition.Primitives.ImportCardinality" /> - </Parameters> - <Docs> - <param name="part">To be added.</param> - <param name="contractType">To be added.</param> - <param name="importCardinality">To be added.</param> - <summary>To be added.</summary> - </Docs> - <Link Type="System.ComponentModel.Composition.AttributedModelServices" Member="M:System.ComponentModel.Composition.AttributedModelServices.Imports(System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.Type,System.ComponentModel.Composition.Primitives.ImportCardinality)" /> - </Member> - </ExtensionMethod> - <ExtensionMethod> - <Targets> - <Target Type="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> - </Targets> - <Member MemberName="Imports<T>"> - <MemberSignature Language="C#" Value="public static bool Imports<T> (this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool Imports<T>(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition part) cil managed" /> - <MemberType>ExtensionMethod</MemberType> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" RefType="this" /> - </Parameters> - <Docs> - <typeparam name="T">To be added.</typeparam> - <param name="part">To be added.</param> - <summary>To be added.</summary> - </Docs> - <Link Type="System.ComponentModel.Composition.AttributedModelServices" Member="M:System.ComponentModel.Composition.AttributedModelServices.Imports``1(System.ComponentModel.Composition.Primitives.ComposablePartDefinition)" /> - </Member> - </ExtensionMethod> - <ExtensionMethod> - <Targets> - <Target Type="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> - </Targets> - <Member MemberName="Imports<T>"> - <MemberSignature Language="C#" Value="public static bool Imports<T> (this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, System.ComponentModel.Composition.Primitives.ImportCardinality importCardinality);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool Imports<T>(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, valuetype System.ComponentModel.Composition.Primitives.ImportCardinality importCardinality) cil managed" /> - <MemberType>ExtensionMethod</MemberType> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" RefType="this" /> - <Parameter Name="importCardinality" Type="System.ComponentModel.Composition.Primitives.ImportCardinality" /> - </Parameters> - <Docs> - <typeparam name="T">To be added.</typeparam> - <param name="part">To be added.</param> - <param name="importCardinality">To be added.</param> - <summary>To be added.</summary> - </Docs> - <Link Type="System.ComponentModel.Composition.AttributedModelServices" Member="M:System.ComponentModel.Composition.AttributedModelServices.Imports``1(System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.ComponentModel.Composition.Primitives.ImportCardinality)" /> - </Member> - </ExtensionMethod> - <ExtensionMethod> - <Targets> - <Target Type="T:System.ComponentModel.Composition.ICompositionService" /> - </Targets> - <Member MemberName="SatisfyImportsOnce"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Primitives.ComposablePart SatisfyImportsOnce (this System.ComponentModel.Composition.ICompositionService compositionService, object attributedPart);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Primitives.ComposablePart SatisfyImportsOnce(class System.ComponentModel.Composition.ICompositionService compositionService, object attributedPart) cil managed" /> - <MemberType>ExtensionMethod</MemberType> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ComposablePart</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="compositionService" Type="System.ComponentModel.Composition.ICompositionService" RefType="this" /> - <Parameter Name="attributedPart" Type="System.Object" /> - </Parameters> - <Docs> - <param name="compositionService">To be added.</param> - <param name="attributedPart">To be added.</param> - <summary>To be added.</summary> - </Docs> - <Link Type="System.ComponentModel.Composition.AttributedModelServices" Member="M:System.ComponentModel.Composition.AttributedModelServices.SatisfyImportsOnce(System.ComponentModel.Composition.ICompositionService,System.Object)" /> - </Member> - </ExtensionMethod> - <ExtensionMethod> - <Targets> - <Target Type="T:System.ComponentModel.Composition.ICompositionService" /> - </Targets> - <Member MemberName="SatisfyImportsOnce"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Primitives.ComposablePart SatisfyImportsOnce (this System.ComponentModel.Composition.ICompositionService compositionService, object attributedPart, System.Reflection.ReflectionContext reflectionContext);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Primitives.ComposablePart SatisfyImportsOnce(class System.ComponentModel.Composition.ICompositionService compositionService, object attributedPart, class System.Reflection.ReflectionContext reflectionContext) cil managed" /> - <MemberType>ExtensionMethod</MemberType> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Primitives.ComposablePart</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="compositionService" Type="System.ComponentModel.Composition.ICompositionService" RefType="this" /> - <Parameter Name="attributedPart" Type="System.Object" /> - <Parameter Name="reflectionContext" Type="System.Reflection.ReflectionContext" /> - </Parameters> - <Docs> - <param name="compositionService">To be added.</param> - <param name="attributedPart">To be added.</param> - <param name="reflectionContext">To be added.</param> - <summary>To be added.</summary> - </Docs> - <Link Type="System.ComponentModel.Composition.AttributedModelServices" Member="M:System.ComponentModel.Composition.AttributedModelServices.SatisfyImportsOnce(System.ComponentModel.Composition.ICompositionService,System.Object,System.Reflection.ReflectionContext)" /> - </Member> - </ExtensionMethod> - <ExtensionMethod> - <Targets> - <Target Type="T:System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> - </Targets> - <Member MemberName="CreateCompositionService"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Hosting.CompositionService CreateCompositionService (this System.ComponentModel.Composition.Primitives.ComposablePartCatalog composablePartCatalog);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Hosting.CompositionService CreateCompositionService(class System.ComponentModel.Composition.Primitives.ComposablePartCatalog composablePartCatalog) cil managed" /> - <MemberType>ExtensionMethod</MemberType> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Hosting.CompositionService</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="composablePartCatalog" Type="System.ComponentModel.Composition.Primitives.ComposablePartCatalog" RefType="this" /> - </Parameters> - <Docs> - <param name="composablePartCatalog">To be added.</param> - <summary>To be added.</summary> - </Docs> - <Link Type="System.ComponentModel.Composition.Hosting.CatalogExtensions" Member="M:System.ComponentModel.Composition.Hosting.CatalogExtensions.CreateCompositionService(System.ComponentModel.Composition.Primitives.ComposablePartCatalog)" /> - </Member> - </ExtensionMethod> - <ExtensionMethod> - <Targets> - <Target Type="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> - </Targets> - <Member MemberName="ContainsPartMetadata<T>"> - <MemberSignature Language="C#" Value="public static bool ContainsPartMetadata<T> (this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string key, T value);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool ContainsPartMetadata<T>(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string key, !!T value) cil managed" /> - <MemberType>ExtensionMethod</MemberType> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" RefType="this" /> - <Parameter Name="key" Type="System.String" /> - <Parameter Name="value" Type="T" /> - </Parameters> - <Docs> - <typeparam name="T">To be added.</typeparam> - <param name="part">To be added.</param> - <param name="key">To be added.</param> - <param name="value">To be added.</param> - <summary>To be added.</summary> - </Docs> - <Link Type="System.ComponentModel.Composition.Hosting.ScopingExtensions" Member="M:System.ComponentModel.Composition.Hosting.ScopingExtensions.ContainsPartMetadata``1(System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.String,``0)" /> - </Member> - </ExtensionMethod> - <ExtensionMethod> - <Targets> - <Target Type="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> - </Targets> - <Member MemberName="ContainsPartMetadataWithKey"> - <MemberSignature Language="C#" Value="public static bool ContainsPartMetadataWithKey (this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string key);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool ContainsPartMetadataWithKey(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string key) cil managed" /> - <MemberType>ExtensionMethod</MemberType> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" RefType="this" /> - <Parameter Name="key" Type="System.String" /> - </Parameters> - <Docs> - <param name="part">To be added.</param> - <param name="key">To be added.</param> - <summary>To be added.</summary> - </Docs> - <Link Type="System.ComponentModel.Composition.Hosting.ScopingExtensions" Member="M:System.ComponentModel.Composition.Hosting.ScopingExtensions.ContainsPartMetadataWithKey(System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.String)" /> - </Member> - </ExtensionMethod> - <ExtensionMethod> - <Targets> - <Target Type="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> - </Targets> - <Member MemberName="Exports"> - <MemberSignature Language="C#" Value="public static bool Exports (this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string contractName);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool Exports(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string contractName) cil managed" /> - <MemberType>ExtensionMethod</MemberType> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" RefType="this" /> - <Parameter Name="contractName" Type="System.String" /> - </Parameters> - <Docs> - <param name="part">To be added.</param> - <param name="contractName">To be added.</param> - <summary>To be added.</summary> - </Docs> - <Link Type="System.ComponentModel.Composition.Hosting.ScopingExtensions" Member="M:System.ComponentModel.Composition.Hosting.ScopingExtensions.Exports(System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.String)" /> - </Member> - </ExtensionMethod> - <ExtensionMethod> - <Targets> - <Target Type="T:System.ComponentModel.Composition.Primitives.ComposablePartCatalog" /> - </Targets> - <Member MemberName="Filter"> - <MemberSignature Language="C#" Value="public static System.ComponentModel.Composition.Hosting.FilteredCatalog Filter (this System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, Func<System.ComponentModel.Composition.Primitives.ComposablePartDefinition,bool> filter);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.ComponentModel.Composition.Hosting.FilteredCatalog Filter(class System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, class System.Func`2<class System.ComponentModel.Composition.Primitives.ComposablePartDefinition, bool> filter) cil managed" /> - <MemberType>ExtensionMethod</MemberType> - <ReturnValue> - <ReturnType>System.ComponentModel.Composition.Hosting.FilteredCatalog</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="catalog" Type="System.ComponentModel.Composition.Primitives.ComposablePartCatalog" RefType="this" /> - <Parameter Name="filter" Type="System.Func<System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.Boolean>" /> - </Parameters> - <Docs> - <param name="catalog">To be added.</param> - <param name="filter">To be added.</param> - <summary>To be added.</summary> - </Docs> - <Link Type="System.ComponentModel.Composition.Hosting.ScopingExtensions" Member="M:System.ComponentModel.Composition.Hosting.ScopingExtensions.Filter(System.ComponentModel.Composition.Primitives.ComposablePartCatalog,System.Func{System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.Boolean})" /> - </Member> - </ExtensionMethod> - <ExtensionMethod> - <Targets> - <Target Type="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> - </Targets> - <Member MemberName="Imports"> - <MemberSignature Language="C#" Value="public static bool Imports (this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string contractName);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool Imports(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string contractName) cil managed" /> - <MemberType>ExtensionMethod</MemberType> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" RefType="this" /> - <Parameter Name="contractName" Type="System.String" /> - </Parameters> - <Docs> - <param name="part">To be added.</param> - <param name="contractName">To be added.</param> - <summary>To be added.</summary> - </Docs> - <Link Type="System.ComponentModel.Composition.Hosting.ScopingExtensions" Member="M:System.ComponentModel.Composition.Hosting.ScopingExtensions.Imports(System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.String)" /> - </Member> - </ExtensionMethod> - <ExtensionMethod> - <Targets> - <Target Type="T:System.ComponentModel.Composition.Primitives.ComposablePartDefinition" /> - </Targets> - <Member MemberName="Imports"> - <MemberSignature Language="C#" Value="public static bool Imports (this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string contractName, System.ComponentModel.Composition.Primitives.ImportCardinality importCardinality);" /> - <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool Imports(class System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string contractName, valuetype System.ComponentModel.Composition.Primitives.ImportCardinality importCardinality) cil managed" /> - <MemberType>ExtensionMethod</MemberType> - <ReturnValue> - <ReturnType>System.Boolean</ReturnType> - </ReturnValue> - <Parameters> - <Parameter Name="part" Type="System.ComponentModel.Composition.Primitives.ComposablePartDefinition" RefType="this" /> - <Parameter Name="contractName" Type="System.String" /> - <Parameter Name="importCardinality" Type="System.ComponentModel.Composition.Primitives.ImportCardinality" /> - </Parameters> - <Docs> - <param name="part">To be added.</param> - <param name="contractName">To be added.</param> - <param name="importCardinality">To be added.</param> - <summary>To be added.</summary> - </Docs> - <Link Type="System.ComponentModel.Composition.Hosting.ScopingExtensions" Member="M:System.ComponentModel.Composition.Hosting.ScopingExtensions.Imports(System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.String,System.ComponentModel.Composition.Primitives.ImportCardinality)" /> - </Member> - </ExtensionMethod> - </ExtensionMethods> -</Overview> diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/ns-System.ComponentModel.Composition.Hosting.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/ns-System.ComponentModel.Composition.Hosting.xml deleted file mode 100644 index ac31a36301a..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/ns-System.ComponentModel.Composition.Hosting.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Namespace Name="System.ComponentModel.Composition.Hosting"> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The <see cref="N:System.ComponentModel.Composition.Hosting" /> namespace provides Managed Extensibility Framework (MEF) types that are useful to developers of extensible applications, or hosts.</para> - </summary> - </Docs> -</Namespace>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/ns-System.ComponentModel.Composition.Primitives.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/ns-System.ComponentModel.Composition.Primitives.xml deleted file mode 100644 index 2e8881f6af5..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/ns-System.ComponentModel.Composition.Primitives.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Namespace Name="System.ComponentModel.Composition.Primitives"> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This namespace provides the primitive types underlying the MEF programming model.</para> - </summary> - </Docs> -</Namespace>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/ns-System.ComponentModel.Composition.ReflectionModel.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/ns-System.ComponentModel.Composition.ReflectionModel.xml deleted file mode 100644 index f1f7cad16f3..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/ns-System.ComponentModel.Composition.ReflectionModel.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Namespace Name="System.ComponentModel.Composition.ReflectionModel"> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>The <see cref="N:System.ComponentModel.Composition.ReflectionModel" /> namespace provides Managed Extensibility Framework (MEF) types for developers who use a reflection-based programming model.</para> - </summary> - </Docs> -</Namespace>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/ns-System.ComponentModel.Composition.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/ns-System.ComponentModel.Composition.xml deleted file mode 100644 index 84d912dcb79..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/ns-System.ComponentModel.Composition.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Namespace Name="System.ComponentModel.Composition"> - <Docs> - <remarks>To be added.</remarks> - <summary> - <attribution license="cc4" from="Microsoft" modified="false" /> - <para>This namespace provides classes that constitute the core of the Managed Extensibility Framework, or MEF.</para> - </summary> - </Docs> -</Namespace>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Documentation/en/ns-System.xml b/mcs/class/System.ComponentModel.Composition/Documentation/en/ns-System.xml deleted file mode 100644 index c969274264a..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Documentation/en/ns-System.xml +++ /dev/null @@ -1,6 +0,0 @@ -<Namespace Name="System"> - <Docs> - <summary>To be added.</summary> - <remarks>To be added.</remarks> - </Docs> -</Namespace> diff --git a/mcs/class/System.ComponentModel.Composition/Makefile b/mcs/class/System.ComponentModel.Composition/Makefile deleted file mode 100644 index a039de61fec..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -thisdir = class/System.ComponentModel.Composition -SUBDIRS = -include ../../build/rules.make - -LIBRARY = System.ComponentModel.Composition.dll -LIB_MCS_FLAGS = -r:System.dll -r:System.Core.dll -d:CLR40 -resource:$(STRING_MESSAGES) - -STRING_MESSAGES = Microsoft.Internal.Strings.resources - -CLEAN_FILES += $(STRING_MESSAGES) - -EXTRA_DISTFILES = \ - src/ComponentModel/Strings.resx - -VALID_PROFILE := $(filter 4, $(FRAMEWORK_VERSION_MAJOR)) -ifndef VALID_PROFILE -LIBRARY_NAME = dummy-System.ComponentModel.Composition.dll -NO_INSTALL = yes -NO_SIGN_ASSEMBLY = yes -NO_TEST = yes -endif - -include ../../build/library.make - -$(the_lib): $(STRING_MESSAGES) - -$(STRING_MESSAGES): src/ComponentModel/Strings.resx - $(RESGEN) $< $@ diff --git a/mcs/class/System.ComponentModel.Composition/README.txt b/mcs/class/System.ComponentModel.Composition/README.txt deleted file mode 100644 index ece387dba60..00000000000 --- a/mcs/class/System.ComponentModel.Composition/README.txt +++ /dev/null @@ -1,13 +0,0 @@ -This directory contains an import of Microsoft's Mananged Extensibility Preview 9 -as downloaded from: - - http://mef.codeplex.com/ - -The version integrated on this release is: - - http://mef.codeplex.com/releases/view/40606 - -Only the source code and test suite has been integrated - -On top of it, we applied r160608 that needs to be re-applied after -an up-stream update. It fixes MEF on case sensitive file systems. diff --git a/mcs/class/System.ComponentModel.Composition/System.ComponentModel.Composition-net_4_0.csproj b/mcs/class/System.ComponentModel.Composition/System.ComponentModel.Composition-net_4_0.csproj deleted file mode 100644 index 7ad9e434a7d..00000000000 --- a/mcs/class/System.ComponentModel.Composition/System.ComponentModel.Composition-net_4_0.csproj +++ /dev/null @@ -1,241 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.30729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{3F374DB1-80D5-4BC4-8B86-B08AB5214C8B}</ProjectGuid>
- <OutputType>Library</OutputType>
- <NoWarn>1699</NoWarn>
- <OutputPath>./../../class/lib/net_4_0</OutputPath>
- <NoStdLib>True</NoStdLib>
- <NoConfig>True</NoConfig>
-
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>
- </RootNamespace>
- <AssemblyName>System.ComponentModel.Composition</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <NoWarn>1699</NoWarn>
- <Optimize>false</Optimize>
- <DefineConstants>DEBUG;TRACE;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;CLR40</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <NoWarn>1699</NoWarn>
- <Optimize>true</Optimize>
- <DefineConstants>NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;CLR40</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0,
- Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This
- is a problem to compile the Mono mscorlib.dll -->
- <PropertyGroup>
- <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
- </PropertyGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <ItemGroup>
- <Compile Include="..\..\build\common\Consts.cs" />
- <Compile Include="src\ComponentModel\AssemblyInfo.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Assumes.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Assumes.InternalErrorException.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\AttributeServices.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Collections\CollectionServices.CollectionOfObject.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Collections\CollectionServices.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Collections\ConditionalWeakTable.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Collections\EnumerableCardinality.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Collections\ReadOnlyDictionary.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Collections\ReadOnlyDictionaryDebuggerProxy.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Collections\WeakReferenceCollection.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\ContractServices.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\GenerationServices.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\LazyServices.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Lock.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Lock.Reader.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Lock.Writer.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\ReflectionInvoke.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\ReflectionServices.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Requires.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Runtime\Serialization\SerializationServices.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\SilverlightReflectionInvoke.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\StringComparers.cs" />
- <Compile Include="src\ComponentModel\SilverlightAdditions.cs" />
- <Compile Include="src\ComponentModel\Strings.Designer.cs" />
- <Compile Include="src\ComponentModel\SuppressMessages.cs" />
- <Compile Include="src\ComponentModel\SuppressMessagesBaselined.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\AttributedModel\AttributedExportDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\AttributedModel\AttributedModelDiscovery.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\AttributedModel\AttributedPartCreationInfo.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\AttributedModelServices.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ChangeRejectedException.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\CompositionContractMismatchException.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\CompositionError.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\CompositionErrorDebuggerProxy.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\CompositionErrorId.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\CompositionException.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\CompositionResult.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\CompositionResultOfT.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ConstraintServices.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ContractNameServices.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\CreationPolicy.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Diagnostics\CompositionTrace.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Diagnostics\CompositionTraceId.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Diagnostics\CompositionTraceSource.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Diagnostics\SilverlightTraceWriter.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Diagnostics\TraceSourceTraceWriter.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Diagnostics\TraceWriter.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ErrorBuilder.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ExceptionBuilder.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ExportAttribute.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ExportCardinalityCheckResult.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ExportMetadataAttribute.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ExportServices.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ExportServices.DisposableLazy.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\AggregateCatalog.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\AggregateExportProvider.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\AssemblyCatalog.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\AssemblyCatalogDebuggerProxy.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\AtomicComposition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\AtomicCompositionExtensions.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\CatalogExportProvider.CatalogChangeProxy.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\CatalogExportProvider.CatalogExport.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\CatalogExportProvider.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\CatalogExportProvider.PartCreatorExport.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\ComposablePartCatalogChangeEventArgs.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\ComposablePartCatalogCollection.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\ComposablePartExportProvider.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\CompositionBatch.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\CompositionBatch.SingleExportComposablePart.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\CompositionConstants.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\CompositionContainer.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\CompositionLock.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\CompositionServices.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\DirectoryCatalog.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\DirectoryCatalog.DirectoryCatalogDebuggerProxy.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\ExportProvider.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\ExportProvider.GetExportOverrides.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\ExportsChangeEventArgs.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\ImportEngine.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\ImportEngine.EngineContext.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\ImportEngine.PartManager.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\ImportEngine.RecompositionManager.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\INotifyComposablePartCatalogChanged.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\TypeCatalog.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\IAttributedImport.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ICompositionError.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ICompositionService.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ImportAttribute.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ImportCardinalityMismatchException.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ImportingConstructorAttribute.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ImportManyAttribute.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\InheritedExportAttribute.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\IPartImportsSatisfiedNotification.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\MetadataAttributeAttribute.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\MetadataServices.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\MetadataViewGenerator.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\MetadataViewProvider.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\PartCreationPolicyAttribute.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\PartCreatorOfT.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\PartCreatorOfTTMetadata.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\PartLifetimeContextOfT.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\PartMetadataAttribute.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\PartNotDiscoverableAttribute.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\ComposablePart.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\ComposablePartCatalog.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\ComposablePartCatalogDebuggerProxy.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\ComposablePartDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\ComposablePartException.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\CompositionElement.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\CompositionElementDebuggerProxy.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\CompositionElementExtensions.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\ContractBasedImportDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\Export.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\ExportDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\ExportedDelegate.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\ICompositionElement.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\ImportCardinality.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\ImportDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\IPartCreatorImportDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\SerializableCompositionElement.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\DisposableReflectionComposablePart.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ExportingMember.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ImportingItem.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ImportingMember.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ImportingParameter.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ImportType.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\IReflectionPartCreationInfo.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\LazyMemberInfo.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\PartCreatorExportDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\PartCreatorMemberImportDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\PartCreatorParameterImportDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionComposablePart.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionComposablePartDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionExtensions.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionField.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionImportDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionItem.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionItemType.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionMember.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionMemberExportDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionMemberImportDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionMethod.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionModelServices.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionParameter.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionParameterImportDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionProperty.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionType.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionWritableMember.cs" />
- <Compile Include="src\ComponentModel\System\Lazy.cs" />
- <Compile Include="src\ComponentModel\System\LazyOfTTMetadata.cs" />
- <Compile Include="src\ComponentModel\System\Tuple.cs" />
</ItemGroup>
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
- <PropertyGroup>
- <PreBuildEvent>
-
- </PreBuildEvent>
- <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' "> - - </PostBuildEvent> - <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' "> - - </PostBuildEvent>
- </PropertyGroup>
- <ItemGroup>
- <ProjectReference Include="..\corlib\corlib-net_4_0.csproj">
- <Project>{F42F5509-677F-4C93-A026-047AB6153801}</Project>
- <Name>corlib\corlib-net_4_0</Name>
- </ProjectReference>
- <ProjectReference Include="..\System\System-net_4_0-2.csproj">
- <Project>{3391D58D-26E9-48D2-9A76-4BC1A2F06BE9}</Project>
- <Name>System\System-net_4_0-2</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Core\System.Core-net_4_0.csproj">
- <Project>{8B53B0E9-E0CA-4378-8C57-F85D518871D3}</Project>
- <Name>System.Core\System.Core-net_4_0</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <Folder Include="Properties\" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Microsoft.Internal.Strings.resources">
- <LogicalName>Microsoft.Internal.Strings.resources</LogicalName>
- </EmbeddedResource>
- </ItemGroup>
-</Project>
- diff --git a/mcs/class/System.ComponentModel.Composition/System.ComponentModel.Composition-net_4_5.csproj b/mcs/class/System.ComponentModel.Composition/System.ComponentModel.Composition-net_4_5.csproj deleted file mode 100644 index 9b6a7217eb1..00000000000 --- a/mcs/class/System.ComponentModel.Composition/System.ComponentModel.Composition-net_4_5.csproj +++ /dev/null @@ -1,246 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.30729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{51392CAD-5DCF-443F-8ECF-C9113DF3B91A}</ProjectGuid>
- <OutputType>Library</OutputType>
- <NoWarn>1699,219,414</NoWarn>
- <OutputPath>./../../class/lib/net_4_5</OutputPath>
- <NoStdLib>True</NoStdLib>
- <NoConfig>True</NoConfig>
-
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>
- </RootNamespace>
- <AssemblyName>System.ComponentModel.Composition</AssemblyName>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <NoWarn>1699,219,414</NoWarn>
- <Optimize>false</Optimize>
- <DefineConstants>DEBUG;TRACE;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;CLR40;USE_ECMA_KEY;FEATURE_REFLECTIONCONTEXT;FEATURE_REFLECTIONFILEIO;FEATURE_SERIALIZATION;FEATURE_SLIMLOCK</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <NoWarn>1699,219,414</NoWarn>
- <Optimize>true</Optimize>
- <DefineConstants>NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;CLR40;USE_ECMA_KEY;FEATURE_REFLECTIONCONTEXT;FEATURE_REFLECTIONFILEIO;FEATURE_SERIALIZATION;FEATURE_SLIMLOCK</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0,
- Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This
- is a problem to compile the Mono mscorlib.dll -->
- <PropertyGroup>
- <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
- </PropertyGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <ItemGroup>
- <Compile Include="..\..\build\common\Consts.cs" />
- <Compile Include="src\ComponentModel\AssemblyInfo.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Assumes.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Assumes.InternalErrorException.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\AttributeServices.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Collections\CollectionServices.CollectionOfObject.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Collections\CollectionServices.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Collections\ConditionalWeakTable.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Collections\EnumerableCardinality.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Collections\ReadOnlyDictionary.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Collections\ReadOnlyDictionaryDebuggerProxy.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Collections\WeakReferenceCollection.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\ContractServices.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\GenerationServices.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\LazyServices.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Lock.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Lock.Reader.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Lock.Writer.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\ReflectionInvoke.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\ReflectionServices.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Requires.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\Runtime\Serialization\SerializationServices.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\SilverlightReflectionInvoke.cs" />
- <Compile Include="src\ComponentModel\Microsoft\Internal\StringComparers.cs" />
- <Compile Include="src\ComponentModel\SilverlightAdditions.cs" />
- <Compile Include="src\ComponentModel\Strings.Designer.cs" />
- <Compile Include="src\ComponentModel\SuppressMessages.cs" />
- <Compile Include="src\ComponentModel\SuppressMessagesBaselined.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\AttributedModel\AttributedExportDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\AttributedModel\AttributedModelDiscovery.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\AttributedModel\AttributedPartCreationInfo.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\AttributedModelServices.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ChangeRejectedException.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\CompositionContractMismatchException.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\CompositionError.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\CompositionErrorDebuggerProxy.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\CompositionErrorId.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\CompositionException.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\CompositionResult.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\CompositionResultOfT.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ConstraintServices.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ContractNameServices.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\CreationPolicy.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Diagnostics\CompositionTrace.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Diagnostics\CompositionTraceId.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Diagnostics\CompositionTraceSource.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Diagnostics\SilverlightTraceWriter.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Diagnostics\TraceSourceTraceWriter.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Diagnostics\TraceWriter.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ErrorBuilder.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ExceptionBuilder.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ExportAttribute.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ExportCardinalityCheckResult.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ExportMetadataAttribute.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ExportServices.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ExportServices.DisposableLazy.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\AggregateCatalog.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\AggregateExportProvider.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\AssemblyCatalog.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\AssemblyCatalogDebuggerProxy.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\AtomicComposition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\AtomicCompositionExtensions.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\CatalogExportProvider.CatalogChangeProxy.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\CatalogExportProvider.CatalogExport.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\CatalogExportProvider.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\CatalogExportProvider.PartCreatorExport.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\ComposablePartCatalogChangeEventArgs.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\ComposablePartCatalogCollection.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\ComposablePartExportProvider.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\CompositionBatch.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\CompositionBatch.SingleExportComposablePart.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\CompositionConstants.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\CompositionContainer.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\CompositionLock.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\CompositionServices.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\DirectoryCatalog.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\DirectoryCatalog.DirectoryCatalogDebuggerProxy.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\ExportProvider.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\ExportProvider.GetExportOverrides.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\ExportsChangeEventArgs.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\ImportEngine.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\ImportEngine.EngineContext.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\ImportEngine.PartManager.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\ImportEngine.RecompositionManager.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\INotifyComposablePartCatalogChanged.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Hosting\TypeCatalog.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\IAttributedImport.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ICompositionError.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ICompositionService.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ImportAttribute.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ImportCardinalityMismatchException.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ImportingConstructorAttribute.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ImportManyAttribute.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\InheritedExportAttribute.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\IPartImportsSatisfiedNotification.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\MetadataAttributeAttribute.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\MetadataServices.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\MetadataViewGenerator.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\MetadataViewProvider.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\PartCreationPolicyAttribute.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\PartCreatorOfT.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\PartCreatorOfTTMetadata.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\PartLifetimeContextOfT.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\PartMetadataAttribute.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\PartNotDiscoverableAttribute.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\ComposablePart.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\ComposablePartCatalog.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\ComposablePartCatalogDebuggerProxy.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\ComposablePartDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\ComposablePartException.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\CompositionElement.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\CompositionElementDebuggerProxy.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\CompositionElementExtensions.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\ContractBasedImportDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\Export.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\ExportDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\ExportedDelegate.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\ICompositionElement.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\ImportCardinality.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\ImportDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\IPartCreatorImportDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\Primitives\SerializableCompositionElement.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\DisposableReflectionComposablePart.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ExportingMember.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ImportingItem.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ImportingMember.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ImportingParameter.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ImportType.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\IReflectionPartCreationInfo.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\LazyMemberInfo.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\PartCreatorExportDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\PartCreatorMemberImportDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\PartCreatorParameterImportDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionComposablePart.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionComposablePartDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionExtensions.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionField.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionImportDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionItem.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionItemType.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionMember.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionMemberExportDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionMemberImportDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionMethod.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionModelServices.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionParameter.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionParameterImportDefinition.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionProperty.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionType.cs" />
- <Compile Include="src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionWritableMember.cs" />
- <Compile Include="src\ComponentModel\System\Lazy.cs" />
- <Compile Include="src\ComponentModel\System\LazyOfTTMetadata.cs" />
- <Compile Include="src\ComponentModel\System\Tuple.cs" />
</ItemGroup>
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
- <PropertyGroup>
- <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' "> - - </PreBuildEvent> - <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' "> - - </PreBuildEvent> -
- <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' "> - - </PostBuildEvent> - <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' "> - - </PostBuildEvent>
- </PropertyGroup>
- <ItemGroup>
- <ProjectReference Include="../corlib/corlib-net_4_5.csproj">
- <Project>{33BF0182-AC5C-464C-995B-C9CFE74E1A95}</Project>
- <Name>corlib-net_4_5</Name>
- </ProjectReference>
- <ProjectReference Include="../System/System-net_4_5.csproj">
- <Project>{FFAC0B73-D997-493B-9C62-27656CD858BB}</Project>
- <Name>System-net_4_5</Name>
- </ProjectReference>
- <ProjectReference Include="../System.Core/System.Core-net_4_5.csproj">
- <Project>{D92530F4-3F2B-4351-BD21-9D6BEE6D2A4E}</Project>
- <Name>System.Core-net_4_5</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <Folder Include="Properties\" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Microsoft.Internal.Strings.resources">
- <LogicalName>Microsoft.Internal.Strings.resources</LogicalName>
- </EmbeddedResource>
- </ItemGroup>
-</Project>
- diff --git a/mcs/class/System.ComponentModel.Composition/System.ComponentModel.Composition.dll.sources b/mcs/class/System.ComponentModel.Composition/System.ComponentModel.Composition.dll.sources deleted file mode 100644 index b70c9d67128..00000000000 --- a/mcs/class/System.ComponentModel.Composition/System.ComponentModel.Composition.dll.sources +++ /dev/null @@ -1,153 +0,0 @@ -../../build/common/Consts.cs -src/ComponentModel/SuppressMessages.cs -src/ComponentModel/SilverlightAdditions.cs -src/ComponentModel/SuppressMessagesBaselined.cs -src/ComponentModel/AssemblyInfo.cs -src/ComponentModel/Microsoft/Internal/Runtime/Serialization/SerializationServices.cs -src/ComponentModel/Microsoft/Internal/GenerationServices.cs -src/ComponentModel/Microsoft/Internal/Lock.cs -src/ComponentModel/Microsoft/Internal/Requires.cs -src/ComponentModel/Microsoft/Internal/SilverlightReflectionInvoke.cs -src/ComponentModel/Microsoft/Internal/Assumes.InternalErrorException.cs -src/ComponentModel/Microsoft/Internal/ContractServices.cs -src/ComponentModel/Microsoft/Internal/LazyServices.cs -src/ComponentModel/Microsoft/Internal/Assumes.cs -src/ComponentModel/Microsoft/Internal/ReflectionServices.cs -src/ComponentModel/Microsoft/Internal/Collections/CollectionServices.cs -src/ComponentModel/Microsoft/Internal/Collections/ConditionalWeakTable.cs -src/ComponentModel/Microsoft/Internal/Collections/EnumerableCardinality.cs -src/ComponentModel/Microsoft/Internal/Collections/WeakReferenceCollection.cs -src/ComponentModel/Microsoft/Internal/Collections/ReadOnlyDictionaryDebuggerProxy.cs -src/ComponentModel/Microsoft/Internal/Collections/ReadOnlyDictionary.cs -src/ComponentModel/Microsoft/Internal/Collections/CollectionServices.CollectionOfObject.cs -src/ComponentModel/Microsoft/Internal/StringComparers.cs -src/ComponentModel/Microsoft/Internal/ReflectionInvoke.cs -src/ComponentModel/Microsoft/Internal/Lock.Reader.cs -src/ComponentModel/Microsoft/Internal/Lock.Writer.cs -src/ComponentModel/Microsoft/Internal/AttributeServices.cs -src/ComponentModel/System/Lazy.cs -src/ComponentModel/System/LazyOfTTMetadata.cs -src/ComponentModel/System/ComponentModel/Composition/MetadataViewGenerator.cs -src/ComponentModel/System/ComponentModel/Composition/ErrorBuilder.cs -src/ComponentModel/System/ComponentModel/Composition/ExportServices.DisposableLazy.cs -src/ComponentModel/System/ComponentModel/Composition/MetadataViewProvider.cs -src/ComponentModel/System/ComponentModel/Composition/PartCreatorOfTTMetadata.cs -src/ComponentModel/System/ComponentModel/Composition/PartLifetimeContextOfT.cs -src/ComponentModel/System/ComponentModel/Composition/ImportManyAttribute.cs -src/ComponentModel/System/ComponentModel/Composition/IAttributedImport.cs -src/ComponentModel/System/ComponentModel/Composition/IPartImportsSatisfiedNotification.cs -src/ComponentModel/System/ComponentModel/Composition/MetadataAttributeAttribute.cs -src/ComponentModel/System/ComponentModel/Composition/ContractNameServices.cs -src/ComponentModel/System/ComponentModel/Composition/CompositionResultOfT.cs -src/ComponentModel/System/ComponentModel/Composition/PartNotDiscoverableAttribute.cs -src/ComponentModel/System/ComponentModel/Composition/ExportMetadataAttribute.cs -src/ComponentModel/System/ComponentModel/Composition/CompositionErrorDebuggerProxy.cs -src/ComponentModel/System/ComponentModel/Composition/ConstraintServices.cs -src/ComponentModel/System/ComponentModel/Composition/ExportAttribute.cs -src/ComponentModel/System/ComponentModel/Composition/CreationPolicy.cs -src/ComponentModel/System/ComponentModel/Composition/ImportingConstructorAttribute.cs -src/ComponentModel/System/ComponentModel/Composition/AttributedModel/AttributedPartCreationInfo.cs -src/ComponentModel/System/ComponentModel/Composition/AttributedModel/AttributedModelDiscovery.cs -src/ComponentModel/System/ComponentModel/Composition/AttributedModel/AttributedExportDefinition.cs -src/ComponentModel/System/ComponentModel/Composition/PartMetadataAttribute.cs -src/ComponentModel/System/ComponentModel/Composition/CompositionErrorId.cs -src/ComponentModel/System/ComponentModel/Composition/MetadataServices.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionField.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/PartCreatorMemberImportDefinition.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionComposablePart.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionExtensions.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionMember.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/PartCreatorExportDefinition.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionImportDefinition.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ImportingParameter.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionMethod.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/PartCreatorParameterImportDefinition.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionModelServices.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ImportingMember.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionWritableMember.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionParameter.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionMemberImportDefinition.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionItemType.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ImportingItem.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ExportingMember.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionParameterImportDefinition.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/LazyMemberInfo.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionMemberExportDefinition.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ImportType.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionType.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionComposablePartDefinition.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionItem.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/IReflectionPartCreationInfo.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/DisposableReflectionComposablePart.cs -src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionProperty.cs -src/ComponentModel/System/ComponentModel/Composition/InheritedExportAttribute.cs -src/ComponentModel/System/ComponentModel/Composition/Primitives/ImportCardinality.cs -src/ComponentModel/System/ComponentModel/Composition/Primitives/ExportedDelegate.cs -src/ComponentModel/System/ComponentModel/Composition/Primitives/ComposablePartException.cs -src/ComponentModel/System/ComponentModel/Composition/Primitives/CompositionElementExtensions.cs -src/ComponentModel/System/ComponentModel/Composition/Primitives/ComposablePart.cs -src/ComponentModel/System/ComponentModel/Composition/Primitives/ComposablePartCatalogDebuggerProxy.cs -src/ComponentModel/System/ComponentModel/Composition/Primitives/CompositionElementDebuggerProxy.cs -src/ComponentModel/System/ComponentModel/Composition/Primitives/ImportDefinition.cs -src/ComponentModel/System/ComponentModel/Composition/Primitives/ComposablePartCatalog.cs -src/ComponentModel/System/ComponentModel/Composition/Primitives/ICompositionElement.cs -src/ComponentModel/System/ComponentModel/Composition/Primitives/ComposablePartDefinition.cs -src/ComponentModel/System/ComponentModel/Composition/Primitives/SerializableCompositionElement.cs -src/ComponentModel/System/ComponentModel/Composition/Primitives/ContractBasedImportDefinition.cs -src/ComponentModel/System/ComponentModel/Composition/Primitives/ExportDefinition.cs -src/ComponentModel/System/ComponentModel/Composition/Primitives/Export.cs -src/ComponentModel/System/ComponentModel/Composition/Primitives/CompositionElement.cs -src/ComponentModel/System/ComponentModel/Composition/Primitives/IPartCreatorImportDefinition.cs -src/ComponentModel/System/ComponentModel/Composition/ICompositionError.cs -src/ComponentModel/System/ComponentModel/Composition/Diagnostics/TraceWriter.cs -src/ComponentModel/System/ComponentModel/Composition/Diagnostics/CompositionTraceSource.cs -src/ComponentModel/System/ComponentModel/Composition/Diagnostics/CompositionTrace.cs -src/ComponentModel/System/ComponentModel/Composition/Diagnostics/TraceSourceTraceWriter.cs -src/ComponentModel/System/ComponentModel/Composition/Diagnostics/CompositionTraceId.cs -src/ComponentModel/System/ComponentModel/Composition/Diagnostics/SilverlightTraceWriter.cs -src/ComponentModel/System/ComponentModel/Composition/ExceptionBuilder.cs -src/ComponentModel/System/ComponentModel/Composition/CompositionResult.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/DirectoryCatalog.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/ComposablePartCatalogCollection.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/AssemblyCatalog.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/TypeCatalog.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/CatalogExportProvider.CatalogChangeProxy.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/AtomicComposition.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/CatalogExportProvider.CatalogExport.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionBatch.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/INotifyComposablePartCatalogChanged.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionConstants.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/ExportProvider.GetExportOverrides.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/AggregateCatalog.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/ImportEngine.EngineContext.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/AtomicCompositionExtensions.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/ExportsChangeEventArgs.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/ComposablePartCatalogChangeEventArgs.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionContainer.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/ImportEngine.RecompositionManager.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/ComposablePartExportProvider.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/DirectoryCatalog.DirectoryCatalogDebuggerProxy.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionLock.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/AssemblyCatalogDebuggerProxy.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/ExportProvider.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/CatalogExportProvider.PartCreatorExport.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/CatalogExportProvider.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/ImportEngine.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/AggregateExportProvider.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/ImportEngine.PartManager.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionBatch.SingleExportComposablePart.cs -src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionServices.cs -src/ComponentModel/System/ComponentModel/Composition/ChangeRejectedException.cs -src/ComponentModel/System/ComponentModel/Composition/CompositionContractMismatchException.cs -src/ComponentModel/System/ComponentModel/Composition/CompositionError.cs -src/ComponentModel/System/ComponentModel/Composition/ICompositionService.cs -src/ComponentModel/System/ComponentModel/Composition/ExportServices.cs -src/ComponentModel/System/ComponentModel/Composition/AttributedModelServices.cs -src/ComponentModel/System/ComponentModel/Composition/PartCreatorOfT.cs -src/ComponentModel/System/ComponentModel/Composition/PartCreationPolicyAttribute.cs -src/ComponentModel/System/ComponentModel/Composition/ExportCardinalityCheckResult.cs -src/ComponentModel/System/ComponentModel/Composition/ImportAttribute.cs -src/ComponentModel/System/ComponentModel/Composition/ImportCardinalityMismatchException.cs -src/ComponentModel/System/ComponentModel/Composition/CompositionException.cs -src/ComponentModel/System/Tuple.cs -src/ComponentModel/Strings.Designer.cs
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/.gitattributes deleted file mode 100644 index c538ba30d2b..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -/AssemblyInfo.cs -crlf -/StringsTests.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/AssemblyInfo.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/AssemblyInfo.cs deleted file mode 100644 index 80dfc55444c..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/AssemblyInfo.cs +++ /dev/null @@ -1,7 +0,0 @@ -//------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//------------------------------------------------------------
-[assembly: System.CLSCompliant(true)]
-[assembly: System.Reflection.AssemblyTitle("System.ComponentModel.Composition.UnitTests")]
-[assembly: System.Reflection.AssemblyCopyright("(c) Microsoft Corporation. All rights reserved.")]
-[assembly: System.Reflection.AssemblyVersion("2010.02.11")]
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/ComponentModelUnitTest.csproj b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/ComponentModelUnitTest.csproj deleted file mode 100644 index 2a60f5d5458..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/ComponentModelUnitTest.csproj +++ /dev/null @@ -1,232 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
- <CodeAnalysisRuleSet>Migrated rules for ComponentModelUnitTest.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules />
- </PropertyGroup>
- <PropertyGroup>
- <OutputPath>..\..\bin</OutputPath>
- <DefineConstants>$(DefineConstants);TRACE</DefineConstants>
- <NoWarn>1570;1572;1573;1591;1699</NoWarn>
- </PropertyGroup>
- <PropertyGroup>
- <ProductVersion>9.0.30729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{82EFB8F9-4130-4275-A26A-9F4C748C1FFB}</ProjectGuid>
- <ProjectClrTypes>FULLCLR;SILVERLIGHT</ProjectClrTypes>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>
- </RootNamespace>
- <AssemblyName>System.ComponentModel.Composition.UnitTests</AssemblyName>
- <FileAlignment>512</FileAlignment>
- <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <NoWarn>;1699;1570;1572;1573;1591;0414</NoWarn>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- <OldToolsVersion>dogfood</OldToolsVersion>
- <PublishUrl>publish\</PublishUrl>
- <Install>true</Install>
- <InstallFrom>Disk</InstallFrom>
- <UpdateEnabled>false</UpdateEnabled>
- <UpdateMode>Foreground</UpdateMode>
- <UpdateInterval>7</UpdateInterval>
- <UpdateIntervalUnits>Days</UpdateIntervalUnits>
- <UpdatePeriodically>false</UpdatePeriodically>
- <UpdateRequired>false</UpdateRequired>
- <MapFileExtensions>true</MapFileExtensions>
- <ApplicationRevision>0</ApplicationRevision>
- <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
- <IsWebBootstrapper>false</IsWebBootstrapper>
- <UseApplicationTrust>false</UseApplicationTrust>
- <BootstrapperEnabled>true</BootstrapperEnabled>
- </PropertyGroup>
- <PropertyGroup>
- <SignAssembly>true</SignAssembly>
- <NoStdLib>true</NoStdLib>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\..\..\..\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll</HintPath>
- </Reference>
- <Reference Include="mscorlib" />
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="WindowsBase" />
- <ProjectReference Include="..\..\src\ComponentModel\ComponentModel.csproj">
- <Project>{1BBA5101-D4F0-48B8-A5D6-7B23A099DCE3}</Project>
- <Name>ComponentModel</Name>
- </ProjectReference>
- <ProjectReference Include="..\UnitTestFramework\UnitTestFramework.csproj">
- <Project>{35FBE8A0-D87E-4991-B3FC-2A77807DEC85}</Project>
- <Name>UnitTestFramework</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="AssemblyInfo.cs" />
- <Compile Include="Microsoft\Internal\Collections\ConditionalWeakTableTests.cs" />
- <Compile Include="Microsoft\Internal\Collections\WeakReferenceCollectionTests.cs" />
- <Compile Include="StringsTests.cs" />
- <Compile Include="Microsoft\Internal\Collections\ReadOnlyDictionaryDebuggerProxyTests.cs" />
- <Compile Include="Microsoft\Internal\Collections\ReadOnlyDictionaryTests.cs" />
- <Compile Include="System\ComponentModel\Composition\AttributedModel\AttributedModelDiscoveryTests.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionServiceExtensionsTests.cs" />
- <Compile Include="System\ComponentModel\Composition\AdvancedValueComposition.cs" />
- <Compile Include="System\ComponentModel\Composition\AttributedModel\AllowNonPublicCompositionTests.cs" />
- <Compile Include="System\ComponentModel\Composition\AttributedModel\AttributedModelCompositionTests.cs" />
- <Compile Include="System\ComponentModel\Composition\AttributedModel\INotifyImportTests.cs" />
- <Compile Include="System\ComponentModel\Composition\ComposablePartCatalogExtensions.cs" />
- <Compile Include="System\ComponentModel\Composition\ComposablePartExceptionTests.cs" />
- <Compile Include="System\ComponentModel\Composition\ComposablePartExtensibilityTests.cs" />
- <Compile Include="System\ComponentModel\Composition\ComposablePartDefinitionTests.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionContainerExtensions.cs" />
- <Compile Include="System\ComponentModel\Composition\Diagnostics\CompositionTraceIdTests.cs" />
- <Compile Include="System\ComponentModel\Composition\Diagnostics\CompositionTraceSourceTests.cs" />
- <Compile Include="System\ComponentModel\Composition\Extensibility\CustomImportManyAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\Extensibility\CustomImportAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\CatalogFactory.NonFilteringTypeCatalog.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\CatalogFactory.MutableComposablePartCatalog.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ImportEngineTests.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionErrorIdTests.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionResultTest.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionServiceProxy.cs" />
- <Compile Include="System\ComponentModel\Composition\ConcreteComposablePart.cs" />
- <Compile Include="System\ComponentModel\Composition\ConstraintServicesTests.cs" />
- <Compile Include="System\ComponentModel\Composition\ContractMismatchExceptionTests.cs" />
- <Compile Include="System\ComponentModel\Composition\CardinalityMismatchExceptionTests.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionErrorTests.cs" />
- <Compile Include="Microsoft\Internal\AssumesTests.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionExceptionTests.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionResultOfTTest.cs" />
- <Compile Include="System\ComponentModel\Composition\AggregateExportProviderTest.cs" />
- <Compile Include="System\ComponentModel\Composition\Expectations.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportProviderTests.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\CatalogFactory.FilteredComposablePartCatalog.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\CatalogFactory.DerivedComposablePartCatalog.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\ReflectionFactory.MockParameterInfo.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\ReflectionFactory.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\ElementFactory.CompositionElement.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\ElementFactory.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\ErrorFactory.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\ExportProviderFactory.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\ExportProviderFactory.RecomposableExportProvider.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\ExportProviderFactory.NoOverridesExportProvider.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\AggregateCatalogTest.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\AssemblyCatalogDebuggerProxyTests.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\AssemblyCatalogTests.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CatalogExportProviderTests.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CompositionBatchTests.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CompositionTransactionTests.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\DirectoryCatalogTests.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\DirectoryCatalogDebuggerProxyTests.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\TypeCatalogTests.cs" />
- <Compile Include="System\ComponentModel\Composition\AttributedModelServicesTests.cs" />
- <Compile Include="System\ComponentModel\Composition\MetadataViewProviderTests.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionContainerCycleTests.cs" />
- <Compile Include="System\ComponentModel\Composition\ContractBasedImportDefinitionTests.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\CatalogFactory.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\ConstraintFactory.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\CatalogFactory.DisposableComposablePartCatalog.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\CatalogFactory.NoOverridesComposablePartCatalog.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\ContainerFactory.DisposableCompositionContainer.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\ContainerFactory.NoOverridesCompositionContainer.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\PartDefinitionFactory.DerivedComposablePartDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\PartDefinitionFactory.NoOverridesComposablePartDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\PartFactory.NoOverridesComposablePart.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\ExportDefinitionFactory.DerivedExportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\ImportDefinitionFactory.DerivedImportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\ImportDefinitionFactory.DerivedContractBasedImportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\PartFactory.DisposableComposablePart.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\PartDefinitionFactory.cs" />
- <Compile Include="System\ComponentModel\Composition\PartCreationPolicyAttributeTests.cs" />
- <Compile Include="System\ComponentModel\Composition\PartMetadataAttributeTests.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionErrorDebuggerProxyTests.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePartCatalogDebuggerProxyTests.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePartCatalogTests.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\CompositionElementDebuggerProxyTests.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\CompositionElementTests.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\SerializableCompositionElementTests.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\LazyMemberInfoTests.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionComposablePartDefinitionTests.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionComposablePartTests.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionMemberExportDefinitionTests.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionMemberImportDefinitionTests.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionModelServicesTests.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionParameterImportDefinitionTests.cs" />
- <Compile Include="System\ComponentModel\Composition\UnitTesting\ConstraintAssert.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportDefinitionTests.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\ExportDefinitionFactory.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\ImportDefinitionFactory.cs" />
- <Compile Include="System\ComponentModel\Composition\ImportDefinitionTests.cs" />
- <Compile Include="System\ComponentModel\Composition\ImportingConstructorAttributeTests.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\ContainerFactory.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\ExportFactory.cs" />
- <Compile Include="System\ComponentModel\Composition\Factories\PartFactory.cs" />
- <Compile Include="System\ComponentModel\Composition\GenerationServicesTests.cs" />
- <Compile Include="System\ComponentModel\Composition\ImportingComposablePart.cs" />
- <Compile Include="System\ComponentModel\Composition\MicroExport.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportCollectionTests.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportTests.cs" />
- <Compile Include="System\ComponentModel\Composition\MetadataAttributeAttributeTests.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportMetadataAttributeTests.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionContainerCollectionTests.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionContainerExtensibilityTests.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionContainerImportTests.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionContainerTests.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionServicesTests.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportAttributeTests.cs" />
- <Compile Include="System\ComponentModel\Composition\ImportAttributeTests.cs" />
- <Compile Include="System\ComponentModel\Composition\ComposablePartTests.cs" />
- <Compile Include="System\ComponentModel\Composition\ComponentModelTestTypes.cs" />
- <Compile Include="System\ComponentModel\Composition\ComponentServicesTests.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportableAttributeTests.cs" />
- <Compile Include="System\ComponentModel\Composition\InitializationScopeTests.cs" />
- <Compile Include="System\ComponentModel\Composition\MetadataTests.cs" />
- <Compile Include="System\Integration\AdaptingCollectionTests.cs" />
- <Compile Include="System\Integration\DelayLoadingTests.cs" />
- <Compile Include="System\Integration\ExportProviderEventTests.cs" />
- <Compile Include="System\Integration\DelegateCompositionTests.cs" />
- <Compile Include="System\Integration\DiscoveryTests.cs" />
- <Compile Include="System\Integration\RejectionTests.cs" />
- <Compile Include="System\Integration\RequiredCreationPolicyTests.cs" />
- <Compile Include="System\Integration\LifetimeTests.cs" />
- <Compile Include="System\LazyOfTTMetadataTests.cs" />
- <Compile Include="System\UnitTesting\ReflectionItemAssert.cs" />
- <Compile Include="System\ComponentModel\Composition\SampleComponents.cs" />
- <Compile Include="System\Integration\CatalogFilteringTests.cs" />
- <Compile Include="System\Integration\CompositionContainerAttributedModelCycleTests.cs" />
- <Compile Include="System\Integration\ConstructorInjectionTests.cs" />
- <Compile Include="System\Integration\RecompositionTests.cs" />
- <Compile Include="System\UnitTesting\TestUtilities.cs" />
- </ItemGroup>
- <ItemGroup Condition="'$(IsSilverLight)' != 'true'">
- <Compile Include="System\ComponentModel\Composition\DynamicMetadata.cs" />
- </ItemGroup>
- <ItemGroup>
- <BootstrapperPackage Include=".NETFramework,Version=v4.0">
- <Visible>False</Visible>
- <ProductName>Microsoft .NET Framework 4 %28x86 and x64%29</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
- <Install>false</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1</ProductName>
- <Install>false</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
- <Visible>False</Visible>
- <ProductName>Windows Installer 3.1</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
-</Project>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/.gitattributes deleted file mode 100644 index 6562b26af9d..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -/AssumesTests.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/AssumesTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/AssumesTests.cs deleted file mode 100644 index 6286722b4db..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/AssumesTests.cs +++ /dev/null @@ -1,301 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition;
-using System.Collections.Generic;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-#if !SILVERLIGHT
-using System.Runtime.Serialization;
-#endif
-
-namespace Microsoft.Internal
-{
- [TestClass]
- public class AssumesTests
- {
- [TestMethod]
- public void NotNullOfT_NullAsValueArgument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.NotNull<string>((string)null);
- });
- }
-
- [TestMethod]
- public void NotNullOfT1T2_NullAsValue1Argument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.NotNull<string, string>((string)null, "Value");
- });
- }
-
- [TestMethod]
- public void NotNullOfT1T2_NullAsValue2Argument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.NotNull<string, string>("Value", (string)null);
- });
- }
-
- [TestMethod]
- public void NotNullOfT1T2_NullAsValue1ArgumentAndValue2Argument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.NotNull<string, string>((string)null, (string)null);
- });
- }
-
- [TestMethod]
- public void NotNullOfT1T2T3_NullAsValue1Argument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.NotNull<string, string, string>((string)null, "Value", "Value");
- });
- }
-
- [TestMethod]
- public void NotNullOfT1T2T3_NullAsValue2Argument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.NotNull<string, string, string>("Value", (string)null, "Value");
- });
- }
-
- [TestMethod]
- public void NotNullOfT1T2T3_NullAsValue3Argument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.NotNull<string, string, string>("Value", "Value", (string)null);
- });
- }
-
- [TestMethod]
- public void NotNullOfT1T2T3_NullAsValue1ArgumentAndValue2Argument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.NotNull<string, string, string>((string)null, (string)null, "Value");
- });
- }
-
- [TestMethod]
- public void NotNullOfT1T2T3_NullAsValue1ArgumentAnd3_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.NotNull<string, string, string>((string)null, "Value", (string)null);
- });
- }
-
- [TestMethod]
- public void NotNullOfT1T2T3_NullAsValue2ArgumentAndValue3Argument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.NotNull<string, string, string>("Value", (string)null, (string)null);
- });
- }
-
- [TestMethod]
- public void NotNullOfT_ValueAsValueArgument_ShouldNotThrow()
- {
- Assumes.NotNull<string>("Value");
- }
-
- [TestMethod]
- public void NotNullOfT1T2_ValueAsValue1ArgumentAndValue2Argument_ShouldNotThrow()
- {
- Assumes.NotNull<string, string>("Value", "Value");
- }
-
- [TestMethod]
- public void NotNullOfT1T2T3_ValueAsValue1ArgumentAndValue2ArgumentAndValue3Argument_ShouldNotThrow()
- {
- Assumes.NotNull<string, string, string>("Value", "Value", "Value");
- }
-
- [TestMethod]
- public void NullOfT_NullAsValueArgument_ShouldNotThrow()
- {
- Assumes.Null<string>((string)null);
- }
-
- [TestMethod]
- public void NullOfT_ValueAsValueArgument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.Null<string>("Value");
- });
- }
-
- [TestMethod]
- public void NotNullOrEmpty_NullAsValueArgument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.NotNullOrEmpty((string)null);
- });
- }
-
- [TestMethod]
- public void NotNullOrEmpty_EmptyAsValueArgument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.NotNullOrEmpty("");
- });
- }
-
- [TestMethod]
- public void NotNullOrEmpty_ValueAsValueArgument_ShouldNotThrow()
- {
- var expectations = new List<string>();
- expectations.Add(" ");
- expectations.Add(" ");
- expectations.Add(" ");
- expectations.Add("Value");
-
- foreach (var e in expectations)
- {
- Assumes.NotNullOrEmpty(e);
- }
- }
-
- [TestMethod]
- public void IsTrue1_FalseAsConditionArgument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.IsTrue(false);
- });
- }
-
- [TestMethod]
- public void IsTrue2_FalseAsConditionArgument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.IsTrue(false, "Message");
- });
- }
-
- [TestMethod]
- public void IsTrue1_TrueAsConditionArgument_ShouldNotThrow()
- {
- Assumes.IsTrue(true);
- }
-
- [TestMethod]
- public void IsTrue2_TrueAsConditionArgument_ShouldNotThrow()
- {
- Assumes.IsTrue(true, "Message");
- }
-
- [TestMethod]
- public void IsFalse1_TrueAsConditionArgument_ShouldThrowInternalErrorException()
- {
- Throws(() =>
- {
- Assumes.IsFalse(true);
- });
- }
-
- [TestMethod]
- public void IsFalse1_FalseAsConditionArgument_ShouldNotThrow()
- {
- Assumes.IsFalse(false);
- }
-
- [TestMethod]
- public void NotReachable_ShouldAlwaysThrow()
- {
- Throws(() =>
- {
- Assumes.NotReachable<object>();
- });
- }
-
- [TestMethod]
- public void Fail_ShouldThrowInternalErrorException()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- Throws(() =>
- {
- Assumes.Fail(e);
- });
- }
- }
-
- private static void Throws(Action action)
- {
- try
- {
- action();
- Assert.Fail();
- }
- catch (Exception ex)
- {
- Type exceptionType = ex.GetType();
-
- // The exception should not be a
- // publicily catchable exception
- Assert.IsFalse(exceptionType.IsVisible);
- }
- }
-
-#if !SILVERLIGHT
-
- [TestMethod]
- public void Message_CanBeSerialized()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = CreateInternalErrorException(e);
-
- var result = SerializationTestServices.RoundTrip(exception);
-
- Assert.AreEqual(exception.Message, result.Message);
- }
- }
-
-#endif
-
- private static Exception CreateInternalErrorException()
- {
- return CreateInternalErrorException((string)null);
- }
-
- private static Exception CreateInternalErrorException(string message)
- {
- Exception exception = null;
-
- try
- {
- Assumes.Fail(message);
- }
- catch (Exception ex)
- {
- exception = ex;
- }
-
- Assert.IsNotNull(exception);
- return exception;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/Collections/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/Collections/.gitattributes deleted file mode 100644 index 1496b702476..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/Collections/.gitattributes +++ /dev/null @@ -1,4 +0,0 @@ -/ConditionalWeakTableTests.cs -crlf -/ReadOnlyDictionaryDebuggerProxyTests.cs -crlf -/ReadOnlyDictionaryTests.cs -crlf -/WeakReferenceCollectionTests.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/Collections/ConditionalWeakTableTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/Collections/ConditionalWeakTableTests.cs deleted file mode 100644 index 66e52344156..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/Collections/ConditionalWeakTableTests.cs +++ /dev/null @@ -1,226 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Runtime.CompilerServices;
-using System.Text;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace Microsoft.Internal.Collections
-{
- [TestClass]
- public class ConditionalWeakTableTests
- {
- [TestMethod]
- public void Add_KeyShouldBeCollected()
- {
- var obj = new object();
- var cwt = new ConditionalWeakTable<object, object>();
-
- cwt.Add(obj, new object());
-
- var wr = new WeakReference(obj);
-
- obj = null;
-
- GC.Collect();
- GC.WaitForPendingFinalizers();
-
- Assert.IsNull(wr.Target, "Key should be collected now!");
-
- GC.KeepAlive(cwt);
- }
-
- [TestMethod]
- public void Add_KeyHeld_ValueShouldNotBeCollected()
- {
- var obj = new object();
- var str = new StringBuilder();
- var cwt = new ConditionalWeakTable<object, StringBuilder>();
-
- var wrKey = new WeakReference(obj);
- var wrValue = new WeakReference(str);
-
- cwt.Add(obj, str);
-
- str = null;
-
- GC.Collect();
- GC.WaitForPendingFinalizers();
-
- // Should still have both references
- Assert.IsNotNull(wrKey.Target, "Key should NOT be collected yet!");
- Assert.IsNotNull(wrValue.Target, "Value should NOT be collected yet!");
-
- GC.KeepAlive(obj);
- GC.KeepAlive(cwt);
- }
-
-#if CLR40
- [TestMethod]
- public void Add_KeyCollected_ValueShouldBeCollected()
- {
- var obj = new object();
- var str = new StringBuilder();
- var cwt = new ConditionalWeakTable<object, StringBuilder>();
-
- cwt.Add(obj, str);
-
- var wrKey = new WeakReference(obj);
- var wrValue = new WeakReference(str);
- str = null;
- obj = null;
-
- GC.Collect();
- GC.WaitForPendingFinalizers();
-
- Assert.IsNull(wrKey.Target, "Key should be collected now!");
- Assert.IsNull(wrValue.Target, "Value should be collected now!");
-
- GC.KeepAlive(cwt);
- }
-#endif
-
- [TestMethod]
- public void Remove_ValidKey_ShouldReturnTrue()
- {
- var obj = new object();
- var obj2 = new object();
- var cwt = new ConditionalWeakTable<object, object>();
-
- cwt.Add(obj, obj2);
-
- Assert.IsTrue(cwt.Remove(obj));
- }
-
- [TestMethod]
- public void Remove_InvalidKey_ShouldReturnTrue()
- {
- var obj = new object();
- var obj2 = new object();
- var cwt = new ConditionalWeakTable<object, object>();
-
- cwt.Add(obj, obj2);
-
- Assert.IsFalse(cwt.Remove(obj2));
- }
-
- [TestMethod]
- public void TryGetValue_ValidKey_ShouldReturnTrueAndValue()
- {
- var obj = new object();
- var obj2 = new object();
- var cwt = new ConditionalWeakTable<object, object>();
-
- cwt.Add(obj, obj2);
-
- object obj3;
- Assert.IsTrue(cwt.TryGetValue(obj, out obj3), "Should find a value with the key!");
- Assert.AreEqual(obj2, obj3);
- }
-
- [TestMethod]
- public void TryGetValue_InvalidKey_ShouldReturnFalseAndNull()
- {
- var obj = new object();
- var obj2 = new object();
- var cwt = new ConditionalWeakTable<object, object>();
-
- cwt.Add(obj, obj2);
-
- object obj3;
- Assert.IsFalse(cwt.TryGetValue(obj2, out obj3), "Should NOT find a value with the key!");
- Assert.IsNull(obj3);
- }
-
-#if !CLR40
- [TestMethod]
- public void Add_KeyValueSame_KeyShouldNotBeCollected()
- {
- // Dev10:556089 - This test demonstrations a bug in our implementation
- // of ConditionalWeakTable which needs CLR 4 support to fix so once
- // we switch to the CLR 4 version of ConditionalWeakTable this should go away.
-
- var obj = new object();
- var cwt = new ConditionalWeakTable<object, object>();
-
- cwt.Add(obj, obj);
-
- var wrKey = new WeakReference(obj);
- obj = null;
-
- GC.Collect();
- GC.WaitForPendingFinalizers();
-
- Assert.IsNotNull(wrKey.Target, "Key should NOT be collected yet!");
-
- // Apply pressure to ensure they still don't go away.
- ApplyMemoryPressureOnConditionalWeakTable(cwt);
-
- Assert.IsNotNull(wrKey.Target, "Key should NOT be collected yet!");
-
- GC.KeepAlive(cwt);
- }
-
- public class ObjectHolder
- {
- public object Obj { get; set; }
- public ObjectHolder() { }
- public ObjectHolder(object obj)
- {
- Obj = obj;
- }
- }
-
- [TestMethod]
- public void Add_ValueReferencesKey_KeyAndValueShouldNotBeCollected()
- {
- // Dev10:556089 - This test demonstrations a bug in our implementation
- // of ConditionalWeakTable which needs CLR 4 support to fix so once
- // we switch to the CLR 4 version of ConditionalWeakTable this should go away.
-
- var obj = new object();
- var holder = new ObjectHolder(obj);
- var cwt = new ConditionalWeakTable<object, ObjectHolder>();
-
- cwt.Add(obj, holder);
-
- var wrKey = new WeakReference(obj);
- var wrValue = new WeakReference(holder);
- holder = null;
- obj = null;
-
- GC.Collect();
- GC.WaitForPendingFinalizers();
-
- Assert.IsNotNull(wrKey.Target, "Key should NOT be collected yet!");
- Assert.IsNotNull(wrValue.Target, "Value should NOT be collected now!");
-
- // Apply pressure to ensure they still don't go away.
- ApplyMemoryPressureOnConditionalWeakTable(cwt);
-
- Assert.IsNotNull(wrKey.Target, "Key should NOT be collected yet!");
- Assert.IsNotNull(wrValue.Target, "Value should NOT be collected now!");
-
- GC.KeepAlive(cwt);
- }
-
- private void ApplyMemoryPressureOnConditionalWeakTable<T,V>(ConditionalWeakTable<T,V> table)
- where T : class, new()
- where V : class, new()
- {
- // Adding 100 items should do it.
- for (int i = 0; i < 100; i++)
- {
- table.Add(new T(), new V());
- }
-
- GC.Collect();
- GC.WaitForPendingFinalizers();
- }
-#endif //!CLR40
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/Collections/ReadOnlyDictionaryDebuggerProxyTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/Collections/ReadOnlyDictionaryDebuggerProxyTests.cs deleted file mode 100644 index d0068e24d90..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/Collections/ReadOnlyDictionaryDebuggerProxyTests.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace Microsoft.Internal.Collections
-{
- [TestClass]
- public class ReadOnlyDictionaryDebuggerProxyTests
- {
- [TestMethod]
- public void Constructor_NullAsDictionaryArgument_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("dictionary", () =>
- {
- new ReadOnlyDictionaryDebuggerProxy<string, object>((ReadOnlyDictionary<string, object>)null);
- });
- }
-
- [TestMethod]
- public void Constructor_EmptyDictionaryAsDictionaryArgument_ShouldSetItemsPropertyToEmptyEnumerable()
- {
- var dictionary = CreateReadOnlyDictionary<string, object>();
-
- var proxy = new ReadOnlyDictionaryDebuggerProxy<string, object>(dictionary);
-
- EnumerableAssert.IsEmpty(proxy.Items);
- }
-
- [TestMethod]
- public void Constructor_ValueAsDictionaryArgument_ShouldSetItemsProperty()
- {
- var expectations = Expectations.GetMetadata();
-
- foreach (var e in expectations)
- {
- var proxy = new ReadOnlyDictionaryDebuggerProxy<string, object>(CreateReadOnlyDictionary(e));
-
- EnumerableAssert.AreEqual(e, proxy.Items);
- }
- }
-
- [TestMethod]
- public void Items_ShouldNotCacheUnderlyingItems()
- {
- var dictionary = new Dictionary<string, object>();
- dictionary.Add("Name", "Value");
-
- var proxy = new ReadOnlyDictionaryDebuggerProxy<string, object>(CreateReadOnlyDictionary(dictionary));
-
- EnumerableAssert.AreEqual(dictionary, proxy.Items);
-
- dictionary.Add("AnotherName", "Value");
-
- EnumerableAssert.AreEqual(dictionary, proxy.Items);
-
- dictionary.Add("AndAnotherName", "Value");
-
- EnumerableAssert.AreEqual(dictionary, proxy.Items);
- }
-
- private static ReadOnlyDictionary<TKey, TValue> CreateReadOnlyDictionary<TKey, TValue>()
- {
- return CreateReadOnlyDictionary<TKey, TValue>(null);
- }
-
- private static ReadOnlyDictionary<TKey, TValue> CreateReadOnlyDictionary<TKey, TValue>(IDictionary<TKey, TValue> dictionary)
- {
- return new ReadOnlyDictionary<TKey, TValue>(dictionary);
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/Collections/ReadOnlyDictionaryTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/Collections/ReadOnlyDictionaryTests.cs deleted file mode 100644 index bad8b195370..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/Collections/ReadOnlyDictionaryTests.cs +++ /dev/null @@ -1,214 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace Microsoft.Internal.Collections
-{
- [TestClass]
- public class ReadOnlyDictionaryTests
- {
- [TestMethod]
- public void Constructor_NullAsDictionaryArgument_ShouldCreateEmptyDictionary()
- {
- var dictionary = new ReadOnlyDictionary<string, object>(null);
-
- EnumerableAssert.IsEmpty(dictionary);
- }
-
- [TestMethod]
- public void Constructor_WritableDictionaryAsDictionaryArgument_ShouldPopulateCollection()
- {
- var dictionary = GetWritableDictionaryWithData();
- var readOnlyDictionary = new ReadOnlyDictionary<string, object>(dictionary);
-
- EnumerableAssert.AreEqual(dictionary, readOnlyDictionary);
- }
-
- [TestMethod]
- public void Add1_ShouldThrowNotSupported()
- {
- var dictionary = GetReadOnlyDictionaryWithData();
-
- ExceptionAssert.Throws<NotSupportedException>(() =>
- {
- dictionary.Add(new KeyValuePair<string, object>("Key", "Value"));
- });
- }
-
- [TestMethod]
- public void Add2_ShouldThrowNotSupported()
- {
- var dictionary = GetReadOnlyDictionaryWithData();
-
- ExceptionAssert.Throws<NotSupportedException>(() =>
- {
- dictionary.Add("Key", "Value");
- });
- }
-
- [TestMethod]
- public void Clear_ShouldThrowNotSupported()
- {
- var dictionary = GetReadOnlyDictionaryWithData();
-
- ExceptionAssert.Throws<NotSupportedException>(() =>
- {
- dictionary.Clear();
- });
- }
-
- [TestMethod]
- public void Remove1_ShouldThrowNotSupported()
- {
- var dictionary = GetReadOnlyDictionaryWithData();
-
- ExceptionAssert.Throws<NotSupportedException>(() =>
- {
- dictionary.Remove("Value");
- });
- }
-
- [TestMethod]
- public void Remove2_ShouldThrowNotSupported()
- {
- var dictionary = GetReadOnlyDictionaryWithData();
-
- ExceptionAssert.Throws<NotSupportedException>(() =>
- {
- dictionary.Remove(new KeyValuePair<string, object>("Key", "Value"));
- });
- }
-
- [TestMethod]
- public void ItemSet_ShouldThrowNotSupported()
- {
- var dictionary = GetReadOnlyDictionaryWithData();
-
- ExceptionAssert.Throws<NotSupportedException>(() =>
- {
- dictionary["Key"] = "Value";
- });
- }
-
- [TestMethod]
- public void Keys_ShouldReturnWrappedDictionaryKeys()
- {
- var dictionary = GetWritableDictionaryWithData();
- var readOnlyDictionary = GetReadOnlyDictionary(dictionary);
-
- EnumerableAssert.AreEqual(readOnlyDictionary.Keys, dictionary.Keys);
- }
-
- [TestMethod]
- public void Values_ShouldReturnWrappedDictionaryValues()
- {
- var dictionary = GetWritableDictionaryWithData();
- var readOnlyDictionary = GetReadOnlyDictionary(dictionary);
-
- EnumerableAssert.AreEqual(readOnlyDictionary.Values, readOnlyDictionary.Values);
- }
-
- [TestMethod]
- public void IsReadOnly_ShouldAlwaysBeTrue()
- {
- var dictionary = GetWritableDictionaryWithData();
- var readOnlyDictionary = GetReadOnlyDictionary(dictionary);
-
- Assert.IsFalse(dictionary.IsReadOnly);
- Assert.IsTrue(readOnlyDictionary.IsReadOnly);
- }
-
- [TestMethod]
- public void Count_ShouldReturnWrappedDictionaryCount()
- {
- var dictionary = GetWritableDictionaryWithData();
- var readOnlyDictionary = GetReadOnlyDictionary(dictionary);
-
- Assert.AreEqual(dictionary.Count, readOnlyDictionary.Count);
- }
-
- [TestMethod]
- public void ContainsKey()
- {
- var dictionary = GetWritableDictionaryWithData();
- var readOnlyDictionary = GetReadOnlyDictionary(dictionary);
-
- Assert.IsTrue(readOnlyDictionary.ContainsKey("Key1"));
- Assert.IsFalse(readOnlyDictionary.ContainsKey("InvalidKey"));
- }
-
- [TestMethod]
- public void Contains()
- {
- var dictionary = GetWritableDictionaryWithData();
- var readOnlyDictionary = GetReadOnlyDictionary(dictionary);
-
- Assert.IsTrue(readOnlyDictionary.Contains(new KeyValuePair<string,object>("Key1", "Value1")));
- Assert.IsFalse(readOnlyDictionary.Contains(new KeyValuePair<string,object>("InvalidKey", "Value1")));
- Assert.IsFalse(readOnlyDictionary.Contains(new KeyValuePair<string,object>("Key1", "InvalidValue")));
- }
-
- [TestMethod]
- public void CopyTo()
- {
- var dictionary = GetWritableDictionaryWithData();
- var readOnlyDictionary = GetReadOnlyDictionary(dictionary);
- KeyValuePair<string, object>[] destination = new KeyValuePair<string, object> [readOnlyDictionary.Count];
- readOnlyDictionary.CopyTo(destination, 0);
- EnumerableAssert.AreEqual(readOnlyDictionary, destination);
- }
-
- [TestMethod]
- public void GetEnumerator()
- {
- var dictionary = GetWritableDictionaryWithData();
- var readOnlyDictionary = GetReadOnlyDictionary(dictionary);
- IEnumerable<KeyValuePair<string, object>> genericEnumerable = readOnlyDictionary;
- EnumerableAssert.AreEqual(genericEnumerable, dictionary);
- IEnumerable weakEnumerable = (IEnumerable)readOnlyDictionary;
- EnumerableAssert.AreEqual(weakEnumerable, dictionary);
- }
-
- [TestMethod]
- public void Item()
- {
- var dictionary = GetWritableDictionaryWithData();
- var readOnlyDictionary = GetReadOnlyDictionary(dictionary);
- Assert.AreEqual("Value1", readOnlyDictionary["Key1"], "Expecting to read wrapped value");
- }
-
- [TestMethod]
- public void TryGetValue()
- {
- var dictionary = GetWritableDictionaryWithData();
- var readOnlyDictionary = GetReadOnlyDictionary(dictionary);
- object result;
- bool ret = readOnlyDictionary.TryGetValue("Key1", out result);
- Assert.IsTrue(ret, "Expecting TryGetExportedValue to return true for wrapped key");
- Assert.AreEqual("Value1", result, "Expecting TryGetExportedValue to return wrapped value");
- }
-
- private static IDictionary<String, object> GetReadOnlyDictionaryWithData()
- {
- return GetReadOnlyDictionary(GetWritableDictionaryWithData());
- }
-
- private static IDictionary<TKey, TValue> GetReadOnlyDictionary<TKey, TValue>(IDictionary<TKey, TValue> dictionary)
- {
- return new ReadOnlyDictionary<TKey, TValue>(dictionary);
- }
-
- private static IDictionary<String, object> GetWritableDictionaryWithData()
- {
- IDictionary<String, object> dictionary = new Dictionary<String, object>();
- dictionary.Add("Key1", "Value1");
- dictionary.Add("Key2", 42);
- return dictionary;
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/Collections/WeakReferenceCollectionTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/Collections/WeakReferenceCollectionTests.cs deleted file mode 100644 index 2c65224df26..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/Microsoft/Internal/Collections/WeakReferenceCollectionTests.cs +++ /dev/null @@ -1,104 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace Microsoft.Internal.Collections
-{
- [TestClass]
- public class WeakReferenceCollectionTests
- {
- [TestMethod]
- public void Add_ObjectShouldGetCollected()
- {
- var obj = new object();
- var wrc = new WeakReferenceCollection<object>();
-
- wrc.Add(obj);
-
- var wr = new WeakReference(obj);
- obj = null;
-
- Assert.IsNotNull(wr.Target, "Object should NOT have been collected yet!");
-
- GC.Collect();
- GC.WaitForPendingFinalizers();
-
- Assert.IsNull(wr.Target, "Object should have been collected!");
-
- GC.KeepAlive(wrc);
- }
-
- [TestMethod]
- public void Remove_ObjectShouldGetRemoved()
- {
- var obj = new object();
- var wrc = new WeakReferenceCollection<object>();
-
- wrc.Add(obj);
-
- Assert.AreEqual(1, wrc.AliveItemsToList().Count, "Should have 1 item!");
-
- wrc.Remove(obj);
-
- Assert.AreEqual(0, wrc.AliveItemsToList().Count, "Should have 0 item!");
- }
-
- [TestMethod]
- public void AliveItemsToList_ShouldReturnAllItems()
- {
- var list = new object[] {new object(), new object(), new object()};
- var wrc = new WeakReferenceCollection<object>();
-
- foreach (object obj in list)
- {
- wrc.Add(obj);
- }
-
- Assert.AreEqual(list.Length, wrc.AliveItemsToList().Count, "Should have same number of items!");
- }
-
- [TestMethod]
- public void AliveItemsToList_ShouldReturnAllAliveItems()
- {
- var list = new object[] { new object(), new object(), new object() };
- var wrc = new WeakReferenceCollection<object>();
-
- var obj1 = new object();
- wrc.Add(obj1);
-
- foreach (object obj in list)
- {
- wrc.Add(obj);
- }
-
- var obj2 = new object();
- wrc.Add(obj2);
-
- Assert.AreEqual(list.Length + 2, wrc.AliveItemsToList().Count, "Should have same number of items!");
-
- obj1 = obj2 = null;
-
- GC.Collect();
- GC.WaitForPendingFinalizers();
-
- var aliveItems = wrc.AliveItemsToList();
- Assert.AreEqual(list.Length, aliveItems.Count, "Should have 2 less items!");
-
- Assert.AreEqual(list[0], aliveItems[0]);
- Assert.AreEqual(list[1], aliveItems[1]);
- Assert.AreEqual(list[2], aliveItems[2]);
- }
-
- [TestMethod]
- public void AliveItemsToList_ShouldReturnEmpty()
- {
- var wrc = new WeakReferenceCollection<object>();
- Assert.AreEqual(0, wrc.AliveItemsToList().Count, "Should have 0 items!");
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/StringsTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/StringsTests.cs deleted file mode 100644 index aec6ad248fa..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/StringsTests.cs +++ /dev/null @@ -1,123 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Microsoft.Internal;
-using System.Threading;
-using System.Globalization;
-
-namespace System
-{
- [TestClass]
- public class StringsTests
- {
- [TestMethod]
- public void PropertiesAreInsyncWithResources()
- {
- var properties = GetStringProperties();
-
- Assert.IsTrue(properties.Length > 0, "Expected to find at least one string property in Strings.cs.");
-
- foreach (PropertyInfo property in properties)
- {
- object value = property.GetValue(null, (object[])null);
-
- Assert.IsNotNull(value, "Property '{0}' does not have an associated string in Strings.resx.", property.Name);
- }
- }
-
- private static PropertyInfo[] GetStringProperties()
- {
- PropertyInfo[] properties = typeof(Strings).GetProperties(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
-
- return properties.Where(property =>
- {
- return !CanIgnore(property);
-
- }).ToArray();
- }
-
- private static bool CanIgnore(PropertyInfo property)
- {
- switch (property.Name)
- {
- case "Culture":
- case "ResourceManager":
- return true;
- }
-
- return false;
- }
-
-#if !SILVERLIGHT
- [TestMethod]
- public void LocalizedResourcesArePickedUpBasedOnThreadCulture()
- {
- // verify each property against an en-US resource manager
- bool wasVerified = false;
- bool areLocalizedCLRResourcesAvailable = AreLocalizedCLRResourcesAvailable();
- foreach (var stringsPropInfo in GetStringProperties())
- {
- string referenceValue = String.Empty;
- PerformOnEnUsThread(() =>
- {
- referenceValue = (string)stringsPropInfo.GetValue(null, (object[])null);
- });
- string actualValue = (string)stringsPropInfo.GetValue(null, (object[])null);
-
- // determine if LangPacks are installed for the the CurrentUICulture. If not, default to english
- if (areLocalizedCLRResourcesAvailable)
- {
- Assert.AreNotEqual(referenceValue, actualValue, "Failed to pick up localized resources for UI culture '{0}'", Thread.CurrentThread.CurrentUICulture.Name);
- }
- else
- {
- Assert.AreEqual(referenceValue, actualValue);
- }
-
- wasVerified = true;
- }
-
- Assert.IsTrue(wasVerified);
- }
-
-
- private bool AreLocalizedCLRResourcesAvailable()
- {
- if (Thread.CurrentThread.CurrentUICulture.LCID == 1033) // en-US
- {
- return false;
- }
-
- object regValue = Microsoft.Win32.Registry.GetValue(
- GetRegPath(),
- "Install",
- 0);
-
- return (regValue != null) && ((int)regValue == 1);
- }
-
- private string GetRegPath()
- {
- var path = String.Format(
- @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v{0}\Client\{1}",
- typeof(string).Assembly.GetName().Version.Major,
- Thread.CurrentThread.CurrentUICulture.LCID);
-
- return path;
- }
-
- private static void PerformOnEnUsThread(Action action)
- {
- Thread enUsThread = new Thread(new ThreadStart(action));
- enUsThread.CurrentUICulture = new CultureInfo("en-US");
- enUsThread.Start();
- enUsThread.Join();
- }
-#endif
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/.gitattributes deleted file mode 100644 index 92b4bafc804..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -/LazyOfTTMetadataTests.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/.gitattributes deleted file mode 100644 index f8ca5608c10..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/.gitattributes +++ /dev/null @@ -1,51 +0,0 @@ -/AdvancedValueComposition.cs -crlf -/AggregateExportProviderTest.cs -crlf -/AttributedModelServicesTests.cs -crlf -/CardinalityMismatchExceptionTests.cs -crlf -/ComponentModelTestTypes.cs -crlf -/ComponentServicesTests.cs -crlf -/ComposablePartCatalogExtensions.cs -crlf -/ComposablePartDefinitionTests.cs -crlf -/ComposablePartExceptionTests.cs -crlf -/ComposablePartExtensibilityTests.cs -crlf -/ComposablePartTests.cs -crlf -/CompositionContainerCollectionTests.cs -crlf -/CompositionContainerExtensibilityTests.cs -crlf -/CompositionContainerExtensions.cs -crlf -/CompositionContainerImportTests.cs -crlf -/CompositionContainerTests.cs -crlf -/CompositionErrorDebuggerProxyTests.cs -crlf -/CompositionErrorIdTests.cs -crlf -/CompositionErrorTests.cs -crlf -/CompositionExceptionTests.cs -crlf -/CompositionResultOfTTest.cs -crlf -/CompositionResultTest.cs -crlf -/CompositionServiceExtensionsTests.cs -crlf -/CompositionServiceProxy.cs -crlf -/CompositionServicesTests.cs -crlf -/ConcreteComposablePart.cs -crlf -/ConstraintServicesTests.cs -crlf -/ContractBasedImportDefinitionTests.cs -crlf -/ContractMismatchExceptionTests.cs -crlf -/DynamicMetadata.cs -crlf -/Expectations.cs -crlf -/ExportAttributeTests.cs -crlf -/ExportCollectionTests.cs -crlf -/ExportDefinitionTests.cs -crlf -/ExportMetadataAttributeTests.cs -crlf -/ExportProviderTests.cs -crlf -/ExportTests.cs -crlf -/ExportableAttributeTests.cs -crlf -/GenerationServicesTests.cs -crlf -/ImportAttributeTests.cs -crlf -/ImportDefinitionTests.cs -crlf -/ImportingComposablePart.cs -crlf -/ImportingConstructorAttributeTests.cs -crlf -/InitializationScopeTests.cs -crlf -/MetadataAttributeAttributeTests.cs -crlf -/MetadataTests.cs -crlf -/MetadataViewProviderTests.cs -crlf -/MicroExport.cs -crlf -/PartCreationPolicyAttributeTests.cs -crlf -/PartMetadataAttributeTests.cs -crlf -/SampleComponents.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/AdvancedValueComposition.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/AdvancedValueComposition.cs deleted file mode 100644 index b46d7557508..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/AdvancedValueComposition.cs +++ /dev/null @@ -1,275 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.Linq;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.UnitTesting;
-using System.ComponentModel.Composition.AttributedModel;
-using System.UnitTesting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class AdvancedValueComposition
- {
- [TestMethod]
- public void RepeatedContainerUse()
- {
- var container = ContainerFactory.Create();
- TrivialExporter e = new TrivialExporter();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(e);
- container.Compose(batch);
-
- batch = new CompositionBatch();
- batch.AddPart(new TrivialImporter());
- container.Compose(batch);
-
- Assert.IsTrue(e.done, "Initialization of importer should have set the done flag on E");
- }
-
- [TestMethod]
- public void FunctionsFieldsAndProperties()
- {
- Consumer c;
- var container = ContainerFactory.Create();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(new RealAddProvider());
- batch.AddPart(c = new Consumer());
- container.Compose(batch);
-
- Assert.AreEqual(3, c.op(c.a, c.b), "1 + 2 == 3");
- }
- [TestMethod]
- public void FunctionsFieldsAndProperties2()
- {
- Consumer c;
- var container = ContainerFactory.Create();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(new SubtractProvider());
- batch.AddPart(c = new Consumer());
- container.Compose(batch);
-
- Assert.AreEqual(-1, c.op(c.a, c.b), "1 - 2 == -1");
- }
-
- [TestMethod]
- public void FunctionsFieldsAndProperties2_WithCatalog()
- {
- var container = ContainerFactory.CreateWithDefaultAttributedCatalog();
-
- ConsumerOfMultiple c = new ConsumerOfMultiple();
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(c);
- container.Compose(batch);
-
- foreach (var export in c.opInfo)
- {
- if ((string)export.Metadata["Var1"] == "add")
- {
- Assert.AreEqual(3, export.Value(1, 2), "1 + 2 == 3");
- }
- else if ((string)export.Metadata["Var1"] == "sub")
- {
- Assert.AreEqual(-1, export.Value(1, 2), "1 - 2 == -1");
- }
- else
- {
- Assert.Fail("Unexpected value");
- }
- }
- }
-
-#if !SILVERLIGHT
- // Silverlight doesn't support strongly typed metadata
- [TestMethod]
- public void FunctionsFieldsAndProperties2_StronglyTypedMetadata()
- {
- var container = ContainerFactory.CreateWithDefaultAttributedCatalog();
-
- var exports = container.GetExports<Func<int, int, int>, IExportableTest>("Add");
-
- foreach (var export in exports)
- {
- if (export.Metadata.Var1 == "add")
- {
- Assert.AreEqual(3, export.Value(1, 2), "1 + 2 == 3");
- }
- else if (export.Metadata.Var1 == "sub")
- {
- Assert.AreEqual(-1, export.Value(1, 2), "1 - 2 == -1");
- }
- else
- {
- Assert.Fail("Unexpected value");
- }
- }
- }
-
- [TestMethod]
- public void InAdditionToCatalogTest()
- {
- var container = ContainerFactory.CreateWithDefaultAttributedCatalog();
-
- IDictionary<string, object> multMetadata = new Dictionary<string, object>();
- multMetadata["Var1"]= "mult";
- multMetadata[CompositionConstants.ExportTypeIdentityMetadataName] = AttributedModelServices.GetTypeIdentity(typeof(Func<int, int, int>));
- var basicValue = ExportFactory.Create("Add", multMetadata, (() => (Func<int, int, int>)delegate(int a, int b) { return a * b; }));
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddExport(basicValue);
- container.Compose(batch);
-
- var exports = container.GetExports<Func<int, int, int>, IExportableTest>("Add");
-
- Assert.AreEqual(3, exports.Count(), "There should be 3 entries for 'Add'");
-
- foreach (var export in exports)
- {
- if (export.Metadata.Var1 == "mult")
- {
- Assert.AreEqual(2, export.Value(1, 2), "1 * 2 == 2");
- }
- else if (export.Metadata.Var1 == "add")
- {
- Assert.AreEqual(3, export.Value(1, 2), "1 + 2 == 3");
- }
- else if (export.Metadata.Var1 == "sub")
- {
- Assert.AreEqual(-1, export.Value(1, 2), "1 - 2 == -1");
- }
- else
- {
- Assert.Fail("Unexpected value");
- }
- }
- }
-
- [TestMethod]
- public void CollectionMetadataPropertyTest()
- {
- var container = ContainerFactory.CreateWithDefaultAttributedCatalog();
- var export = container.GetExport<ComponentWithCollectionProperty, ICollectionOfStrings>();
-
- Assert.IsNotNull(export.Metadata, "Should have metadata");
- Assert.IsNotNull(export.Metadata.Values, "MetadataView should have collection of values");
- Assert.AreEqual(export.Metadata.Values.Count(), 3, "Should have 3 elements");
- Assert.AreEqual(export.Metadata.Values.First(), "One", "First should be 'One'");
- Assert.AreEqual(export.Metadata.Values.Skip(1).First(), "two", "First should be 'two'");
- Assert.AreEqual(export.Metadata.Values.Skip(2).First(), "3", "First should be '3'");
- }
-#endif //!SIVLERLIGHT
-
- [TestMethod]
- public void ImportExportSansNameTest()
- {
- var container = ContainerFactory.CreateWithDefaultAttributedCatalog();
-
- UnnamedImportAndExport unnamed = container.GetExportedValue<UnnamedImportAndExport>();
- Assert.IsNotNull(unnamed, "Should have found UnnamedImportAndExport component");
- Assert.IsNotNull(unnamed.ImportedValue, "Component's unnamed import should have been fulfilled");
- }
-
- [TestMethod]
- public void MultipleInstantiationOfStaticCatalogItem()
- {
- var container = ContainerFactory.CreateWithDefaultAttributedCatalog();
- var unnamedVI = container.GetExport<StaticExport, object>();
-
- StaticExport first = unnamedVI.Value;
- StaticExport second = unnamedVI.Value;
-
- Assert.IsNotNull(first, "Should have created an instance");
- Assert.IsNotNull(second, "Should have created a second instance");
- Assert.IsTrue(object.ReferenceEquals(first, second), "Instances should be the same");
-
- var exports = container.GetExports<StaticExport, object>();
-
- Assert.AreEqual(1, exports.Count(), "There should still only be one exported value");
- }
-
- [TestMethod]
- public void MultipleInstantiationOfNonStaticCatalogItem()
- {
- var container = ContainerFactory.CreateWithDefaultAttributedCatalog();
- var export1 = container.GetExport<NonStaticExport, object>();
- var export2 = container.GetExport<NonStaticExport, object>();
-
- NonStaticExport first = export1.Value;
- NonStaticExport second = export2.Value;
-
- Assert.IsNotNull(first, "Should have created an instance");
- Assert.IsNotNull(second, "Should have created a second instance");
- Assert.IsFalse(object.ReferenceEquals(first, second), "Instances should be different");
- }
-
- [TestMethod]
- public void ImportIntoUntypedExportTest()
- {
- var container = ContainerFactory.Create();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddExportedValue("untyped", 42);
-
- var u = new UntypedExportImporter();
- var rb = AttributedModelServices.CreatePart(u);
-
- batch.AddPart(rb);
- container.Compose(batch);
-
- Assert.AreEqual(42, u.Export.Value);
-
- var us = new UntypedExportsImporter();
- batch = new CompositionBatch();
- batch.AddExportedValue("untyped", 19);
- batch.RemovePart(rb);
- batch.AddPart(us);
- container.Compose(batch);
-
- Assert.IsNotNull(us.Exports, "Should have an enumeration");
- Assert.AreEqual(2, us.Exports.Count(), "Should have 2 values");
- }
-
- [TestMethod]
- public void ImportIntoDerivationOfExportException()
- {
- var container = ContainerFactory.Create();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddExportedValue("derived", typeof(DerivedExport), 42);
- var d = new DerivedExportImporter();
- batch.AddPart(d);
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotSetImport,
- ErrorId.ReflectionModel_ImportNotAssignableFromExport, RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
-
- [TestMethod]
- public void ImportIntoDerivationOfExportsException()
- {
- var container = ContainerFactory.Create();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddExportedValue("derived", typeof(DerivedExport), 42);
- var d = new DerivedExportsImporter();
- batch.AddPart(d);
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotSetImport,
- ErrorId.ReflectionModel_ImportNotAssignableFromExport, RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/AggregateExportProviderTest.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/AggregateExportProviderTest.cs deleted file mode 100644 index 464e82ac8dc..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/AggregateExportProviderTest.cs +++ /dev/null @@ -1,100 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Primitives;
-using System.IO;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Threading;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Hosting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class AggregateExportProviderTests
- {
- [TestMethod]
- public void Constructor1_NullAsProvidersArgument_ShouldSetProvidersPropertyToEmpty()
- {
- var provider = new AggregateExportProvider((ExportProvider[])null);
-
- EnumerableAssert.IsEmpty(provider.Providers);
- }
-
- [TestMethod]
- public void Constructor2_NullAsProvidersArgument_ShouldSetProvidersPropertyToEmpty()
- {
- var provider = new AggregateExportProvider((IEnumerable<ExportProvider>)null);
-
- EnumerableAssert.IsEmpty(provider.Providers);
- }
-
- [TestMethod]
- public void Constructor1_EmptyArrayAsProvidersArgument_ShouldSetProvidersPropertyToEmpty()
- {
- var provider = new AggregateExportProvider(new ExportProvider[0]);
-
- EnumerableAssert.IsEmpty(provider.Providers);
- }
-
- [TestMethod]
- public void Constructor2_EmptyArrayAsProvidersArgument_ShouldSetProvidersPropertyToEmpty()
- {
- var provider = new AggregateExportProvider((IEnumerable<ExportProvider>)new ExportProvider[0]);
-
- EnumerableAssert.IsEmpty(provider.Providers);
- }
-
- [TestMethod]
- public void Constructor2_EmptyEnumerableAsProvidersArgument_ShouldSetProvidersPropertyToEmpty()
- {
- var provider = new AggregateExportProvider(Enumerable.Empty<ExportProvider>());
-
- EnumerableAssert.IsEmpty(provider.Providers);
- }
-
- [TestMethod]
- public void Constructor1_ArrayAsProvidersArgument_ShouldNotAllowModificationAfterConstruction()
- {
- var providers = new ExportProvider[] { ExportProviderFactory.Create() };
- var provider = new AggregateExportProvider(providers);
-
- providers[0] = null;
-
- Assert.IsNotNull(provider.Providers[0]);
- }
-
- [TestMethod]
- public void Constructor2_ArrayAsProvidersArgument_ShouldNotAllowModificationAfterConstruction()
- {
- var providers = new ExportProvider[] { ExportProviderFactory.Create() };
- var provider = new AggregateExportProvider((IEnumerable<ExportProvider>)providers);
-
- providers[0] = null;
-
- Assert.IsNotNull(provider.Providers[0]);
- }
-
- [TestMethod]
- public void Providers_WhenDisposed_ShouldThrowObjectDisposed()
- {
- var provider = CreateAggregateExportProvider();
- provider.Dispose();
-
- ExceptionAssert.ThrowsDisposed(provider, () =>
- {
- var providers = provider.Providers;
- });
- }
-
- private AggregateExportProvider CreateAggregateExportProvider()
- {
- return new AggregateExportProvider(Enumerable.Empty<ExportProvider>());
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/AttributedModel/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/AttributedModel/.gitattributes deleted file mode 100644 index 3e0ba3aed3f..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/AttributedModel/.gitattributes +++ /dev/null @@ -1,4 +0,0 @@ -/AllowNonPublicCompositionTests.cs -crlf -/AttributedModelCompositionTests.cs -crlf -/AttributedModelDiscoveryTests.cs -crlf -/INotifyImportTests.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/AttributedModel/AllowNonPublicCompositionTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/AttributedModel/AllowNonPublicCompositionTests.cs deleted file mode 100644 index 0771d89264a..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/AttributedModel/AllowNonPublicCompositionTests.cs +++ /dev/null @@ -1,288 +0,0 @@ -#if !SILVERLIGHT
-
-// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.UnitTesting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class AllowNonPublicCompositionTests
- {
- [TestMethod]
- public void PublicFromPublic()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
- var importer = new AllPublicImportOnly();
- batch.AddPart(importer);
- batch.AddPart(new AllPublicExportOnly() { ExportA = 5, ExportB = 10 });
- container.Compose(batch);
-
- Assert.AreEqual(5, importer.ImportA);
- Assert.AreEqual(10, importer.ImportB);
- }
- [TestMethod]
- public void PublicToSelf()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
- var importer = new AllPublic() { ExportA = 5, ExportB = 10 };
- batch.AddPart(importer);
- container.Compose(batch);
-
- Assert.AreEqual(5, importer.ImportA);
- Assert.AreEqual(10, importer.ImportB);
- }
- [TestMethod]
- public void PublicFromPrivate()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
- var importer = new AllPublicImportOnly();
- batch.AddPart(importer);
- batch.AddPart(new AllPrivateExportOnly(5, 10));
- container.Compose(batch);
-
- Assert.AreEqual(5, importer.ImportA);
- Assert.AreEqual(10, importer.ImportB);
- }
- [TestMethod]
- public void PrivateFromPublic()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
- var importer = new AllPrivateImportOnly();
- batch.AddPart(importer);
- batch.AddPart(new AllPublicExportOnly() { ExportA = 5, ExportB = 10 });
- container.Compose(batch);
-
- Assert.AreEqual(5, importer.PublicImportA);
- Assert.AreEqual(10, importer.PublicImportB);
- }
- [TestMethod]
- public void PrivateToSelf()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
- var importer = new AllPrivate(5, 10);
- batch.AddPart(importer);
- container.Compose(batch);
-
- Assert.AreEqual(5, importer.PublicImportA);
- Assert.AreEqual(10, importer.PublicImportB);
- }
- [TestMethod]
- public void PrivateData()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
- var importer = new PrivateDataImportExport(5);
- batch.AddPart(importer);
- container.Compose(batch);
-
- Assert.AreEqual(5, importer.X);
- }
- [TestMethod]
- public void TestPublicImportsExpectingPublicExportsFromCatalog()
- {
- var cat = CatalogFactory.CreateDefaultAttributed();
- var container = new CompositionContainer(cat);
- container.GetExportedValue<PublicImportsExpectingPublicExports>().VerifyIsBound();
- }
- [TestMethod]
- public void TestInternalImportsExpectingPublicExportsFromCatalog()
- {
- var cat = CatalogFactory.CreateDefaultAttributed();
- var container = new CompositionContainer(cat);
- container.GetExportedValue<InternalImportsExpectingPublicExports>().VerifyIsBound();
- }
- [TestMethod]
- public void TestPublicImportsExpectingInternalExportsFromCatalog()
- {
- var cat = CatalogFactory.CreateDefaultAttributed();
- var container = new CompositionContainer(cat);
- container.GetExportedValue<PublicImportsExpectingInternalExports>().VerifyIsBound();
- }
- [TestMethod]
- public void TestInternalImportsExpectingInternalExportsFromCatalog()
- {
- var cat = CatalogFactory.CreateDefaultAttributed();
- var container = new CompositionContainer(cat);
- container.GetExportedValue<InternalImportsExpectingInternalExports>().VerifyIsBound();
- }
- [TestMethod]
- public void TestPublicImportsExpectingProtectedExportsFromCatalog()
- {
- var cat = CatalogFactory.CreateDefaultAttributed();
- var container = new CompositionContainer(cat);
- container.GetExportedValue<PublicImportsExpectingProtectedExports>().VerifyIsBound();
- }
- [TestMethod]
- public void TestInternalImportsExpectingProtectedExportsFromCatalog()
- {
- var cat = CatalogFactory.CreateDefaultAttributed();
- var container = new CompositionContainer(cat);
- container.GetExportedValue<InternalImportsExpectingProtectedExports>().VerifyIsBound();
- }
- [TestMethod]
- public void TestPublicImportsExpectingProtectedInternalExportsFromCatalog()
- {
- var cat = CatalogFactory.CreateDefaultAttributed();
- var container = new CompositionContainer(cat);
- container.GetExportedValue<PublicImportsExpectingProtectedInternalExports>().VerifyIsBound();
- }
- [TestMethod]
- public void TestInternalImportsExpectingProtectedInternalExportsFromCatalog()
- {
- var cat = CatalogFactory.CreateDefaultAttributed();
- var container = new CompositionContainer(cat);
- container.GetExportedValue<InternalImportsExpectingProtectedInternalExports>().VerifyIsBound();
- }
- [TestMethod]
- public void TestPublicImportsExpectingPrivateExportsFromCatalog()
- {
- var cat = CatalogFactory.CreateDefaultAttributed();
- var container = new CompositionContainer(cat);
- container.GetExportedValue<PublicImportsExpectingPrivateExports>().VerifyIsBound();
- }
- [TestMethod]
- public void TestInternalImportsExpectingPrivateExportsFromCatalog()
- {
- var cat = CatalogFactory.CreateDefaultAttributed();
- var container = new CompositionContainer(cat);
- container.GetExportedValue<InternalImportsExpectingPrivateExports>().VerifyIsBound();
- }
- }
-
- public interface IData { int X { get; set; } }
-
- public class PrivateDataImportExportWithContract
- {
- public PrivateDataImportExportWithContract(int x)
- {
- Out = new PrivateDataType() { X = x };
- }
- public int X { get { return In.X; } }
- [Export("a")]
- PrivateDataType Out { get; set; }
- [Import("a")]
- IData In { get; set; }
- }
-
- public class PrivateDataImportExport
- {
- public PrivateDataImportExport(int x)
- {
- Out = new PrivateDataType() { X = x };
- }
- public int X { get { return In.X; } }
- [Export]
- PrivateDataType Out { get; set; }
- [Import]
- PrivateDataType In { get; set; }
- }
-
- class PrivateDataType
- {
- public int X { get; set; }
- }
-
- public class AllPrivateNoAttribute
- {
- public AllPrivateNoAttribute(int exportA, int exportB) { ExportA = exportA; ExportB = exportB; }
-
- public int PublicImportA { get { return ImportA; } }
- public int PublicImportB { get { return ImportB; } }
-
- [Import("a")]
- int ImportA { get; set; }
- [Import("b")]
- int ImportB { get; set; }
- [Export("a")]
- int ExportA { get; set; }
- [Export("b")]
- int ExportB { get; set; }
- }
- public class AllPrivateNoAttributeImportOnly
- {
- public int PublicImportA { get { return ImportA; } }
- public int PublicImportB { get { return ImportB; } }
-
- [Import("a")]
- int ImportA { get; set; }
- [Import("b")]
- int ImportB { get; set; }
- }
-
- public class AllPrivate
- {
- public AllPrivate(int exportA, int exportB) { ExportA = exportA; ExportB = exportB; }
-
- public int PublicImportA { get { return ImportA; } }
- public int PublicImportB { get { return ImportB; } }
-
- [Import("a")]
- int ImportA { get; set; }
- [Import("b")]
- int ImportB { get; set; }
- [Export("a")]
- int ExportA { get; set; }
- [Export("b")]
- int ExportB { get; set; }
- }
-
- public class AllPrivateImportOnly
- {
- public int PublicImportA { get { return ImportA; } }
- public int PublicImportB { get { return ImportB; } }
-
- [Import("a")]
- int ImportA { get; set; }
- [Import("b")]
- int ImportB { get; set; }
- }
-
- public class AllPrivateExportOnly
- {
- public AllPrivateExportOnly(int exportA, int exportB) { ExportA = exportA; ExportB = exportB; }
-
- [Export("a")]
- int ExportA { get; set; }
- [Export("b")]
- int ExportB { get; set; }
- }
-
- public class AllPublic
- {
- [Import("a")]
- public int ImportA { get; set; }
- [Import("b")]
- public int ImportB { get; set; }
- [Export("a")]
- public int ExportA { get; set; }
- [Export("b")]
- public int ExportB { get; set; }
- }
- public class AllPublicImportOnly
- {
- [Import("a")]
- public int ImportA { get; set; }
- [Import("b")]
- public int ImportB { get; set; }
- }
- public class AllPublicExportOnly
- {
- [Export("a")]
- public int ExportA { get; set; }
- [Export("b")]
- public int ExportB { get; set; }
- }
-}
-
-#endif
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/AttributedModel/AttributedModelCompositionTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/AttributedModel/AttributedModelCompositionTests.cs deleted file mode 100644 index 4a6adca7781..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/AttributedModel/AttributedModelCompositionTests.cs +++ /dev/null @@ -1,465 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Linq;
-using System.ComponentModel.Composition.Factories;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.UnitTesting;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.UnitTesting;
-
-namespace System.ComponentModel.Composition.AttributedModel
-{
- [TestClass]
- public class AttributedModelCompositionTests
- {
- [TestMethod]
- public void PartContainingOnlyStaticExports_ShouldNotCauseInstanceToBeCreated()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(HasOnlyStaticExports));
-
- Assert.AreEqual("Field", container.GetExportedValue<string>("Field"));
- Assert.AreEqual("Property", container.GetExportedValue<string>("Property"));
- Assert.IsNotNull("Method", container.GetExportedValue<Func<string>>("Method")());
-
- Assert.IsFalse(HasOnlyStaticExports.InstanceCreated);
- }
-
- [TestMethod]
- public void ExportOnAbstractBase_DoesNotReturnNull()
- { // 499393 - Classes inheriting from an exported
- // abstract class are exported as 'null'
-
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
-
- var definition = PartDefinitionFactory.CreateAttributed(typeof(Derived));
- batch.AddPart(definition.CreatePart());
- container.Compose(batch);
-
- Assert.IsNotNull(container.GetExportedValueOrDefault<Base>());
- }
-
- [TestMethod]
- public void ReadOnlyFieldImport_ShouldThrowComposition()
- {
- var importer = PartFactory.CreateAttributed(new ReadOnlyPropertyImport());
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- batch.AddExportedValue("readonly", "new value");
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotActivate,
- ErrorId.ReflectionModel_ImportNotWritable,
- RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
-
- [TestMethod]
- public void ReadOnlyPropertyImport_ShouldThrowComposition()
- {
- var importer = PartFactory.CreateAttributed(new ReadOnlyPropertyImport());
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- batch.AddExportedValue("readonly", "new value");
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotActivate,
- ErrorId.ReflectionModel_ImportNotWritable, RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
-
- [TestMethod]
- public void WriteOnlyPropertyExport_ShouldThrowComposition()
- {
- var importer = PartFactory.CreateAttributed(new WriteOnlyPropertyExport());
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- container.Compose(batch);
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotGetExportedValue, ErrorId.ReflectionModel_ExportNotReadable, () =>
- {
- container.GetExportedValue<string>("writeonly");
- });
- }
-
- [TestMethod]
- public void ImportValueMismatchFromInt32ToDateTime()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(new ImportValueTypes());
- batch.AddExportedValue("DateTime", typeof(DateTime), 42);
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotSetImport,
- ErrorId.ReflectionModel_ImportNotAssignableFromExport,
- RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
-
- [TestMethod]
- public void ImportValueMismatchFromInt16ToInt32()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
-
- batch.AddPart(new ImportValueTypes());
- batch.AddExportedValue("Int32", typeof(Int32), (short)10);
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotSetImport,
- ErrorId.ReflectionModel_ImportNotAssignableFromExport,
- RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
-
- }
-
- [TestMethod]
- public void ImportValueMismatchFromInt32ToInt16()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
-
- batch.AddPart(new ImportValueTypes());
- batch.AddExportedValue("Int16", typeof(Int16), (int)10);
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotSetImport,
- ErrorId.ReflectionModel_ImportNotAssignableFromExport,
- RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
-
- [TestMethod]
- public void ImportValueMismatchFromInt32ToUInt32()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
-
- batch.AddPart(new ImportValueTypes());
- batch.AddExportedValue("UInt32", typeof(UInt32), (int)10);
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotSetImport,
- ErrorId.ReflectionModel_ImportNotAssignableFromExport,
- RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
-
- [TestMethod]
- public void ImportValueMismatchFromUInt32ToInt32()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
-
- batch.AddPart(new ImportValueTypes());
- batch.AddExportedValue("Int32", typeof(Int32), (uint)10);
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotSetImport,
- ErrorId.ReflectionModel_ImportNotAssignableFromExport,
- RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
-
- [TestMethod]
- public void ImportValueMismatchFromInt32ToInt64()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
-
- batch.AddPart(new ImportValueTypes());
- batch.AddExportedValue("Int64", typeof(Int64), (int)10);
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotSetImport,
- ErrorId.ReflectionModel_ImportNotAssignableFromExport,
- RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
-
- [TestMethod]
- public void ImportValueMismatchFromSingleToDouble()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
-
- batch.AddPart(new ImportValueTypes());
- batch.AddExportedValue("Double", typeof(Double), (float)10);
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotSetImport,
- ErrorId.ReflectionModel_ImportNotAssignableFromExport,
- RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
-
- [TestMethod]
- public void ImportValueMismatchFromDoubleToSingle()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
-
- batch.AddPart(new ImportValueTypes());
- batch.AddExportedValue("Single", typeof(Single), (double)10);
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotSetImport,
- ErrorId.ReflectionModel_ImportNotAssignableFromExport,
- RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
-
- [TestMethod]
- public void ImportValueMismatchFromSingleToInt32()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
-
- batch.AddPart(new ImportValueTypes());
- batch.AddExportedValue("Int32", typeof(Int32), (float)10);
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotSetImport,
- ErrorId.ReflectionModel_ImportNotAssignableFromExport,
- RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
-
- [TestMethod]
- public void ImportValueMismatchFromInt32ToSingle()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
-
- batch.AddPart(new ImportValueTypes());
- batch.AddExportedValue("Single", typeof(Single), (int)10);
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotSetImport,
- ErrorId.ReflectionModel_ImportNotAssignableFromExport,
- RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
-
- [TestMethod]
- public void MemberExports()
- {
- var exporter = PartFactory.CreateAttributed(new ObjectWithMemberExports());
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(exporter);
- container.Compose(batch);
-
- var filedExports = container.GetExports<int>("field");
- ExportsAssert.AreEqual(filedExports, 1, 5);
-
- var readonlyExports = container.GetExports<int>("readonly");
- ExportsAssert.AreEqual(readonlyExports, 2, 6);
-
- var propertyExports = container.GetExports<int>("property");
- ExportsAssert.AreEqual(propertyExports, 3, 7);
-
- var methodExports = container.GetExportedValues<Func<int, int>>("func").Select(f => f(0));
- EnumerableAssert.AreEqual(methodExports, 4, 8);
- }
-
- [TestMethod]
- public void TestExportedValueCachesValue()
- {
- var container = ContainerFactory.Create();
- var exporter = new ExportsMutableProperty();
- exporter.Property = "Value1";
-
- container.ComposeParts(exporter);
-
- Assert.AreEqual("Value1", container.GetExportedValue<string>("Property"));
-
- exporter.Property = "Value2";
-
- // Exported value should have been cached and so it shouldn't change
- Assert.AreEqual("Value1", container.GetExportedValue<string>("Property"));
- }
-
- [TestMethod]
- [WorkItem(739354)]
- [Ignore]
- public void TestExportedValueCachesNullValue()
- {
- var container = ContainerFactory.Create();
- var exporter = new ExportsMutableProperty();
- exporter.Property = null;
-
- container.ComposeParts(exporter);
-
- Assert.IsNull(container.GetExportedValue<string>("Property"));
-
- exporter.Property = "Value1";
-
- // Exported value should have been cached and so it shouldn't change
- Assert.IsNull(container.GetExportedValue<string>("Property"));
- }
-
- public class ExportsMutableProperty
- {
- [Export("Property")]
- public string Property { get; set; }
- }
-
- public class ReadOnlyFieldImport
- {
- [Import("readonly")]
- public readonly string Value = "Value";
- }
-
- public class ReadOnlyPropertyImport
- {
- [Import("readonly")]
- public string Value
- {
- get { return "Value"; }
- }
- }
-
- public class WriteOnlyPropertyExport
- {
- [Export("writeonly")]
- public string Value
- {
- set { }
- }
- }
-
- public class ObjectWithMemberExports
- {
- [Export("field")]
- public static int staticField = 1;
-
- [Export("readonly")]
- public static readonly int staticReadonly = 2;
-
- [Export("property")]
- public static int StaticProperty { get { return 3; } }
-
- [Export("func")]
- public static int StaticMethod(int arg1) { return 4; }
-
- [Export("field")]
- public int instanceField = 5;
-
- [Export("readonly")]
- public readonly int instanceReadonly = 6;
-
- [Export("property")]
- public int InstanceProperty { get { return 7; } }
-
- [Export("func")]
- public int InstanceMethod(int arg1) { return 8; }
- }
-
- public class HasOnlyStaticExports
- {
- public static bool InstanceCreated;
-
- public HasOnlyStaticExports()
- {
- InstanceCreated = true;
- }
-
- [Export("Field")]
- public static string Field = "Field";
-
- [Export("Property")]
- public static string Property
- {
- get { return "Property"; }
- }
-
- [Export("Method")]
- public static string Method()
- {
- return "Method";
- }
- }
-
- [InheritedExport(typeof(Base))]
- public abstract class Base
- {
- }
-
- [Export(typeof(Derived))]
- public class Derived : Base
- {
- }
-
- public class ImportValueTypes
- {
- [Import("Int16", AllowDefault = true)]
- public short Int16
- {
- get;
- set;
- }
-
- [Import("Int32", AllowDefault = true)]
- public int Int32
- {
- get;
- set;
- }
-
- [Import("UInt32", AllowDefault = true)]
- [CLSCompliant(false)]
- public uint UInt32
- {
- get;
- set;
- }
-
- [Import("Int64", AllowDefault = true)]
- public long Int64
- {
- get;
- set;
- }
-
- [Import("Single", AllowDefault = true)]
- public float Single
- {
- get;
- set;
- }
-
- [Import("Double", AllowDefault = true)]
- public double Double
- {
- get;
- set;
- }
-
- [Import("DateTime", AllowDefault = true)]
- public DateTime DateTime
- {
- get;
- set;
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/AttributedModel/AttributedModelDiscoveryTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/AttributedModel/AttributedModelDiscoveryTests.cs deleted file mode 100644 index 15a214662b2..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/AttributedModel/AttributedModelDiscoveryTests.cs +++ /dev/null @@ -1,345 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.ReflectionModel;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.UnitTesting;
-using System.Linq;
-using System.Reflection;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition.AttributedModel
-{
- [TestClass]
- public class AttributedModelDiscoveryTests
- {
- [TestMethod]
- public void CreatePartDefinition_TypeWithExports_ShouldHaveMultipleExports()
- {
- var definition = CreateDefinition(typeof(PublicComponentWithPublicExports));
- EnumerableAssert.AreEqual(definition.ExportDefinitions.Select(e => e.ContractName), "PublicField", "PublicProperty", "PublicDelegate");
- }
-
- public abstract class BaseClassWithPropertyExports
- {
- [Export("MyPropBase")]
- public virtual int MyProp { get; set; }
- }
-
- public class DerivedClassWithInheritedPropertyExports : BaseClassWithPropertyExports
- {
- public override int MyProp { get; set; }
- }
-
- [WorkItem(551341)]
- [TestMethod]
- public void ShowIssueWithVirtualPropertiesInReflectionAPI()
- {
- PropertyInfo propInfo = typeof(BaseClassWithPropertyExports).GetProperty("MyProp");
-
- // pi.GetCustomAttributes does not find the inherited attributes
- var c1 = propInfo.GetCustomAttributes(true);
-
- // Attribute.GetCustomAttributes does find the inherited attributes
- var c2 = Attribute.GetCustomAttributes(propInfo, true);
-
- // This seems like it should be a bug in the reflection API's...
- Assert.AreNotEqual(c1, c2);
- }
-
- [TestMethod]
- public void CreatePartDefinition_TypeWithImports_ShouldHaveMultipleImports()
- {
- var definition = CreateDefinition(typeof(PublicImportsExpectingPublicExports));
- EnumerableAssert.AreEqual(definition.ImportDefinitions.Cast<ContractBasedImportDefinition>()
- .Select(i => i.ContractName), "PublicField", "PublicProperty", "PublicDelegate", "PublicIGetString");
- }
-
- public class AnyImplicitExport
- {
-
- }
-
- [TestMethod]
- public void CreatePartDefinition_AnyType_ShouldHaveMetadataWithAnyImplicitCreationPolicy()
- {
- var definition = CreateDefinition(typeof(AnyImplicitExport));
-
- Assert.AreEqual(CreationPolicy.Any, definition.Metadata.GetValue<CreationPolicy>(CompositionConstants.PartCreationPolicyMetadataName));
- }
-
- [PartCreationPolicy(CreationPolicy.Any)]
- public class AnyExport
- {
-
- }
-
- [TestMethod]
- public void CreatePartDefinition_AnyType_ShouldHaveMetadataWithAnyCreationPolicy()
- {
- var definition = CreateDefinition(typeof(AnyExport));
-
- Assert.AreEqual(CreationPolicy.Any, definition.Metadata.GetValue<CreationPolicy>(CompositionConstants.PartCreationPolicyMetadataName));
- }
-
-
- [PartCreationPolicy(CreationPolicy.Shared)]
- public class SharedExport
- {
-
- }
-
- [TestMethod]
- public void CreatePartDefinition_SharedType_ShouldHaveMetadataWithSharedCreationPolicy()
- {
- var definition = CreateDefinition(typeof(SharedExport));
-
- Assert.AreEqual(CreationPolicy.Shared, definition.Metadata.GetValue<CreationPolicy>(CompositionConstants.PartCreationPolicyMetadataName));
- }
-
- [PartCreationPolicy(CreationPolicy.NonShared)]
- public class NonSharedExport
- {
-
- }
-
- [TestMethod]
- public void CreatePartDefinition_NonSharedType_ShouldHaveMetadataWithNonSharedCreationPolicy()
- {
- var definition = CreateDefinition(typeof(NonSharedExport));
-
- Assert.AreEqual(CreationPolicy.NonShared, definition.Metadata.GetValue<CreationPolicy>(CompositionConstants.PartCreationPolicyMetadataName));
- }
-
- [PartMetadata(CompositionConstants.PartCreationPolicyMetadataName, CreationPolicy.NonShared)]
- [PartMetadata("ShouldNotBeIgnored", "Value")]
- public class PartWithIgnoredMetadata
- {
- }
-
- [TestMethod]
- public void CreatePartDefinition_SharedTypeMarkedWithNonSharedMetadata_ShouldHaveMetadatWithSharedCreationPolicy()
- {
- // Type should just contain all the default settings of Shared
- var definition = CreateDefinition(typeof(PartWithIgnoredMetadata));
-
- // CompositionConstants.PartCreationPolicyMetadataName should be ignored
- Assert.AreNotEqual(CreationPolicy.NonShared, definition.Metadata.GetValue<CreationPolicy>(CompositionConstants.PartCreationPolicyMetadataName));
-
- // Key ShouldNotBeIgnored should actully be in the dictionary
- Assert.AreEqual("Value", definition.Metadata["ShouldNotBeIgnored"]);
- }
-
- [PartMetadata("BaseOnlyName", 1)]
- [PartMetadata("OverrideName", 2)]
- public class BasePartWithMetdata
- {
-
- }
-
- [PartMetadata("DerivedOnlyName", 3)]
- [PartMetadata("OverrideName", 4)]
- public class DerivedPartWithMetadata : BasePartWithMetdata
- {
-
- }
-
- [TestMethod]
- public void CreatePartDefinition_InheritedPartMetadata_ShouldNotContainPartMetadataFromBase()
- {
- var definition = CreateDefinition(typeof(DerivedPartWithMetadata));
-
- Assert.IsFalse(definition.Metadata.ContainsKey("BaseOnlyName"), "Should not inherit part metadata from base.");
- Assert.AreEqual(3, definition.Metadata["DerivedOnlyName"]);
- Assert.AreEqual(4, definition.Metadata["OverrideName"]);
- }
-
- [TestMethod]
- public void CreatePartDefinition_NoMarkedOrDefaultConstructorAsPartTypeArgument_ShouldSetConstructorToNull()
- {
- var definition = CreateDefinition(typeof(ClassWithNoMarkedOrDefaultConstructor));
-
- Assert.IsNull(definition.GetConstructor());
- }
-
- [TestMethod]
- public void CreatePartDefinition_MultipleMarkedConstructorsAsPartTypeArgument_ShouldSetConstructors()
- {
- var definition = CreateDefinition(typeof(ClassWithMultipleMarkedConstructors));
-
- Assert.IsNull(definition.GetConstructor());
- }
-
- [TestMethod]
- public void CreatePartDefinition_OneMarkedConstructorsAsPartTypeArgument_ShouldSetConstructorToMarked()
- {
- var definition = CreateDefinition(typeof(SimpleConstructorInjectedObject));
-
- ConstructorInfo constructor = definition.GetConstructor();
- Assert.IsNotNull(constructor);
- Assert.AreEqual(typeof(SimpleConstructorInjectedObject).GetConstructors()[0], constructor);
- Assert.AreEqual(constructor.GetParameters().Length, definition.ImportDefinitions.OfType<ReflectionParameterImportDefinition>().Count());
- }
-
- [TestMethod]
- public void CreatePartDefinition_OneDefaultConstructorAsPartTypeArgument_ShouldSetConstructorToDefault()
- {
- var definition = CreateDefinition(typeof(PublicComponentWithPublicExports));
-
- ConstructorInfo constructor = definition.GetConstructor();
- Assert.IsNotNull(constructor);
-
- EnumerableAssert.IsEmpty(constructor.GetParameters());
- EnumerableAssert.IsEmpty(definition.ImportDefinitions.OfType<ReflectionParameterImportDefinition>());
- }
-
- [TestMethod]
- public void CreatePartDefinition_OneMarkedAndOneDefaultConstructorsAsPartTypeArgument_ShouldSetConstructorToMarked()
- {
- var definition = CreateDefinition(typeof(ClassWithOneMarkedAndOneDefaultConstructor));
- var marked = typeof(ClassWithOneMarkedAndOneDefaultConstructor).GetConstructors()[0];
- Assert.IsTrue(marked.IsDefined(typeof(ImportingConstructorAttribute), false));
-
- ConstructorInfo constructor = definition.GetConstructor();
- Assert.IsNotNull(constructor);
-
- Assert.AreEqual(marked, constructor);
- Assert.AreEqual(marked.GetParameters().Length, definition.ImportDefinitions.OfType<ReflectionParameterImportDefinition>().Count());
- }
-
- [TestMethod]
- public void CreatePartDefinition_NoConstructorBecauseStatic_ShouldHaveNullConstructor()
- {
- var definition = CreateDefinition(typeof(StaticExportClass));
-
- ConstructorInfo constructor = definition.GetConstructor();
- Assert.IsNull(constructor);
-
- EnumerableAssert.IsEmpty(definition.ImportDefinitions.OfType<ReflectionParameterImportDefinition>());
- }
-
- [TestMethod]
- public void CreatePartDefinition_TwoZeroParameterConstructors_ShouldPickNonStaticOne()
- {
- var definition = CreateDefinition(typeof(ClassWithTwoZeroParameterConstructors));
-
- ConstructorInfo constructor = definition.GetConstructor();
- Assert.IsNotNull(constructor);
- Assert.IsFalse(constructor.IsStatic);
-
- EnumerableAssert.IsEmpty(definition.ImportDefinitions.OfType<ReflectionParameterImportDefinition>());
- }
-
- [TestMethod]
- public void IsDiscoverable()
- {
- var expectations = new ExpectationCollection<Type, bool>();
- expectations.Add(typeof(ClassWithTwoZeroParameterConstructors), true);
- expectations.Add(typeof(SimpleConstructorInjectedObject), true);
- expectations.Add(typeof(StaticExportClass), true);
- expectations.Add(typeof(PublicComponentWithPublicExports), true);
- expectations.Add(typeof(ClassWithMultipleMarkedConstructors), true);
- expectations.Add(typeof(ClassWithNoMarkedOrDefaultConstructor), true);
- expectations.Add(typeof(ClassWhichOnlyHasDefaultConstructor), false);
- expectations.Add(typeof(ClassWithOnlyHasImportingConstructorButInherits), true);
- expectations.Add(typeof(ClassWithOnlyHasMultipleImportingConstructorButInherits), true);
-
- foreach (var e in expectations)
- {
- var definition = AttributedModelDiscovery.CreatePartDefinitionIfDiscoverable(e.Input, (ICompositionElement)null);
-
- bool result = (definition != null);
-
- Assert.AreEqual(e.Output, result);
- }
- }
-
- [TestMethod]
- public void CreatePartDefinition_EnsureIsDiscoverable()
- {
- var expectations = new ExpectationCollection<Type, bool>();
- expectations.Add(typeof(ClassWithTwoZeroParameterConstructors), true);
- expectations.Add(typeof(SimpleConstructorInjectedObject), true);
- expectations.Add(typeof(StaticExportClass), true);
- expectations.Add(typeof(PublicComponentWithPublicExports), true);
- expectations.Add(typeof(ClassWithMultipleMarkedConstructors), true);
- expectations.Add(typeof(ClassWithNoMarkedOrDefaultConstructor), true);
- expectations.Add(typeof(ClassWhichOnlyHasDefaultConstructor), false);
- expectations.Add(typeof(ClassWithOnlyHasImportingConstructorButInherits), true);
- expectations.Add(typeof(ClassWithOnlyHasMultipleImportingConstructorButInherits), true);
-
- foreach (var e in expectations)
- {
- var definition = AttributedModelServices.CreatePartDefinition(e.Input, null, true);
-
- bool result = (definition != null);
-
- Assert.AreEqual(e.Output, result);
- }
- }
-
- [TestMethod]
- public void CreatePartDefinition_NotEnsureIsDiscoverable()
- {
- var expectations = new ExpectationCollection<Type, bool>();
- expectations.Add(typeof(ClassWithTwoZeroParameterConstructors), true);
- expectations.Add(typeof(SimpleConstructorInjectedObject), true);
- expectations.Add(typeof(StaticExportClass), true);
- expectations.Add(typeof(PublicComponentWithPublicExports), true);
- expectations.Add(typeof(ClassWithMultipleMarkedConstructors), true);
- expectations.Add(typeof(ClassWithNoMarkedOrDefaultConstructor), true);
- expectations.Add(typeof(ClassWhichOnlyHasDefaultConstructor), false);
- expectations.Add(typeof(ClassWithOnlyHasImportingConstructorButInherits), true);
- expectations.Add(typeof(ClassWithOnlyHasMultipleImportingConstructorButInherits), true);
-
- foreach (var e in expectations)
- {
- var definition = AttributedModelServices.CreatePartDefinition(e.Input, null, false);
- Assert.IsNotNull(definition);
- }
- }
-
- [TestMethod]
- public void CreatePart_ObjectInstance_ShouldProduceSharedPart()
- {
- var part = AttributedModelServices.CreatePart(typeof(MyExport));
-
- Assert.AreEqual(CreationPolicy.Shared, part.Metadata.GetValue<CreationPolicy>(CompositionConstants.PartCreationPolicyMetadataName));
- }
-
-
- private ReflectionComposablePartDefinition CreateDefinition(Type type)
- {
- var definition = AttributedModelDiscovery.CreatePartDefinition(type, null, false, ElementFactory.Create());
-
- Assert.AreEqual(type, definition.GetPartType());
-
- return definition;
- }
-
- [InheritedExport]
- [InheritedExport]
- [InheritedExport]
- [Export]
- [InheritedExport]
- [InheritedExport]
- [InheritedExport]
- public class DuplicateMixedExporter1
- {
- }
-
- [TestMethod]
- [WorkItem(710352)]
- public void MixedDuplicateExports_ShouldOnlyCollapseInheritedExport()
- {
- var def = AttributedModelServices.CreatePartDefinition(typeof(DuplicateMixedExporter1), null);
- Assert.AreEqual(2, def.ExportDefinitions.Count(), "Should have 1 from the Export and only 1 collapsed InhertedExport");
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/AttributedModel/INotifyImportTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/AttributedModel/INotifyImportTests.cs deleted file mode 100644 index 4e08d0fece3..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/AttributedModel/INotifyImportTests.cs +++ /dev/null @@ -1,608 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition.AttributedModel
-{
- [TestClass()]
- public class INotifyImportTests
- {
- [Export(typeof(PartWithoutImports))]
- public class PartWithoutImports : IPartImportsSatisfiedNotification
- {
- public bool ImportsSatisfiedInvoked { get; private set; }
- public void OnImportsSatisfied()
- {
- this.ImportsSatisfiedInvoked = true;
- }
- }
-
- [TestMethod]
- public void ImportsSatisfiedOnComponentWithoutImports()
- {
- CompositionContainer container = ContainerFactory.CreateWithAttributedCatalog(typeof(PartWithoutImports));
-
- PartWithoutImports partWithoutImports = container.GetExportedValue<PartWithoutImports>();
- Assert.IsNotNull(partWithoutImports);
-
- Assert.IsTrue(partWithoutImports.ImportsSatisfiedInvoked);
-
- }
-
- [TestMethod()]
- public void ImportCompletedTest()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
- var entrypoint = new UpperCaseStringComponent();
-
- batch.AddParts(new LowerCaseString("abc"), entrypoint);
- container.Compose(batch);
-
- batch = new CompositionBatch();
- batch.AddParts(new object());
- container.Compose(batch);
-
- Assert.AreEqual(entrypoint.LowerCaseStrings.Count, 1);
- Assert.AreEqual(entrypoint.ImportCompletedCallCount, 1);
- Assert.AreEqual(entrypoint.UpperCaseStrings.Count, 1);
- Assert.AreEqual(entrypoint.LowerCaseStrings[0].Value.String, "abc");
- Assert.AreEqual(entrypoint.UpperCaseStrings[0], "ABC");
- }
-
- [TestMethod]
- public void ImportCompletedWithRecomposing()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
- var entrypoint = new UpperCaseStringComponent();
-
- batch.AddParts(new LowerCaseString("abc"), entrypoint);
- container.Compose(batch);
-
- Assert.AreEqual(entrypoint.LowerCaseStrings.Count, 1);
- Assert.AreEqual(entrypoint.ImportCompletedCallCount, 1);
- Assert.AreEqual(entrypoint.UpperCaseStrings.Count, 1);
- Assert.AreEqual(entrypoint.LowerCaseStrings[0].Value.String, "abc");
- Assert.AreEqual(entrypoint.UpperCaseStrings[0], "ABC");
-
- // Add another component to verify recomposing
- batch = new CompositionBatch();
- batch.AddParts(new LowerCaseString("def"));
- container.Compose(batch);
-
- Assert.AreEqual(entrypoint.LowerCaseStrings.Count, 2);
- Assert.AreEqual(entrypoint.ImportCompletedCallCount, 2);
- Assert.AreEqual(entrypoint.UpperCaseStrings.Count, 2);
- Assert.AreEqual(entrypoint.LowerCaseStrings[1].Value.String, "def");
- Assert.AreEqual(entrypoint.UpperCaseStrings[1], "DEF");
-
- // Verify that adding a random component doesn't cause
- // the OnImportsSatisfied to be called again.
- batch = new CompositionBatch();
- batch.AddParts(new object());
- container.Compose(batch);
-
- Assert.AreEqual(entrypoint.LowerCaseStrings.Count, 2);
- Assert.AreEqual(entrypoint.ImportCompletedCallCount, 2);
- Assert.AreEqual(entrypoint.UpperCaseStrings.Count, 2);
- }
-
- [TestMethod]
- [Ignore]
- [WorkItem(700940)]
- public void ImportCompletedUsingSatisfyImportsOnce()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
- var entrypoint = new UpperCaseStringComponent();
- var entrypointPart = AttributedModelServices.CreatePart(entrypoint);
-
- batch.AddParts(new LowerCaseString("abc"));
- container.Compose(batch);
- container.SatisfyImportsOnce(entrypointPart);
-
- Assert.AreEqual(1, entrypoint.LowerCaseStrings.Count);
- Assert.AreEqual(1, entrypoint.ImportCompletedCallCount);
- Assert.AreEqual(1, entrypoint.UpperCaseStrings.Count);
- Assert.AreEqual("abc", entrypoint.LowerCaseStrings[0].Value.String);
- Assert.AreEqual("ABC", entrypoint.UpperCaseStrings[0]);
-
- batch = new CompositionBatch();
- batch.AddParts(new object());
- container.Compose(batch);
- container.SatisfyImportsOnce(entrypointPart);
-
- Assert.AreEqual(1, entrypoint.LowerCaseStrings.Count);
- Assert.AreEqual(1, entrypoint.ImportCompletedCallCount);
- Assert.AreEqual(1, entrypoint.UpperCaseStrings.Count);
- Assert.AreEqual("abc", entrypoint.LowerCaseStrings[0].Value.String);
- Assert.AreEqual("ABC", entrypoint.UpperCaseStrings[0]);
-
- batch.AddParts(new LowerCaseString("def"));
- container.Compose(batch);
- container.SatisfyImportsOnce(entrypointPart);
-
- Assert.AreEqual(2, entrypoint.LowerCaseStrings.Count);
- Assert.AreEqual(2, entrypoint.ImportCompletedCallCount);
- Assert.AreEqual(2, entrypoint.UpperCaseStrings.Count);
- Assert.AreEqual("abc", entrypoint.LowerCaseStrings[0].Value.String);
- Assert.AreEqual("ABC", entrypoint.UpperCaseStrings[0]);
- Assert.AreEqual("def", entrypoint.LowerCaseStrings[1].Value.String);
- Assert.AreEqual("DEF", entrypoint.UpperCaseStrings[1]);
- }
-
- [TestMethod]
- [Ignore]
- [WorkItem(654513)]
- public void ImportCompletedCalledAfterAllImportsAreFullyComposed()
- {
- int importSatisfationCount = 0;
- var importer1 = new MyEventDrivenFullComposedNotifyImporter1();
- var importer2 = new MyEventDrivenFullComposedNotifyImporter2();
-
- Action<object, EventArgs> verificationAction = (object sender, EventArgs e) =>
- {
- Assert.IsTrue(importer1.AreAllImportsFullyComposed);
- Assert.IsTrue(importer2.AreAllImportsFullyComposed);
- ++importSatisfationCount;
- };
-
- importer1.ImportsSatisfied += new EventHandler(verificationAction);
- importer2.ImportsSatisfied += new EventHandler(verificationAction);
-
- // importer1 added first
- var batch = new CompositionBatch();
- batch.AddParts(importer1, importer2);
-
- var container = ContainerFactory.Create();
- container.ComposeExportedValue<ICompositionService>(container);
- container.Compose(batch);
- Assert.AreEqual(2, importSatisfationCount);
-
- // importer2 added first
- importSatisfationCount = 0;
- batch = new CompositionBatch();
- batch.AddParts(importer2, importer1);
-
- container = ContainerFactory.Create();
- container.ComposeExportedValue<ICompositionService>(container);
- container.Compose(batch);
- Assert.AreEqual(2, importSatisfationCount);
- }
-
- [TestMethod]
- public void ImportCompletedAddPartAndBindComponent()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
- batch.AddParts(new CallbackImportNotify(delegate
- {
- batch = new CompositionBatch();
- batch.AddPart(new object());
- container.Compose(batch);
- }));
-
- container.Compose(batch);
- }
-
- [TestMethod]
- public void ImportCompletedChildNeedsParentContainer()
- {
- var cat = CatalogFactory.CreateDefaultAttributed();
- var parent = new CompositionContainer(cat);
-
- CompositionBatch parentBatch = new CompositionBatch();
- CompositionBatch childBatch = new CompositionBatch();
- CompositionBatch child2Batch = new CompositionBatch();
-
- parentBatch.AddExportedValue<ICompositionService>(parent);
- parent.Compose(parentBatch);
- var child = new CompositionContainer(parent);
- var child2 = new CompositionContainer(parent);
-
- var parentImporter = new MyNotifyImportImporter(parent);
- var childImporter = new MyNotifyImportImporter(child);
- var child2Importer = new MyNotifyImportImporter(child2);
-
- parentBatch = new CompositionBatch();
- parentBatch.AddPart(parentImporter);
- childBatch.AddPart(childImporter);
- child2Batch.AddPart(child2Importer);
-
- parent.Compose(parentBatch);
- child.Compose(childBatch);
- child2.Compose(child2Batch);
-
-
- Assert.AreEqual(1, parentImporter.ImportCompletedCallCount);
- Assert.AreEqual(1, childImporter.ImportCompletedCallCount);
- Assert.AreEqual(1, child2Importer.ImportCompletedCallCount);
-
- MyNotifyImportExporter parentExporter = parent.GetExportedValue<MyNotifyImportExporter>("MyNotifyImportExporter");
- Assert.AreEqual(1, parentExporter.ImportCompletedCallCount);
-
- MyNotifyImportExporter childExporter = child.GetExportedValue<MyNotifyImportExporter>("MyNotifyImportExporter");
- Assert.AreEqual(1, childExporter.ImportCompletedCallCount);
-
- MyNotifyImportExporter child2Exporter = child2.GetExportedValue<MyNotifyImportExporter>("MyNotifyImportExporter");
- Assert.AreEqual(1, child2Exporter.ImportCompletedCallCount);
- }
-
- [TestMethod]
- public void ImportCompletedChildDoesnotNeedParentContainer()
- {
- var cat = CatalogFactory.CreateDefaultAttributed();
- var parent = new CompositionContainer(cat);
-
- CompositionBatch parentBatch = new CompositionBatch();
- CompositionBatch childBatch = new CompositionBatch();
-
- parentBatch.AddExportedValue<ICompositionService>(parent);
- parent.Compose(parentBatch);
-
- var child = new CompositionContainer(parent);
-
- var parentImporter = new MyNotifyImportImporter(parent);
- var childImporter = new MyNotifyImportImporter(child);
-
- parentBatch = new CompositionBatch();
- parentBatch.AddPart(parentImporter);
-
- childBatch.AddParts(childImporter, new MyNotifyImportExporter());
-
- child.Compose(childBatch);
-
- Assert.AreEqual(0, parentImporter.ImportCompletedCallCount);
- Assert.AreEqual(1, childImporter.ImportCompletedCallCount);
-
- // Parent will become bound at this point.
- MyNotifyImportExporter parentExporter = parent.GetExportedValue<MyNotifyImportExporter>("MyNotifyImportExporter");
- parent.Compose(parentBatch);
- Assert.AreEqual(1, parentImporter.ImportCompletedCallCount);
- Assert.AreEqual(1, parentExporter.ImportCompletedCallCount);
-
- MyNotifyImportExporter childExporter = child.GetExportedValue<MyNotifyImportExporter>("MyNotifyImportExporter");
- Assert.AreEqual(1, childExporter.ImportCompletedCallCount);
- }
-
- [TestMethod]
- public void ImportCompletedBindChildIndirectlyThroughParentContainerBind()
- {
- var cat = CatalogFactory.CreateDefaultAttributed();
- var parent = new CompositionContainer(cat);
-
- CompositionBatch parentBatch = new CompositionBatch();
- CompositionBatch childBatch = new CompositionBatch();
-
- parentBatch.AddExportedValue<ICompositionService>(parent);
- parent.Compose(parentBatch);
- var child = new CompositionContainer(parent);
-
- var parentImporter = new MyNotifyImportImporter(parent);
- var childImporter = new MyNotifyImportImporter(child);
-
- parentBatch = new CompositionBatch();
- parentBatch.AddPart(parentImporter);
- childBatch.AddParts(childImporter, new MyNotifyImportExporter());
-
- parent.Compose(parentBatch);
- child.Compose(childBatch);
-
- Assert.AreEqual(1, parentImporter.ImportCompletedCallCount);
- Assert.AreEqual(1, childImporter.ImportCompletedCallCount);
-
- MyNotifyImportExporter parentExporter = parent.GetExportedValue<MyNotifyImportExporter>("MyNotifyImportExporter");
- Assert.AreEqual(1, parentExporter.ImportCompletedCallCount);
-
- MyNotifyImportExporter childExporter = child.GetExportedValue<MyNotifyImportExporter>("MyNotifyImportExporter");
- Assert.AreEqual(1, childExporter.ImportCompletedCallCount);
- }
-
- [TestMethod]
- public void ImportCompletedGetExportedValueLazy()
- {
- var cat = CatalogFactory.CreateDefaultAttributed();
- CompositionContainer container = new CompositionContainer(cat);
-
- NotifyImportExportee.InstanceCount = 0;
- NotifyImportExportsLazy notifyee = container.GetExportedValue<NotifyImportExportsLazy>("NotifyImportExportsLazy");
- Assert.IsNotNull(notifyee, "Expecting bound type");
- Assert.IsNotNull(notifyee.Imports, "Expecting Imports to be populated");
- Assert.IsTrue(notifyee.NeedRefresh, "Expecting import to put class in pending state");
- Assert.AreEqual(3, notifyee.Imports.Count, "Expecting 3 Exports before filtering");
- Assert.AreEqual(0, NotifyImportExportee.InstanceCount, "Not instance expected before pull");
- Assert.AreEqual(0, notifyee.realImports.Count, "Expecting collection to be empty before pull");
- Assert.AreEqual(2, notifyee.RealImports.Count, "Expecting 2 real values after pull");
- Assert.AreEqual(1, notifyee.RealImports[0].Id, "Expecting distinct activated instance");
- Assert.AreEqual(3, notifyee.RealImports[1].Id, "Expecting distinct activated instance");
- Assert.AreEqual(2, NotifyImportExportee.InstanceCount, "2 instances expected after pull");
- }
-
- [TestMethod]
- public void ImportCompletedGetExportedValueEager()
- {
- var cat = CatalogFactory.CreateDefaultAttributed();
- CompositionContainer container = new CompositionContainer(cat);
-
- NotifyImportExportee.InstanceCount = 0;
- var notifyee = container.GetExportedValue<NotifyImportExportsEager>("NotifyImportExportsEager");
- Assert.IsNotNull(notifyee, "Expecting bound type");
- Assert.IsNotNull(notifyee.Imports, "Expecting Imports to be populated");
- Assert.AreEqual(3, notifyee.Imports.Count, "Expecting 3 Exports before filtering");
- Assert.AreEqual(2, NotifyImportExportee.InstanceCount, "Expecting concrete instances already pulled");
- Assert.AreEqual(2, notifyee.realImports.Count, "Expecting collection to be populated");
- Assert.AreEqual(2, notifyee.RealImports.Count, "Expecting 2 real values after import");
- Assert.AreEqual(1, notifyee.RealImports[0].Id, "Expecting distinct activated instance");
- Assert.AreEqual(3, notifyee.RealImports[1].Id, "Expecting distinct activated instance");
- Assert.AreEqual(2, NotifyImportExportee.InstanceCount, "Expecting no more instances after read");
- }
- }
-
- public class NotifyImportExportee
- {
- public NotifyImportExportee(int id)
- {
- Id = id;
- InstanceCount++;
- }
-
- public int Id { get; set; }
-
- public static int InstanceCount { get; set; }
- }
-
- public class NotifyImportExporter
- {
-
- public NotifyImportExporter()
- {
- }
-
- [Export()]
- [ExportMetadata("Filter", false)]
- public NotifyImportExportee Export1
- {
- get
- {
- return new NotifyImportExportee(1);
- }
- }
-
- [Export()]
- [ExportMetadata("Filter", true)]
- public NotifyImportExportee Export2
- {
- get
- {
- return new NotifyImportExportee(2);
- }
- }
-
- [Export()]
- [ExportMetadata("Filter", false)]
- public NotifyImportExportee Export3
- {
- get
- {
- return new NotifyImportExportee(3);
- }
- }
-
- }
-
- [Export("NotifyImportExportsLazy")]
- public class NotifyImportExportsLazy : IPartImportsSatisfiedNotification
- {
- public NotifyImportExportsLazy()
- {
- NeedRefresh = false;
- }
-
- [ImportMany(typeof(NotifyImportExportee))]
- public Collection<Lazy<NotifyImportExportee, IDictionary<string, object>>> Imports { get; set; }
-
- public bool NeedRefresh { get; set; }
-
- public void OnImportsSatisfied()
- {
- NeedRefresh = true;
- }
-
- internal Collection<NotifyImportExportee> realImports = new Collection<NotifyImportExportee>();
-
- public Collection<NotifyImportExportee> RealImports
- {
- get
- {
- if (NeedRefresh)
- {
- realImports.Clear();
- foreach (var import in Imports)
- {
- if (!((bool)import.Metadata["Filter"]))
- {
- realImports.Add(import.Value);
- }
- }
- NeedRefresh = false;
- }
- return realImports;
- }
- }
- }
-
- [Export("NotifyImportExportsEager")]
- public class NotifyImportExportsEager : IPartImportsSatisfiedNotification
- {
- public NotifyImportExportsEager()
- {
- }
-
- [ImportMany]
- public Collection<Lazy<NotifyImportExportee, IDictionary<string, object>>> Imports { get; set; }
-
- public void OnImportsSatisfied()
- {
- realImports.Clear();
- foreach (var import in Imports)
- {
- if (!((bool)import.Metadata["Filter"]))
- {
- realImports.Add(import.Value);
- }
- }
- }
-
- internal Collection<NotifyImportExportee> realImports = new Collection<NotifyImportExportee>();
-
- public Collection<NotifyImportExportee> RealImports
- {
- get
- {
- return realImports;
- }
- }
- }
-
- public class MyEventDrivenNotifyImporter : IPartImportsSatisfiedNotification
- {
- [Import]
- public ICompositionService ImportSomethingSoIGetImportCompletedCalled { get; set; }
-
- public event EventHandler ImportsSatisfied;
-
- public void OnImportsSatisfied()
- {
- if (this.ImportsSatisfied != null)
- {
- this.ImportsSatisfied(this, new EventArgs());
- }
- }
- }
-
- [Export]
- public class MyEventDrivenFullComposedNotifyImporter1 : MyEventDrivenNotifyImporter
- {
- [Import]
- public MyEventDrivenFullComposedNotifyImporter2 FullyComposedImport { get; set; }
-
- public bool AreAllImportsSet
- {
- get
- {
- return (this.ImportSomethingSoIGetImportCompletedCalled != null)
- && (this.FullyComposedImport != null);
- }
- }
-
- public bool AreAllImportsFullyComposed
- {
- get
- {
- return this.AreAllImportsSet && this.FullyComposedImport.AreAllImportsSet;
- }
- }
- }
-
- [Export]
- public class MyEventDrivenFullComposedNotifyImporter2 : MyEventDrivenNotifyImporter
- {
- [Import]
- public MyEventDrivenFullComposedNotifyImporter1 FullyComposedImport { get; set; }
-
- public bool AreAllImportsSet
- {
- get
- {
- return (this.ImportSomethingSoIGetImportCompletedCalled != null)
- && (this.FullyComposedImport != null);
- }
- }
-
- public bool AreAllImportsFullyComposed
- {
- get
- {
- return this.AreAllImportsSet && this.FullyComposedImport.AreAllImportsSet;
- }
- }
- }
-
- [Export("MyNotifyImportExporter")]
- public class MyNotifyImportExporter : IPartImportsSatisfiedNotification
- {
- [Import]
- public ICompositionService ImportSomethingSoIGetImportCompletedCalled { get; set; }
-
- public int ImportCompletedCallCount { get; set; }
- public void OnImportsSatisfied()
- {
- ImportCompletedCallCount++;
- }
- }
-
- public class MyNotifyImportImporter : IPartImportsSatisfiedNotification
- {
- private CompositionContainer container;
- public MyNotifyImportImporter(CompositionContainer container)
- {
- this.container = container;
- }
- [Import("MyNotifyImportExporter")]
- public MyNotifyImportExporter MyNotifyImportExporter { get; set; }
-
- public int ImportCompletedCallCount { get; set; }
- public void OnImportsSatisfied()
- {
- ImportCompletedCallCount++;
- }
- }
-
- [Export("LowerCaseString")]
- public class LowerCaseString
- {
- public string String { get; private set; }
- public LowerCaseString(string s)
- {
- String = s.ToLower();
- }
- }
-
- public class UpperCaseStringComponent : IPartImportsSatisfiedNotification
- {
- public UpperCaseStringComponent()
- {
- UpperCaseStrings = new List<string>();
- }
- Collection<Lazy<LowerCaseString>> lowerCaseString = new Collection<Lazy<LowerCaseString>>();
-
- [ImportMany("LowerCaseString", AllowRecomposition = true)]
- public Collection<Lazy<LowerCaseString>> LowerCaseStrings {
- get { return lowerCaseString; }
- set { lowerCaseString = value; }
- }
-
- public List<string> UpperCaseStrings { get; set; }
-
- public int ImportCompletedCallCount { get; set; }
-
- // This method gets called whenever a bind is completed and any of
- // of the imports have changed, but ar safe to use now.
- public void OnImportsSatisfied()
- {
- UpperCaseStrings.Clear();
- foreach (var i in LowerCaseStrings)
- UpperCaseStrings.Add(i.Value.String.ToUpper());
-
- ImportCompletedCallCount++;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/AttributedModelServicesTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/AttributedModelServicesTests.cs deleted file mode 100644 index c7b7af5ca6a..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/AttributedModelServicesTests.cs +++ /dev/null @@ -1,161 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Diagnostics;
-using System.ComponentModel.Composition.Factories;
-using System.Diagnostics;
-using System.Linq;
-using System.UnitTesting;
-
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Extensibility;
-
-namespace System.ComponentModel.Composition.AttributedModel
-{
- [TestClass]
- public class AttributedModelServicesTests
- {
- [TestMethod]
- public void CreatePartDefinition1_NullAsType_ShouldThrowArgumentNull()
- {
- var origin = ElementFactory.Create();
-
- ExceptionAssert.ThrowsArgumentNull("type", () =>
- {
- AttributedModelServices.CreatePartDefinition((Type)null, origin);
- });
- }
-
- [TestMethod]
- public void CreatePartDefinition2_NullAsType_ShouldThrowArgumentNull()
- {
- var origin = ElementFactory.Create();
-
- ExceptionAssert.ThrowsArgumentNull("type", () =>
- {
- AttributedModelServices.CreatePartDefinition((Type)null, origin, false);
- });
- }
-
-#if !SILVERLIGHT
-
- [TestMethod]
- public void CreatePartDefinition2_TypeMarkedWithPartNotDiscoverableAttribute_ShouldTraceInformation()
- {
- var types = GetTypesMarkedWithPartNotDiscoverableAttribute();
-
- foreach (Type type in types)
- {
- using (TraceContext context = new TraceContext(SourceLevels.Information))
- {
- AttributedModelServices.CreatePartDefinition(type, null, true);
-
- Assert.IsNotNull(context.LastTraceEvent);
- Assert.AreEqual(context.LastTraceEvent.EventType, TraceEventType.Information);
- Assert.AreEqual(context.LastTraceEvent.Id, TraceId.Discovery_DefinitionMarkedWithPartNotDiscoverableAttribute);
- }
- }
- }
-
- [TestMethod]
- public void CreatePartDefinition2_OpenGenericType_ShouldTraceInformation()
- {
- var types = GetOpenGenericTypes();
-
- foreach (Type type in types)
- {
- using (TraceContext context = new TraceContext(SourceLevels.Information))
- {
- AttributedModelServices.CreatePartDefinition(type, null, true);
-
- Assert.IsNotNull(context.LastTraceEvent);
- Assert.AreEqual(context.LastTraceEvent.EventType, TraceEventType.Information);
- Assert.AreEqual(context.LastTraceEvent.Id, TraceId.Discovery_DefinitionContainsGenericParameters);
- }
- }
- }
-
- [TestMethod]
- public void CreatePartDefinition2_TypeWithNoExports_ShouldTraceInformation()
- {
- var types = GetTypesWithNoExports();
-
- foreach (Type type in types)
- {
- using (TraceContext context = new TraceContext(SourceLevels.Information))
- {
- var result = AttributedModelServices.CreatePartDefinition(type, null, true);
-
- Assert.IsNotNull(context.LastTraceEvent);
- Assert.AreEqual(context.LastTraceEvent.EventType, TraceEventType.Information);
- Assert.AreEqual(context.LastTraceEvent.Id, TraceId.Discovery_DefinitionContainsNoExports);
- }
- }
- }
-
- private static IEnumerable<Type> GetTypesMarkedWithPartNotDiscoverableAttribute()
- {
- yield return typeof(ClassMarkedWithPartNotDiscoverableAttribute);
- yield return typeof(ClassMarkedWithPartNotDiscoverableAttribute<>);
- }
-
- private static IEnumerable<Type> GetOpenGenericTypes()
- {
- yield return typeof(OpenGenericType<>);
- }
-
- private static IEnumerable<Type> GetTypesWithNoExports()
- {
- yield return typeof(ClassWithNoExports);
- yield return typeof(ClassWithOnlyFieldImport);
- yield return typeof(ClassWithOnlyPropertyImport);
- yield return typeof(ClassWithOnlyParameterImport);
- }
-
- public class ClassWithNoExports
- {
- }
-
- public class ClassWithOnlyFieldImport
- {
- [Import]
- public string Field;
- }
-
- public class ClassWithOnlyPropertyImport
- {
- [Import]
- public string Property
- {
- get;
- set;
- }
- }
-
- public class ClassWithOnlyParameterImport
- {
- [ImportingConstructor]
- public ClassWithOnlyParameterImport(string parameter)
- {
- }
- }
-
- public class OpenGenericType<T>
- {
- }
-
- [PartNotDiscoverable]
- public class ClassMarkedWithPartNotDiscoverableAttribute
- {
- }
-
- [PartNotDiscoverable]
- public class ClassMarkedWithPartNotDiscoverableAttribute<T>
- {
- }
-#endif
-
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CardinalityMismatchExceptionTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CardinalityMismatchExceptionTests.cs deleted file mode 100644 index 39a8a58aae5..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CardinalityMismatchExceptionTests.cs +++ /dev/null @@ -1,169 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-#if !SILVERLIGHT
-using System.Runtime.Serialization;
-#endif
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class CardinalityMismatchExceptionTests
- {
- [TestMethod]
- public void Constructor1_ShouldSetMessagePropertyToDefault()
- {
- var exception = new ImportCardinalityMismatchException();
-
- ExceptionAssert.HasDefaultMessage(exception);
- }
-
- [TestMethod]
- public void Constructor2_NullAsMessageArgument_ShouldSetMessagePropertyToDefault()
- {
- var exception = new ImportCardinalityMismatchException((string)null);
-
- ExceptionAssert.HasDefaultMessage(exception);
- }
-
- [TestMethod]
- public void Constructor3_NullAsMessageArgument_ShouldSetMessagePropertyToDefault()
- {
- var exception = new ImportCardinalityMismatchException((string)null, new Exception());
-
- ExceptionAssert.HasDefaultMessage(exception);
- }
-
- [TestMethod]
- public void Constructor2_ValueAsMessageArgument_ShouldSetMessageProperty()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = new ImportCardinalityMismatchException(e);
-
- Assert.AreEqual(e, exception.Message);
- }
- }
-
- [TestMethod]
- public void Constructor3_ValueAsMessageArgument_ShouldSetMessageProperty()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = new ImportCardinalityMismatchException(e, new Exception());
-
- Assert.AreEqual(e, exception.Message);
- }
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetInnerExceptionPropertyToNull()
- {
- var exception = new ImportCardinalityMismatchException();
-
- Assert.IsNull(exception.InnerException);
- }
-
- [TestMethod]
- public void Constructor2_ShouldSetInnerExceptionPropertyToNull()
- {
- var exception = new ImportCardinalityMismatchException("Message");
-
- Assert.IsNull(exception.InnerException);
- }
-
- [TestMethod]
- public void Constructor3_NullAsInnerExceptionArgument_ShouldSetInnerExceptionPropertyToNull()
- {
- var exception = new ImportCardinalityMismatchException("Message", (Exception)null);
-
- Assert.IsNull(exception.InnerException);
- }
-
- [TestMethod]
- public void Constructor3_ValueAsInnerExceptionArgument_ShouldSetInnerExceptionProperty()
- {
- var expectations = Expectations.GetInnerExceptions();
-
- foreach (var e in expectations)
- {
- var exception = new ImportCardinalityMismatchException("Message", e);
-
- Assert.AreSame(e, exception.InnerException);
- }
- }
-
-#if !SILVERLIGHT
-
- [TestMethod]
- public void Constructor4_NullAsInfoArgument_ShouldThrowArgumentNull()
- {
- var context = new StreamingContext();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("info", () =>
- {
- SerializationTestServices.Create<ImportCardinalityMismatchException>((SerializationInfo)null, context);
- });
- }
-
- [TestMethod]
- public void InnerException_CanBeSerialized()
- {
- var expectations = Expectations.GetInnerExceptionsWithNull();
-
- foreach (var e in expectations)
- {
- var exception = CreateCardinalityMismatchException(e);
-
- var result = SerializationTestServices.RoundTrip(exception);
-
- ExtendedAssert.IsInstanceOfSameType(exception.InnerException, result.InnerException);
- }
- }
-
- [TestMethod]
- public void Message_CanBeSerialized()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = CreateCardinalityMismatchException(e);
-
- var result = SerializationTestServices.RoundTrip(exception);
-
- Assert.AreEqual(exception.Message, result.Message);
- }
- }
-
-#endif
-
- private static ImportCardinalityMismatchException CreateCardinalityMismatchException()
- {
- return CreateCardinalityMismatchException((string)null, (Exception)null);
- }
-
- private static ImportCardinalityMismatchException CreateCardinalityMismatchException(string message)
- {
- return CreateCardinalityMismatchException(message, (Exception)null);
- }
-
- private static ImportCardinalityMismatchException CreateCardinalityMismatchException(Exception innerException)
- {
- return CreateCardinalityMismatchException((string)null, innerException);
- }
-
- private static ImportCardinalityMismatchException CreateCardinalityMismatchException(string message, Exception innerException)
- {
- return new ImportCardinalityMismatchException(message, innerException);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ComponentModelTestTypes.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ComponentModelTestTypes.cs deleted file mode 100644 index acef102c738..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ComponentModelTestTypes.cs +++ /dev/null @@ -1,138 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.ObjectModel;
-using System.ComponentModel.Composition;
-
-namespace System.ComponentModel.Composition
-{
- public class CallbackExecuteCodeDuringCompose
- {
- public CallbackExecuteCodeDuringCompose(Action callback)
- {
- this.callback = callback;
- }
-
- [Export("MyOwnCallbackContract")]
- public string ExportValue
- {
- get
- {
- callback();
- return string.Empty;
- }
- }
-
- [Import("MyOwnCallbackContract")]
- public string ImportValue { get; set; }
- private Action callback;
- }
-
- public class CallbackImportNotify : IPartImportsSatisfiedNotification
- {
- private Action callback;
- public CallbackImportNotify(Action callback)
- {
- this.callback = callback;
- }
-
- [Import(AllowDefault=true)]
- public ICompositionService ImportSomethingSoIGetImportCompletedCalled { get; set; }
-
- public void OnImportsSatisfied()
- {
- this.callback();
- }
- }
-
- public class ExportValueTypeFactory
- {
- [Export("{AssemblyCatalogResolver}FactoryValueType")]
- public int Value
- {
- get
- {
- return 18;
- }
- }
- }
-
-
- public class ExportValueTypeSingleton
- {
- [Export("{AssemblyCatalogResolver}SingletonValueType")]
- public int Value
- {
- get
- {
- return 17;
- }
- }
- }
-
-
- public class Int32CollectionImporter
- {
-
- public Int32CollectionImporter()
- {
- Values = new Collection<int>();
- }
-
- [ImportMany("Value")]
- public Collection<int> Values { get; private set; }
- }
-
- [PartNotDiscoverable]
- public class Int32Exporter
- {
-
- public Int32Exporter(int value)
- {
- Value = value;
- }
-
- [Export("Value")]
- public int Value { get; set; }
-
- }
-
- [PartNotDiscoverable]
- public class Int32ExporterInternal
- {
-
- public Int32ExporterInternal(int value)
- {
- Value = value;
- }
-
- [Export("Value")]
- public int Value { get; set; }
-
- }
-
- public class Int32Importer
- {
-
- public Int32Importer()
- {
- }
-
- [Import("Value", AllowRecomposition = true)]
- public int Value { get; set; }
- }
-
- public class Int32ImporterInternal
- {
-
- public Int32ImporterInternal()
- {
- }
-
- [Import("Value")]
- public int Value { get; set; }
- }
-
-
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ComponentServicesTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ComponentServicesTests.cs deleted file mode 100644 index 5017463ef3c..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ComponentServicesTests.cs +++ /dev/null @@ -1,128 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.Linq;
-using System.Linq.Expressions;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.UnitTesting;
-using System.ComponentModel.Composition.Factories;
-using System.UnitTesting;
-using System.ComponentModel.Composition.Hosting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class ComponentServicesTests
- {
- [TestMethod]
- public void GetValuesByType()
- {
- var cat = CatalogFactory.CreateDefaultAttributed();
-
- var container = new CompositionContainer(cat);
-
- string itestName = AttributedModelServices.GetContractName(typeof(ITest));
-
- var e1 = container.GetExportedValues<ITest>();
- var e2 = container.GetExports<ITest, object>(itestName);
-
- Assert.IsInstanceOfType(e1.First(), typeof(T1), "First should be T1");
- Assert.IsInstanceOfType(e1.Skip(1).First(), typeof(T2), "Second should be T2");
-
- Assert.IsInstanceOfType(e2.First().Value, typeof(T1), "First should be T1");
- Assert.IsInstanceOfType(e2.Skip(1).First().Value, typeof(T2), "Second should be T2");
-
- CompositionContainer childContainer = new CompositionContainer(container);
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(new T1());
- container.Compose(batch);
- var t1 = childContainer.GetExportedValue<ITest>();
- var t2 = childContainer.GetExport<ITest, object>(itestName);
-
- Assert.IsInstanceOfType(t1, typeof(T1), "First (resolved) should be T1");
- Assert.IsInstanceOfType(t2.Value, typeof(T1), "First (resolved) should be T1");
- }
-
- [TestMethod]
- public void GetValueTest()
- {
- var container = ContainerFactory.Create();
- ITest t = new T1();
- string name = AttributedModelServices.GetContractName(typeof(ITest));
- CompositionBatch batch = new CompositionBatch();
- batch.AddExportedValue(name, t);
- container.Compose(batch);
- ITest value = container.GetExportedValue<ITest>();
- Assert.AreEqual(t, value, "TryGetExportedValue should return t (by type)");
- value = container.GetExportedValue<ITest>(name);
- Assert.AreEqual(t, value, "TryGetExportedValue should return t (given name)");
- }
-
- [TestMethod]
- public void GetValuesTest()
- {
- var container = ContainerFactory.Create();
- ITest t = new T1();
- string name = AttributedModelServices.GetContractName(typeof(ITest));
- CompositionBatch batch = new CompositionBatch();
- batch.AddExportedValue(name, t);
- container.Compose(batch);
- IEnumerable<ITest> values = container.GetExportedValues<ITest>();
- Assert.AreEqual(t, values.First(), "TryGetExportedValues should return t (by type)");
- values = container.GetExportedValues<ITest>(name);
- Assert.AreEqual(t, values.First(), "TryGetExportedValues should return t (by name)");
- }
-
-
-
- [TestMethod]
- public void NoResolverExceptionTest()
- {
- var container = ContainerFactory.Create();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(new MultiExport());
- batch.AddPart(new SingleImport());
-
- CompositionAssert.ThrowsChangeRejectedError(ErrorId.ImportEngine_PartCannotSetImport, ErrorId.ImportEngine_ImportCardinalityMismatch, RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
- }
-
- public class MultiExport
- {
- [Export("Multi")]
- [ExportMetadata("Value", "One")]
- public int M1 { get { return 1; } }
-
- [Export("Multi")]
- [ExportMetadata("Value", "Two")]
- public int M2 { get { return 2; } }
-
- [Export("Multi")]
- [ExportMetadata("Value", "Three")]
- public int M3 { get { return 3; } }
- }
-
- public interface ITest
- {
- void Do();
- }
-
- [Export(typeof(ITest))]
- public class T1 : ITest
- {
- public void Do() { }
- }
-
- [Export(typeof(ITest))]
- public class T2 : ITest
- {
- public void Do() { }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ComposablePartCatalogExtensions.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ComposablePartCatalogExtensions.cs deleted file mode 100644 index 019f9e0ba5a..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ComposablePartCatalogExtensions.cs +++ /dev/null @@ -1,25 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.IO;
-using System.Linq.Expressions;
-using System.UnitTesting;
-using System.Reflection;
-
-namespace System.ComponentModel.Composition
-{
- internal static class ComposablePartCatalogExtensions
- {
- public static IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>> GetExports(this ComposablePartCatalog catalog, Expression<Func<ExportDefinition, bool>> constraint)
- {
- var import = ImportDefinitionFactory.Create(constraint);
- return catalog.GetExports(import);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ComposablePartDefinitionTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ComposablePartDefinitionTests.cs deleted file mode 100644 index cdf484ee5b1..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ComposablePartDefinitionTests.cs +++ /dev/null @@ -1,44 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.Linq;
-using System.Reflection;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.UnitTesting;
-using System.ComponentModel.Composition.Factories;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class ComposablePartDefinitionTests
- {
- [TestMethod]
- public void Constructor1_ShouldNotThrow()
- {
- PartDefinitionFactory.Create();
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetMetadataPropertyToEmptyDictionary()
- {
- var definition = PartDefinitionFactory.Create();
-
- EnumerableAssert.IsEmpty(definition.Metadata);
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetMetadataPropertyToReadOnlyDictionary()
- {
- var definition = PartDefinitionFactory.Create();
-
- ExceptionAssert.Throws<NotSupportedException>(() =>
- {
- definition.Metadata["Value"] = "Value";
- });
- }
- }
-}
-
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ComposablePartExceptionTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ComposablePartExceptionTests.cs deleted file mode 100644 index f56a866f973..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ComposablePartExceptionTests.cs +++ /dev/null @@ -1,690 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.UnitTesting;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-#if !SILVERLIGHT
-using System.Runtime.Serialization;
-#endif
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class CompositionPartExceptionTests
- {
- [TestMethod]
- public void Constructor1_ShouldSetMessagePropertyToDefault()
- {
- var exception = new ComposablePartException();
-
- ExceptionAssert.HasDefaultMessage(exception);
- }
-
- [TestMethod]
- public void Constructor2_NullAsMessageArgument_ShouldSetMessagePropertyToDefault()
- {
- var exception = new ComposablePartException((string)null);
-
- ExceptionAssert.HasDefaultMessage(exception);
- }
-
- [TestMethod]
- public void Constructor3_NullAsMessageArgument_ShouldSetMessagePropertyToDefault()
- {
- var exception = new ComposablePartException((string)null, ElementFactory.Create());
-
- ExceptionAssert.HasDefaultMessage(exception);
- }
-
- [TestMethod]
- public void Constructor4_NullAsMessageArgument_ShouldSetMessagePropertyToDefault()
- {
- var exception = new ComposablePartException((string)null, new Exception());
-
- ExceptionAssert.HasDefaultMessage(exception);
- }
-
- [TestMethod]
- public void Constructor5_NullAsMessageArgument_ShouldSetMessagePropertyToDefault()
- {
- var exception = new ComposablePartException((string)null, ElementFactory.Create(), new Exception());
-
- ExceptionAssert.HasDefaultMessage(exception);
- }
-
- [TestMethod]
- public void Constructor6_NullAsMessageArgument_ShouldSetMessagePropertyToDefault()
- {
- var exception = new ComposablePartException(CompositionErrorId.Unknown, (string)null);
-
- ExceptionAssert.HasDefaultMessage(exception);
- }
-
- [TestMethod]
- public void Constructor7_NullAsMessageArgument_ShouldSetMessagePropertyToDefault()
- {
- var exception = new ComposablePartException(CompositionErrorId.Unknown, (string)null, new Exception());
-
- ExceptionAssert.HasDefaultMessage(exception);
- }
-
- [TestMethod]
- public void Constructor8_NullAsMessageArgument_ShouldSetMessagePropertyToDefault()
- {
- var exception = new ComposablePartException(CompositionErrorId.Unknown, (string)null, ElementFactory.Create());
-
- ExceptionAssert.HasDefaultMessage(exception);
- }
-
- [TestMethod]
- public void Constructor9_NullAsMessageArgument_ShouldSetMessagePropertyToDefault()
- {
- var exception = new ComposablePartException(CompositionErrorId.Unknown, (string)null, ElementFactory.Create(), new Exception());
-
- ExceptionAssert.HasDefaultMessage(exception);
- }
-
- [TestMethod]
- public void Constructor2_ValueAsMessageArgument_ShouldSetMessageProperty()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = new ComposablePartException(e);
-
- Assert.AreEqual(e, exception.Message);
- }
- }
-
- [TestMethod]
- public void Constructor3_ValueAsMessageArgument_ShouldSetMessageProperty()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = new ComposablePartException(e, ElementFactory.Create());
-
- Assert.AreEqual(e, exception.Message);
- }
- }
-
- [TestMethod]
- public void Constructor4_ValueAsMessageArgument_ShouldSetMessageProperty()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = new ComposablePartException(e, new Exception());
-
- Assert.AreEqual(e, exception.Message);
- }
- }
-
- [TestMethod]
- public void Constructor5_ValueAsMessageArgument_ShouldSetMessageProperty()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = new ComposablePartException(e, ElementFactory.Create(), new Exception());
-
- Assert.AreEqual(e, exception.Message);
- }
- }
-
- [TestMethod]
- public void Constructor6_ValueAsMessageArgument_ShouldSetMessageProperty()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = new ComposablePartException(CompositionErrorId.Unknown, e);
-
- Assert.AreEqual(e, exception.Message);
- }
- }
-
- [TestMethod]
- public void Constructor7_ValueAsMessageArgument_ShouldSetMessageProperty()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = new ComposablePartException(CompositionErrorId.Unknown, e, new Exception());
-
- Assert.AreEqual(e, exception.Message);
- }
- }
-
- [TestMethod]
- public void Constructor8_ValueAsMessageArgument_ShouldSetMessageProperty()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = new ComposablePartException(CompositionErrorId.Unknown, e, ElementFactory.Create());
-
- Assert.AreEqual(e, exception.Message);
- }
- }
-
- [TestMethod]
- public void Constructor9_ValueAsMessageArgument_ShouldSetMessageProperty()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = new ComposablePartException(CompositionErrorId.Unknown, e, ElementFactory.Create(), new Exception());
-
- Assert.AreEqual(e, exception.Message);
- }
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetInnerExceptionPropertyToNull()
- {
- var exception = new ComposablePartException();
-
- Assert.IsNull(exception.InnerException);
- }
-
- [TestMethod]
- public void Constructor2_ShouldSetInnerExceptionPropertyToNull()
- {
- var exception = new ComposablePartException("Message");
-
- Assert.IsNull(exception.InnerException);
- }
-
- [TestMethod]
- public void Constructor3_ShouldSetInnerExceptionPropertyToNull()
- {
- var exception = new ComposablePartException("Message", ElementFactory.Create());
-
- Assert.IsNull(exception.InnerException);
- }
-
- [TestMethod]
- public void Constructor4_NullAsInnerExceptionArgument_ShouldSetInnerExceptionPropertyToNull()
- {
- var exception = new ComposablePartException("Message", (Exception)null);
-
- Assert.IsNull(exception.InnerException);
- }
-
- [TestMethod]
- public void Constructor5_NullAsInnerExceptionArgument_ShouldSetInnerExceptionPropertyToNull()
- {
- var exception = new ComposablePartException("Message", ElementFactory.Create(), (Exception)null);
-
- Assert.IsNull(exception.InnerException);
- }
-
- [TestMethod]
- public void Constructor6_ShouldSetInnerExceptionPropertyToNull()
- {
- var exception = new ComposablePartException(CompositionErrorId.Unknown, "Message");
-
- Assert.IsNull(exception.InnerException);
- }
-
- [TestMethod]
- public void Constructor7_NullAsInnerExceptionArgument_ShouldSetInnerExceptionPropertyToNull()
- {
- var exception = new ComposablePartException(CompositionErrorId.Unknown, "Message", (Exception)null);
-
- Assert.IsNull(exception.InnerException);
- }
-
- [TestMethod]
- public void Constructor8_ShouldSetInnerExceptionPropertyToNull()
- {
- var exception = new ComposablePartException(CompositionErrorId.Unknown, "Message", ElementFactory.Create());
-
- Assert.IsNull(exception.InnerException);
- }
-
- [TestMethod]
- public void Constructor9_NullAsInnerExceptionArgument_ShouldSetInnerExceptionPropertyToNull()
- {
- var exception = new ComposablePartException(CompositionErrorId.Unknown, "Message", ElementFactory.Create(), (Exception)null);
-
- Assert.IsNull(exception.InnerException);
- }
-
- [TestMethod]
- public void Constructor4_ValueAsInnerExceptionArgument_ShouldSetInnerExceptionProperty()
- {
- var expectations = Expectations.GetInnerExceptions();
-
- foreach (var e in expectations)
- {
- var exception = new ComposablePartException("Message", e);
-
- Assert.AreSame(e, exception.InnerException);
- }
- }
-
- [TestMethod]
- public void Constructor5_ValueAsInnerExceptionArgument_ShouldSetInnerExceptionProperty()
- {
- var expectations = Expectations.GetInnerExceptions();
-
- foreach (var e in expectations)
- {
- var exception = new ComposablePartException("Message", ElementFactory.Create(), e);
-
- Assert.AreSame(e, exception.InnerException);
- }
- }
-
- [TestMethod]
- public void Constructor7_ValueAsInnerExceptionArgument_ShouldSetInnerExceptionProperty()
- {
- var expectations = Expectations.GetInnerExceptions();
-
- foreach (var e in expectations)
- {
- var exception = new ComposablePartException(CompositionErrorId.Unknown, "Message", e);
-
- Assert.AreSame(e, exception.InnerException);
- }
- }
-
- [TestMethod]
- public void Constructor9_ValueAsInnerExceptionArgument_ShouldSetInnerExceptionProperty()
- {
- var expectations = Expectations.GetInnerExceptions();
-
- foreach (var e in expectations)
- {
- var exception = new ComposablePartException(CompositionErrorId.Unknown, "Message", ElementFactory.Create(), e);
-
- Assert.AreSame(e, exception.InnerException);
- }
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetICompositionErrorIdPropertyToCompositionErrorIdUnknown()
- {
- var exception = (ICompositionError)new ComposablePartException();
-
- Assert.AreEqual(CompositionErrorId.Unknown, exception.Id);
- }
-
- [TestMethod]
- public void Constructor2_ShouldSetICompositionErrorIdPropertyToCompositionErrorIdUnknown()
- {
- var exception = (ICompositionError)new ComposablePartException("Message");
-
- Assert.AreEqual(CompositionErrorId.Unknown, exception.Id);
- }
-
- [TestMethod]
- public void Constructor3_ShouldSetICompositionErrorIdPropertyToCompositionErrorIdUnknown()
- {
- var exception = (ICompositionError)new ComposablePartException("Message", ElementFactory.Create());
-
- Assert.AreEqual(CompositionErrorId.Unknown, exception.Id);
- }
-
- [TestMethod]
- public void Constructor4_ShouldSetICompositionErrorIdPropertyToCompositionErrorIdUnknown()
- {
- var exception = (ICompositionError)new ComposablePartException("Message", new Exception());
-
- Assert.AreEqual(CompositionErrorId.Unknown, exception.Id);
- }
-
- [TestMethod]
- public void Constructor5_ShouldSetICompositionErrorIdPropertyToCompositionErrorIdUnknown()
- {
- var exception = (ICompositionError)new ComposablePartException("Message", ElementFactory.Create(), new Exception());
-
- Assert.AreEqual(CompositionErrorId.Unknown, exception.Id);
- }
-
- [TestMethod]
- public void Constructor6_ValueAsIdArgument_ShouldSetICompositionErrorIdProperty()
- {
- var expectations = Expectations.GetEnumValues<CompositionErrorId>();
-
- foreach (var e in expectations)
- {
- var exception = (ICompositionError)new ComposablePartException(e, "Message");
-
- Assert.AreEqual(e, exception.Id);
- }
- }
-
- [TestMethod]
- public void Constructor7_ValueAsIdArgument_ShouldSetICompositionErrorIdProperty()
- {
- var expectations = Expectations.GetEnumValues<CompositionErrorId>();
-
- foreach (var e in expectations)
- {
- var exception = (ICompositionError)new ComposablePartException(e, "Message", new Exception());
-
- Assert.AreEqual(e, exception.Id);
- }
- }
-
- [TestMethod]
- public void Constructor8_ValueAsIdArgument_ShouldSetICompositionErrorIdProperty()
- {
- var expectations = Expectations.GetEnumValues<CompositionErrorId>();
-
- foreach (var e in expectations)
- {
- var exception = (ICompositionError)new ComposablePartException(e, "Message", ElementFactory.Create());
-
- Assert.AreEqual(e, exception.Id);
- }
- }
-
- [TestMethod]
- public void Constructor9_ValueAsIdArgument_ShouldSetICompositionErrorIdProperty()
- {
- var expectations = Expectations.GetEnumValues<CompositionErrorId>();
-
- foreach (var e in expectations)
- {
- var exception = (ICompositionError)new ComposablePartException(e, "Message", ElementFactory.Create(), new Exception());
-
- Assert.AreEqual(e, exception.Id);
- }
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetElementPropertyToNull()
- {
- var exception = new ComposablePartException();
-
- Assert.IsNull(exception.Element);
- }
-
- [TestMethod]
- public void Constructor2_ShouldSetElementPropertyToNull()
- {
- var exception = new ComposablePartException("Message");
-
- Assert.IsNull(exception.Element);
- }
-
- [TestMethod]
- public void Constructor3_NullAsElementArgument_ShouldSetElementPropertyToNull()
- {
- var exception = new ComposablePartException("Message", (ICompositionElement)null);
-
- Assert.IsNull(exception.Element);
- }
-
- [TestMethod]
- public void Constructor4_ShouldSetElementPropertyToNull()
- {
- var exception = new ComposablePartException("Message", new Exception());
-
- Assert.IsNull(exception.Element);
- }
-
- [TestMethod]
- public void Constructor5_NullAsElementArgument_ShouldSetElementPropertyToNull()
- {
- var exception = new ComposablePartException("Message", (ICompositionElement)null, new Exception());
-
- Assert.IsNull(exception.Element);
- }
-
- [TestMethod]
- public void Constructor6_ShouldSetElementPropertyToNull()
- {
- var exception = new ComposablePartException(CompositionErrorId.Unknown, "Message");
-
- Assert.IsNull(exception.Element);
- }
-
- [TestMethod]
- public void Constructor7_ShouldSetElementPropertyToNull()
- {
- var exception = new ComposablePartException(CompositionErrorId.Unknown, "Message", new Exception());
-
- Assert.IsNull(exception.Element);
- }
-
- [TestMethod]
- public void Constructor8_NullAsElementArgument_ShouldSetElementPropertyToNull()
- {
- var exception = new ComposablePartException(CompositionErrorId.Unknown, "Message", (ICompositionElement)null);
-
- Assert.IsNull(exception.Element);
- }
-
- [TestMethod]
- public void Constructor9_NullAsElementArgument_ShouldSetElementPropertyToNull()
- {
- var exception = new ComposablePartException(CompositionErrorId.Unknown, "Message", (ICompositionElement)null, new Exception());
-
- Assert.IsNull(exception.Element);
- }
-
- [TestMethod]
- public void Constructor3_ValueAsElementArgument_ShouldSetElementProperty()
- {
- var expectations = Expectations.GetCompositionElements();
-
- foreach (var e in expectations)
- {
- var exception = new ComposablePartException("Message", (ICompositionElement)e);
-
- Assert.AreSame(e, exception.Element);
- }
- }
-
- [TestMethod]
- public void Constructor5_ValueAsElementArgument_ShouldSetElementProperty()
- {
- var expectations = Expectations.GetCompositionElements();
-
- foreach (var e in expectations)
- {
- var exception = new ComposablePartException("Message", (ICompositionElement)e, new Exception());
-
- Assert.AreSame(e, exception.Element);
- }
- }
-
- [TestMethod]
- public void Constructor8_ValueAsElementArgument_ShouldSetElementProperty()
- {
- var expectations = Expectations.GetCompositionElements();
-
- foreach (var e in expectations)
- {
- var exception = new ComposablePartException(CompositionErrorId.Unknown, "Message", (ICompositionElement)e);
-
- Assert.AreSame(e, exception.Element);
- }
- }
-
- [TestMethod]
- public void Constructor9_ValueAsElementArgument_ShouldSetElementProperty()
- {
- var expectations = Expectations.GetCompositionElements();
-
- foreach (var e in expectations)
- {
- var exception = new ComposablePartException(CompositionErrorId.Unknown, "Message", (ICompositionElement)e, new Exception());
-
- Assert.AreSame(e, exception.Element);
- }
- }
-
-#if !SILVERLIGHT
-
- [TestMethod]
- public void Constructor10_NullAsInfoArgument_ShouldThrowArgumentNull()
- {
- var context = new StreamingContext();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("info", () =>
- {
- SerializationTestServices.Create<ComposablePartException>((SerializationInfo)null, context);
- });
- }
-
- [TestMethod]
- public void Constructor10_SerializationInfoWithMissingIdEntryAsInfoArgument_ShouldThrowSerialization()
- {
- var info = SerializationTestServices.CreateSerializationInfoRemovingMember<ComposablePartException>("Id");
- var context = new StreamingContext();
-
- ExceptionAssert.ThrowsSerialization("Id", () =>
- {
- SerializationTestServices.Create<ComposablePartException>(info, context);
- });
- }
-
- [TestMethod]
- public void Constructor10_SerializationInfoWithMissingElementEntryAsInfoArgument_ShouldThrowSerialization()
- {
- var info = SerializationTestServices.CreateSerializationInfoRemovingMember<ComposablePartException>("Element");
- var context = new StreamingContext();
-
- ExceptionAssert.ThrowsSerialization("Element", () =>
- {
- SerializationTestServices.Create<ComposablePartException>(info, context);
- });
- }
-
- [TestMethod]
- public void Constructor10_SerializationInfoWithWrongTypeForIdEntryAsInfoArgument_ShouldThrowInvalidCast()
- {
- var info = SerializationTestServices.CreateSerializationInfoReplacingMember<ComposablePartException>("Id", "InvalidValue");
- var context = new StreamingContext();
-
- ExceptionAssert.Throws<InvalidCastException>(() =>
- {
- SerializationTestServices.Create<ComposablePartException>(info, context);
- });
- }
-
- [TestMethod]
- public void Constructor10_SerializationInfoWithWrongTypeForElementEntryAsInfoArgument_ShouldThrowInvalidCast()
- {
- var info = SerializationTestServices.CreateSerializationInfoReplacingMember<ComposablePartException>("Element", 10);
- var context = new StreamingContext();
-
- ExceptionAssert.Throws<InvalidCastException>(() =>
- {
- SerializationTestServices.Create<ComposablePartException>(info, context);
- });
- }
-
- [TestMethod]
- public void Id_CanBeSerialized()
- {
- var expectations = Expectations.GetEnumValues<CompositionErrorId>();
-
- foreach (var e in expectations)
- {
- var exception = (ICompositionError)CreateComposablePartException(e);
-
- var result = (ICompositionError)SerializationTestServices.RoundTrip(exception);
-
- Assert.AreEqual(exception.Id, result.Id);
- }
- }
-
- [TestMethod]
- public void Element_CanBeSerialized()
- {
- var expectations = Expectations.GetCompositionElementsWithNull();
-
- foreach (var e in expectations)
- {
- var exception = CreateComposablePartException(e);
-
- var result = SerializationTestServices.RoundTrip(exception);
-
- ElementAssert.AreEqual(exception.Element, result.Element);
- }
- }
-
- [TestMethod]
- public void InnerException_CanBeSerialized()
- {
- var expectations = Expectations.GetInnerExceptions();
-
- foreach (var e in expectations)
- {
- var exception = CreateComposablePartException(e);
-
- var result = SerializationTestServices.RoundTrip(exception);
-
- ExtendedAssert.IsInstanceOfSameType(exception.InnerException, result.InnerException);
- }
- }
-
- [TestMethod]
- public void Message_CanBeSerialized()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = CreateComposablePartException(e);
-
- var result = SerializationTestServices.RoundTrip(exception);
-
- Assert.AreEqual(exception.Message, result.Message);
- }
- }
-
-#endif
-
- private static ComposablePartException CreateComposablePartException()
- {
- return CreateComposablePartException(CompositionErrorId.Unknown, (string)null, (ICompositionElement)null, (Exception)null);
- }
-
- private static ComposablePartException CreateComposablePartException(string message)
- {
- return CreateComposablePartException(CompositionErrorId.Unknown, message, (ICompositionElement)null, (Exception)null);
- }
-
- private static ComposablePartException CreateComposablePartException(CompositionErrorId id)
- {
- return CreateComposablePartException(CompositionErrorId.Unknown, (string)null, (ICompositionElement)null, (Exception)null);
- }
-
- private static ComposablePartException CreateComposablePartException(ICompositionElement element)
- {
- return CreateComposablePartException(CompositionErrorId.Unknown, (string)null, element, (Exception)null);
- }
-
- private static ComposablePartException CreateComposablePartException(Exception innerException)
- {
- return CreateComposablePartException(CompositionErrorId.Unknown, (string)null, (ICompositionElement)null, innerException);
- }
-
- private static ComposablePartException CreateComposablePartException(CompositionErrorId id, string message, ICompositionElement element, Exception innerException)
- {
- return new ComposablePartException(id, message, element, innerException);
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ComposablePartExtensibilityTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ComposablePartExtensibilityTests.cs deleted file mode 100644 index a1950429b7e..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ComposablePartExtensibilityTests.cs +++ /dev/null @@ -1,292 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.Linq;
-using System.Reflection;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.UnitTesting;
-using System.UnitTesting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class ComposablePartExtensibilityTests
- {
- [TestMethod]
- public void PhaseTest()
- {
- CompositionContainer container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
-
- var part = new OrderingTestComposablePart();
- part.AddImport("Import1", ImportCardinality.ExactlyOne, true, false);
- part.AddExport("Export1", 1);
- part.CallOrder.Enqueue("Import:Import1");
- part.CallOrder.Enqueue("OnComposed");
-
- batch.AddExportedValue("Import1", 20);
- batch.AddPart(part);
- container.Compose(batch);
-
- // Export shouldn't be called until it is pulled on by someone.
- var export = container.GetExport<object>("Export1");
-
- part.CallOrder.Enqueue("Export:Export1");
- Assert.AreEqual(1, export.Value);
-
- Assert.IsTrue(part.CallOrder.Count == 0);
- }
-
- [TestMethod]
- public void ImportTest()
- {
- var exporter = new TestExportBinder();
- var importer = new TestImportBinder();
-
- CompositionContainer container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
-
- batch.AddPart(importer);
- batch.AddPart(exporter);
- container.Compose(batch);
-
- ExportsAssert.AreEqual(importer.SetImports["single"], 42);
- ExportsAssert.AreEqual(importer.SetImports["multi"], 1, 2, 3);
- }
-
- [TestMethod]
- public void ConstructorInjectionSimpleCase()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
-
- batch.AddPart(new ConstructorInjectionComposablePart(typeof(Foo)));
- batch.AddExportedValue<IBar>(new Bar("Bar Value"));
- container.Compose(batch);
-
- var import = container.GetExport<Foo>();
- var foo = import.Value;
-
- Assert.AreEqual("Bar Value", foo.Bar.Value);
- }
-
- [TestMethod]
- public void ConstructorInjectionCycle()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
-
- batch.AddPart(new ConstructorInjectionComposablePart(typeof(AClass)));
- batch.AddPart(new ConstructorInjectionComposablePart(typeof(BClass)));
-
- CompositionAssert.ThrowsErrors(ErrorId.ImportEngine_PartCannotSetImport,
- ErrorId.ImportEngine_PartCannotSetImport, RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
- }
-
- internal class OrderingTestComposablePart : ConcreteComposablePart
- {
- public Queue<string> CallOrder = new Queue<string>();
-
- public OrderingTestComposablePart()
- {
- }
-
- public new void AddExport(string contractName, object value)
- {
- var export = ExportFactory.Create(contractName, () =>
- {
- this.OnGetExport(contractName); return value;
- });
-
- base.AddExport(export);
- }
-
- private void OnGetExport(string contractName)
- {
- Assert.AreEqual("Export:" + contractName, CallOrder.Dequeue());
- }
-
- public override void SetImport(ImportDefinition definition, IEnumerable<Export> exports)
- {
- ContractBasedImportDefinition contractBasedImportDefinition = (ContractBasedImportDefinition)definition;
- Assert.AreEqual("Import:" + contractBasedImportDefinition.ContractName, CallOrder.Dequeue());
- base.SetImport(definition, exports);
- }
-
- public override void Activate()
- {
- Assert.AreEqual("OnComposed", CallOrder.Dequeue());
- base.Activate();
- }
- }
-
- internal class TestExportBinder : ConcreteComposablePart
- {
- public TestExportBinder()
- {
- AddExport("single", 42);
- AddExport("multi", 1);
- AddExport("multi", 2);
- AddExport("multi", 3);
- }
- }
-
- internal class TestImportBinder : ConcreteComposablePart
- {
- public TestImportBinder()
- {
- AddImport("single", ImportCardinality.ExactlyOne, true, false);
- AddImport("multi", ImportCardinality.ZeroOrMore, true, false);
- }
- }
-
- public class Foo
- {
- public Foo(IBar bar)
- {
- Bar = bar;
- }
-
- public IBar Bar { get; private set; }
- }
-
- public interface IBar
- {
- string Value { get; }
- }
-
- public class Bar : IBar
- {
- public Bar(string value)
- {
- Value = value;
- }
- public string Value { get; private set; }
- }
-
- public class FooBar
- {
- [Import("Foo")]
- public Foo Foo { get; set; }
- }
-
- public class AClass
- {
- public AClass(BClass b)
- {
- }
-
- public BClass B { get; private set; }
- }
-
- public class BClass
- {
- public BClass(AClass a)
- {
- this.A = a;
- }
-
- public AClass A { get; private set; }
- }
-
- internal class ConstructorInjectionComposablePart : ConcreteComposablePart
- {
- private Type _type;
- private ConstructorInfo _constructor;
- private Dictionary<ImportDefinition, object> _imports;
- private bool currentlyExecuting = false;
-
- public ConstructorInjectionComposablePart(Type type)
- {
- this._type = type;
-
- // Note that this just blindly takes the first constructor...
- this._constructor = this._type.GetConstructors().FirstOrDefault();
- Assert.IsNotNull(this._constructor);
-
- foreach (var param in this._constructor.GetParameters())
- {
- string name = AttributedModelServices.GetContractName(param.ParameterType);
- AddImport(name, ImportCardinality.ExactlyOne, true, true);
- }
-
- string contractName = AttributedModelServices.GetContractName(type);
- string typeIdentity = AttributedModelServices.GetTypeIdentity(type);
- var metadata = new Dictionary<string, object>();
- metadata.Add(CompositionConstants.ExportTypeIdentityMetadataName, typeIdentity);
-
- Export composableExport = ExportFactory.Create(
- contractName,
- metadata,
- GetInstance);
- this.AddExport(composableExport);
-
- this._imports = new Dictionary<ImportDefinition, object>();
- }
-
- private object GetInstance()
- {
- var result = CompositionResult.SucceededResult;
-
- // We only need this guard if we are pulling on the lazy exports during this call
- // but if we do the pulling in SetImport it isn't needed.
- //if (currentlyExecuting)
- //{
- // var issue = CompositionError.Create("CM:CreationCycleDetected",
- // "This failed because there is a creation cycle");
- // return result.MergeIssue(issue).ToResult<object>(null);
- //}
-
- try
- {
- currentlyExecuting = true;
-
- List<object> constructorArgs = new List<object>();
-
- foreach (ImportDefinition import in this.ImportDefinitions
- .Where(i => i.IsPrerequisite))
- {
- object importValue;
- if (!this._imports.TryGetValue(import, out importValue))
- {
- result = result.MergeError(CompositionError.Create(CompositionErrorId.ImportNotSetOnPart,
- "The import '{0}' is required for construction of '{1}'", import.ToString(), _type.FullName));
-
- continue;
- }
-
- constructorArgs.Add(importValue);
- }
-
- if (!result.Succeeded)
- {
- throw new CompositionException(result.Errors);
- }
-
- object obj = this._constructor.Invoke(constructorArgs.ToArray());
-
- return obj;
- }
- finally
- {
- currentlyExecuting = false;
- }
- }
-
- public override void SetImport(ImportDefinition definition, IEnumerable<Export> exports)
- {
- _imports[definition] = exports.First().Value;
- }
- }
-}
-
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ComposablePartTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ComposablePartTests.cs deleted file mode 100644 index bab987db6f3..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ComposablePartTests.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Factories;
-using System.Linq;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class ComposablePartTests
- {
- [TestMethod]
- public void Constructor1_ShouldSetMetadataPropertyToEmptyDictionary()
- {
- var part = PartFactory.Create();
-
- EnumerableAssert.IsEmpty(part.Metadata);
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetMetadataPropertyToReadOnlyDictionary()
- {
- var part = PartFactory.Create();
-
- ExceptionAssert.Throws<NotSupportedException>(() =>
- {
- part.Metadata["Value"] = "Value";
- });
- }
-
- [TestMethod]
- public void OnComposed_DoesNotThrow()
- {
- var part = PartFactory.Create();
- part.Activate();
- }
-
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionContainerCollectionTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionContainerCollectionTests.cs deleted file mode 100644 index 1f4b0233ede..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionContainerCollectionTests.cs +++ /dev/null @@ -1,929 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.ComponentModel.Composition;
-using System.Linq;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Factories;
-using System.UnitTesting;
-using System.ComponentModel.Composition.UnitTesting;
-using System.ComponentModel.Composition.Hosting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class CompositionContainerCollectionTests
- {
- public class SupportedImportCollectionAssignments<T>
- {
- // Fields
- [ImportMany("Value")]
- public IEnumerable<T> IEnumerableOfTField;
-
- [ImportMany("Value")]
- public IEnumerable<object> IEnumerableOfObjectField;
-
- [ImportMany("Value")]
- public T[] ArrayOfTField;
-
- [ImportMany("Value")]
- public object[] ArrayOfObjectField;
-
- [ImportMany("Value")]
- public IEnumerable<T> IEnumerableOfTProperty { get; set; }
-
- [ImportMany("Value")]
- public IEnumerable<object> IEnumerableOfObjectProperty { get; set; }
-
- [ImportMany("Value")]
- public T[] ArrayOfTProperty { get; set; }
-
- [ImportMany("Value")]
- public object[] ArrayOfObjectProperty { get; set; }
-
- public void VerifyImports(params T[] expectedValues)
- {
- // Fields
- EnumerableAssert.AreEqual(IEnumerableOfTField, expectedValues);
- EnumerableAssert.AreEqual(IEnumerableOfObjectField, expectedValues.Cast<object>());
- EnumerableAssert.AreEqual(ArrayOfTField, expectedValues);
- EnumerableAssert.AreEqual(ArrayOfObjectField, expectedValues.Cast<object>());
-
- // Properties
- EnumerableAssert.AreEqual(IEnumerableOfTProperty, expectedValues);
- EnumerableAssert.AreEqual(IEnumerableOfObjectProperty, expectedValues.Cast<object>());
- EnumerableAssert.AreEqual(ArrayOfTProperty, expectedValues);
- EnumerableAssert.AreEqual(ArrayOfObjectProperty, expectedValues.Cast<object>());
- }
- }
-
- [TestMethod]
- public void ValidateSupportedImportCollectionAssignments()
- {
- var container = ContainerFactory.Create();
- var batch = new CompositionBatch();
-
- var importer = new SupportedImportCollectionAssignments<int>();
-
- batch.AddPart(importer);
- batch.AddExportedValue("Value", 21);
- batch.AddExportedValue("Value", 32);
- batch.AddExportedValue("Value", 43);
-
- container.Compose(batch);
-
- importer.VerifyImports(21, 32, 43);
- }
-
- public class SupportedImportCollectionMutation<T>
- {
- public SupportedImportCollectionMutation()
- {
- ICollectionOfTReadOnlyField = new List<T>();
- ListOfTReadOnlyField = new List<T>();
- CollectionOfTField = new Collection<T>();
- CollectionOfTReadOnlyField = new Collection<T>();
-
- _iCollectionOfTReadOnlyProperty = new List<T>();
- _listOfTReadOnlyProperty = new List<T>();
- CollectionOfTProperty = new Collection<T>();
- _collectionOfTReadOnlyProperty = new Collection<T>();
-
-#if !SILVERLIGHT
- ObservableCollectionOfTReadOnlyField = new ObservableCollection<T>();
- _observableCollectionOfTReadOnlyProperty = new ObservableCollection<T>();
-#endif // !SILVERLIGHT
- }
-
- [ImportMany("Value")]
- public readonly ICollection<T> ICollectionOfTReadOnlyField;
-
- [ImportMany("Value")]
- public List<T> ListOfTField;
-
- [ImportMany("Value")]
- public readonly List<T> ListOfTReadOnlyField;
-
- [ImportMany("Value")]
- public Collection<T> CollectionOfTField;
-
- [ImportMany("Value")]
- public Collection<object> CollectionOfObjectField;
-
- [ImportMany("Value")]
- public readonly Collection<T> CollectionOfTReadOnlyField;
-
- [ImportMany("Value")]
- public ICollection<T> ICollectionOfTReadOnlyProperty { get { return _iCollectionOfTReadOnlyProperty; } }
- private ICollection<T> _iCollectionOfTReadOnlyProperty;
-
- [ImportMany("Value")]
- public List<T> ListOfTProperty { get; set; }
-
- [ImportMany("Value")]
- public List<T> ListOfTReadOnlyProperty { get { return _listOfTReadOnlyProperty; } }
- private readonly List<T> _listOfTReadOnlyProperty;
-
- [ImportMany("Value")]
- public Collection<T> CollectionOfTProperty { get; set; }
-
- [ImportMany("Value")]
- public Collection<T> CollectionOfTReadOnlyProperty { get { return _collectionOfTReadOnlyProperty; } }
- private readonly Collection<T> _collectionOfTReadOnlyProperty;
-
-#if !SILVERLIGHT
- [ImportMany("Value")]
- public ObservableCollection<T> ObservableCollectionOfTField;
-
- [ImportMany("Value")]
- public readonly ObservableCollection<T> ObservableCollectionOfTReadOnlyField;
-
- [ImportMany("Value")]
- public ObservableCollection<T> ObservableCollectionOfTProperty { get; set; }
-
- [ImportMany("Value")]
- public ObservableCollection<T> ObservableCollectionOfTReadOnlyProperty { get { return _observableCollectionOfTReadOnlyProperty; } }
- private readonly ObservableCollection<T> _observableCollectionOfTReadOnlyProperty;
-#endif // !SILVERLIGHT
-
- public void VerifyImports(params T[] expectedValues)
- {
- EnumerableAssert.AreEqual(ICollectionOfTReadOnlyField, expectedValues);
- EnumerableAssert.AreEqual(ListOfTField, expectedValues);
- EnumerableAssert.AreEqual(ListOfTReadOnlyField, expectedValues);
- EnumerableAssert.AreEqual(CollectionOfTField, expectedValues);
- EnumerableAssert.AreEqual(CollectionOfTReadOnlyField, expectedValues);
-
- EnumerableAssert.AreEqual(ICollectionOfTReadOnlyProperty, expectedValues);
- EnumerableAssert.AreEqual(ListOfTProperty, expectedValues);
- EnumerableAssert.AreEqual(ListOfTReadOnlyProperty, expectedValues);
- EnumerableAssert.AreEqual(CollectionOfTProperty, expectedValues);
- EnumerableAssert.AreEqual(CollectionOfTReadOnlyProperty, expectedValues);
-
-#if !SILVERLIGHT
- EnumerableAssert.AreEqual(ObservableCollectionOfTField, expectedValues);
- EnumerableAssert.AreEqual(ObservableCollectionOfTReadOnlyField, expectedValues);
- EnumerableAssert.AreEqual(ObservableCollectionOfTProperty, expectedValues);
- EnumerableAssert.AreEqual(ObservableCollectionOfTReadOnlyProperty, expectedValues);
-#endif // !SILVERLIGHT
- }
- }
-
- [TestMethod]
- public void ValidateSupportedImportCollectionMutation()
- {
- var container = ContainerFactory.Create();
- var batch = new CompositionBatch();
-
- var importer = new SupportedImportCollectionMutation<int>();
-
- batch.AddPart(importer);
- batch.AddExportedValue("Value", 21);
- batch.AddExportedValue("Value", 32);
- batch.AddExportedValue("Value", 43);
-
- container.Compose(batch);
-
- importer.VerifyImports(21, 32, 43);
- }
-
- public class ImportCollectionNullValue
- {
- [ImportMany("Value")]
- public List<int> NullValue { get; set; }
- }
-
- public class NamelessImporter
- {
- [ImportMany]
- public int[] ReadWriteIList { get; set; }
-
- [ImportMany]
- public Collection<Lazy<int>> ReadWriteMetadata { get; set; }
- }
-
- public class NamelessExporter
- {
- public NamelessExporter(int value)
- {
- Value = value;
- }
-
- [Export]
- public int Value { get; set; }
- }
-
- [TestMethod]
- public void ImportCollectionsNameless()
- {
- // Verifing that the contract name gets the correct value
- var container = ContainerFactory.Create();
- NamelessImporter importer = new NamelessImporter();
- NamelessExporter exporter42 = new NamelessExporter(42);
- NamelessExporter exporter0 = new NamelessExporter(0);
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddParts(importer, exporter42, exporter0);
- container.Compose(batch);
-
- EnumerableAssert.AreEqual(importer.ReadWriteIList, 42, 0);
- }
-
- public class InvalidImporterReadOnlyEnumerable
- {
- IEnumerable<int> readOnlyEnumerable = new List<int>();
-
- [ImportMany("Value")]
- public IEnumerable<int> ReadOnlyEnumerable
- {
- get
- {
- return readOnlyEnumerable;
- }
- }
- }
-
- [TestMethod]
- public void ImportCollectionsExceptionReadOnlyEnumerable()
- {
- ExpectedErrorOnPartActivate(new InvalidImporterReadOnlyEnumerable(),
- ErrorId.ReflectionModel_ImportCollectionNotWritable);
- }
-
- public class ImporterWriteOnlyExportCollection
- {
- [ImportMany("Value")]
- public Collection<Lazy<int>> WriteOnlyExportCollection
- {
- set { PublicExportCollection = value; }
- }
-
- public Collection<Lazy<int>> PublicExportCollection { get; set; }
- }
-
- [TestMethod]
- public void ImportCollections_WriteOnlyExportCollection()
- {
- var container = ContainerFactory.Create();
- var batch = new CompositionBatch();
-
- var importer = new ImporterWriteOnlyExportCollection();
-
- List<int> values = new List<int>() { 21, 32, 43 };
-
- batch.AddPart(importer);
- values.ForEach(v => batch.AddExportedValue("Value", v));
-
- container.Compose(batch);
-
- EnumerableAssert.AreEqual(values, importer.PublicExportCollection.Select(export => export.Value));
- }
-
- public class ImporterWriteOnlyIEnumerableOfT
- {
- [ImportMany("Value")]
- public IEnumerable<int> WriteOnlyIEnumerable
- {
- set { PublicIEnumerable = value; }
- }
-
- public IEnumerable<int> PublicIEnumerable { get; set; }
- }
-
- [TestMethod]
- public void ImportCollections_WriteOnlyIEnumerableOfT()
- {
- var container = ContainerFactory.Create();
- var batch = new CompositionBatch();
-
- var importer = new ImporterWriteOnlyIEnumerableOfT();
-
- List<int> values = new List<int>() { 21, 32, 43 };
-
- batch.AddPart(importer);
- values.ForEach(v => batch.AddExportedValue("Value", v));
-
- container.Compose(batch);
-
- EnumerableAssert.AreEqual(values, importer.PublicIEnumerable);
- }
-
- public class ImporterWriteOnlyArray
- {
- [ImportMany("Value")]
- public int[] WriteOnlyArray
- {
- set { PublicArray = value; }
- }
-
- public int[] PublicArray { get; set; }
- }
-
- [TestMethod]
- public void ImportCollections_WriteOnlyArray()
- {
- var container = ContainerFactory.Create();
- var batch = new CompositionBatch();
-
- var importer = new ImporterWriteOnlyArray();
-
- List<int> values = new List<int>() { 21, 32, 43 };
-
- batch.AddPart(importer);
- values.ForEach(v => batch.AddExportedValue("Value", v));
-
- container.Compose(batch);
-
- EnumerableAssert.AreEqual(values, importer.PublicArray);
- }
-
- public class InvalidImporterNonCollection
- {
- [Import("Value")]
- public int Value { get; set; }
- }
-
- [TestMethod]
- public void ImportCollectionsExceptionNonCollection()
- {
- ExpectedChangeRejectedErrorOnSetImport(new InvalidImporterNonCollection(),
- ErrorId.ImportEngine_ImportCardinalityMismatch);
- }
-
- public class InvalidImporterNonAssignableCollection
- {
- [ImportMany("Value", typeof(int))]
- public IEnumerable<string> StringCollection { get; set; }
- }
-
- [TestMethod]
- public void ImportCollectionsExceptionNonAssignableCollection()
- {
- ExpectedErrorOnSetImport(new InvalidImporterNonAssignableCollection(),
- ErrorId.ReflectionModel_ImportNotAssignableFromExport);
- }
-
- public class InvalidImporterNullReadOnlyICollection
- {
- ICollection<int> readOnlyICollection = null;
-
- [ImportMany("Value")]
- public ICollection<int> Values { get { return readOnlyICollection; } }
- }
-
- [TestMethod]
- public void ImportCollectionsExceptionNullReadOnlyICollection()
- {
- ExpectedErrorOnPartActivate(new InvalidImporterNullReadOnlyICollection(),
- ErrorId.ReflectionModel_ImportCollectionNull);
- }
-
- public class ImporterWeakIEnumerable
- {
- public ImporterWeakIEnumerable()
- {
- ReadWriteEnumerable = new IntCollection();
- }
-
- [ImportMany("Value")]
- public IntCollection ReadWriteEnumerable { get; set; }
-
- public class IntCollection : IEnumerable
- {
- List<int> ints = new List<int>();
- public void Add(int item) { ints.Add(item); }
- public void Clear() { ints.Clear(); }
- public bool Remove(int item) { return ints.Remove(item); }
- public IEnumerator GetEnumerator() { return ints.GetEnumerator(); }
- }
- }
-
- [TestMethod]
- public void ImportCollectionsExceptionWeakCollectionNotSupportingICollectionOfT()
- {
- ExpectedErrorOnPartActivate(new ImporterWeakIEnumerable(),
- ErrorId.ReflectionModel_ImportCollectionNotWritable);
- }
-
- public class ImporterThrowsOnGetting
- {
- [ImportMany("Value")]
- public List<int> Value
- {
- get
- {
- throw new NotSupportedException();
- }
- }
- }
-
- [TestMethod]
- public void ImportCollectionsExceptionGettingValue()
- {
- var container = ContainerFactory.Create();
- ImporterThrowsOnGetting importer = new ImporterThrowsOnGetting();
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- batch.AddExportedValue("Value", 42);
- batch.AddExportedValue("Value", 0);
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotActivate,
- ErrorId.ReflectionModel_ImportCollectionGetThrewException, RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
-
- public class CustomCollectionThrowsDuringConstruction : Collection<int>
- {
- public CustomCollectionThrowsDuringConstruction()
- {
- throw new NotSupportedException();
- }
- }
-
- public class ImportCustomCollectionThrowsDuringConstruction
- {
- public ImportCustomCollectionThrowsDuringConstruction()
- {
- }
-
- [ImportMany("Value")]
- public CustomCollectionThrowsDuringConstruction Values { get; set; }
- }
-
- [TestMethod]
- public void ImportCollections_ImportTypeThrowsOnConstruction()
- {
- ExpectedErrorOnPartActivate(new ImportCustomCollectionThrowsDuringConstruction(),
- ErrorId.ReflectionModel_ImportCollectionConstructionThrewException);
- }
-
- public class CustomCollectionThrowsDuringClear : Collection<int>
- {
- protected override void ClearItems()
- {
- throw new NotSupportedException();
- }
- }
-
- public class ImportCustomCollectionThrowsDuringClear
- {
- public ImportCustomCollectionThrowsDuringClear()
- {
- }
-
- [ImportMany("Value")]
- public CustomCollectionThrowsDuringClear Values { get; set; }
- }
-
- [TestMethod]
- public void ImportCollections_ImportTypeThrowsOnClear()
- {
- ExpectedErrorOnPartActivate(new ImportCustomCollectionThrowsDuringClear(),
- ErrorId.ReflectionModel_ImportCollectionClearThrewException);
- }
-
- public class CustomCollectionThrowsDuringAdd : Collection<int>
- {
- protected override void InsertItem(int index, int item)
- {
- throw new NotSupportedException();
- }
- }
-
- public class ImportCustomCollectionThrowsDuringAdd
- {
- public ImportCustomCollectionThrowsDuringAdd()
- {
- }
-
- [ImportMany("Value")]
- public CustomCollectionThrowsDuringAdd Values { get; set; }
- }
-
- [TestMethod]
- public void ImportCollections_ImportTypeThrowsOnAdd()
- {
- ExpectedErrorOnPartActivate(new ImportCustomCollectionThrowsDuringAdd(),
- ErrorId.ReflectionModel_ImportCollectionAddThrewException);
- }
-
- public class CustomCollectionThrowsDuringIsReadOnly : ICollection<int>
- {
- void ICollection<int>.Add(int item)
- {
- throw new NotImplementedException();
- }
-
- void ICollection<int>.Clear()
- {
- throw new NotImplementedException();
- }
-
- bool ICollection<int>.Contains(int item)
- {
- throw new NotImplementedException();
- }
-
- void ICollection<int>.CopyTo(int[] array, int arrayIndex)
- {
- throw new NotImplementedException();
- }
-
- int ICollection<int>.Count
- {
- get { throw new NotImplementedException(); }
- }
-
- bool ICollection<int>.IsReadOnly
- {
- get { throw new NotSupportedException(); }
- }
-
- bool ICollection<int>.Remove(int item)
- {
- throw new NotImplementedException();
- }
-
- IEnumerator<int> IEnumerable<int>.GetEnumerator()
- {
- throw new NotImplementedException();
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- throw new NotImplementedException();
- }
- }
-
- public class ImportCustomCollectionThrowsDuringIsReadOnly
- {
- public ImportCustomCollectionThrowsDuringIsReadOnly()
- {
- Values = new CustomCollectionThrowsDuringIsReadOnly();
- }
-
- [ImportMany("Value")]
- public CustomCollectionThrowsDuringIsReadOnly Values { get; set; }
- }
-
- [TestMethod]
- public void ImportCollections_ImportTypeThrowsOnIsReadOnly()
- {
- ExpectedErrorOnPartActivate(new ImportCustomCollectionThrowsDuringIsReadOnly(),
- ErrorId.ReflectionModel_ImportCollectionIsReadOnlyThrewException);
- }
-
- public class CollectionTypeWithNoIList<T> : ICollection<T>
- {
- private int _count = 0;
- public CollectionTypeWithNoIList()
- {
-
- }
-
- public void Add(T item)
- {
- // Do Nothing
- this._count++;
- }
-
- public void Clear()
- {
- // Do Nothings
- }
-
- public bool Contains(T item)
- {
- throw new NotImplementedException();
- }
-
- public void CopyTo(T[] array, int arrayIndex)
- {
- throw new NotImplementedException();
- }
-
- public int Count
- {
- get { return this._count; }
- }
-
- public bool IsReadOnly
- {
- get { return false; }
- }
-
- public bool Remove(T item)
- {
- throw new NotImplementedException();
- }
-
- public IEnumerator<T> GetEnumerator()
- {
- throw new NotImplementedException();
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- throw new NotImplementedException();
- }
- }
-
- public class ImportCollectionWithNoIList
- {
- [ImportMany("Value")]
- public CollectionTypeWithNoIList<int> Values { get; set; }
- }
-
- [TestMethod]
- public void ImportCollections_NoIList_ShouldWorkFine()
- {
- var container = ContainerFactory.Create();
- var batch = new CompositionBatch();
- var importer = new ImportCollectionWithNoIList();
- batch.AddPart(importer);
- batch.AddExportedValue("Value", 42);
- batch.AddExportedValue("Value", 0);
-
- container.Compose(batch);
-
- Assert.AreEqual(2, importer.Values.Count);
- }
-
- public class CollectionWithMultipleInterfaces : ICollection<int>, ICollection<string>
- {
- private int _count = 0;
- public CollectionWithMultipleInterfaces()
- {
-
- }
-
- #region ICollection<int> Members
-
- void ICollection<int>.Add(int item)
- {
- throw new NotImplementedException();
- }
-
- void ICollection<int>.Clear()
- {
- throw new NotImplementedException();
- }
-
- bool ICollection<int>.Contains(int item)
- {
- throw new NotImplementedException();
- }
-
- void ICollection<int>.CopyTo(int[] array, int arrayIndex)
- {
- throw new NotImplementedException();
- }
-
- int ICollection<int>.Count
- {
- get { throw new NotImplementedException(); }
- }
-
- bool ICollection<int>.IsReadOnly
- {
- get { throw new NotImplementedException(); }
- }
-
- bool ICollection<int>.Remove(int item)
- {
- throw new NotImplementedException();
- }
-
- IEnumerator<int> IEnumerable<int>.GetEnumerator()
- {
- throw new NotImplementedException();
- }
-
- #endregion
-
- #region IEnumerable Members
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- throw new NotImplementedException();
- }
-
- #endregion
-
- #region ICollection<string> Members
-
- void ICollection<string>.Add(string item)
- {
- throw new NotImplementedException();
- }
-
- void ICollection<string>.Clear()
- {
- throw new NotImplementedException();
- }
-
- bool ICollection<string>.Contains(string item)
- {
- throw new NotImplementedException();
- }
-
- void ICollection<string>.CopyTo(string[] array, int arrayIndex)
- {
- throw new NotImplementedException();
- }
-
- int ICollection<string>.Count
- {
- get { throw new NotImplementedException(); }
- }
-
- bool ICollection<string>.IsReadOnly
- {
- get { throw new NotImplementedException(); }
- }
-
- bool ICollection<string>.Remove(string item)
- {
- throw new NotImplementedException();
- }
-
- IEnumerator<string> IEnumerable<string>.GetEnumerator()
- {
- throw new NotImplementedException();
- }
-
- #endregion
- }
-
- public class ImportCollectionWithMultipleInterfaces
- {
- [ImportMany("Value")]
- public CollectionWithMultipleInterfaces Values { get; set; }
- }
-
- [TestMethod]
- public void ImportCollections_MultipleICollections_ShouldCauseNotWriteable()
- {
- ExpectedErrorOnPartActivate(new ImportCollectionWithMultipleInterfaces(),
- ErrorId.ReflectionModel_ImportCollectionNotWritable);
- }
-
- public class ImportManyNonCollectionTypeString
- {
- [ImportMany("Value")]
- public string Foo { get; set; }
- }
-
- [TestMethod]
- public void ImportManyOnNonCollectionTypeString_ShouldCauseNotWritable()
- {
- ExpectedErrorOnPartActivate(new ImportManyNonCollectionTypeString(),
- ErrorId.ReflectionModel_ImportCollectionNotWritable);
- }
-
- public class ImportManyNonCollectionTypeObject
- {
- [ImportMany("Value")]
- public object Foo { get; set; }
- }
-
- [TestMethod]
- public void ImportManyOnNonCollectionTypeObject_ShouldCauseNotWritable()
- {
- ExpectedErrorOnPartActivate(new ImportManyNonCollectionTypeObject(),
- ErrorId.ReflectionModel_ImportCollectionNotWritable);
- }
-
-#if !SILVERLIGHT
- // SILVERLIGHT doesn't have SetEnvironmentVariable set in this test.
- public class ExportADictionaryObject
- {
- [Export]
- public IDictionary<string, object> MyDictionary
- {
- get
- {
- var dictionary = new Dictionary<string, object>();
- dictionary.Add("a", 42);
- dictionary.Add("b", "c");
- return dictionary;
- }
- }
- }
-
- public class ImportADictionaryObject
- {
- [Import]
- public IDictionary<string, object> MyDictionary { get; set; }
- }
-
- [TestMethod]
- public void ImportDictionaryAsSingleObject()
- {
- // Set variable to ensure the hack is turned off.
- Environment.SetEnvironmentVariable("ONLY_ALLOW_IMPORTMANY", "1");
-
- var container = ContainerFactory.Create();
- var batch = new CompositionBatch();
- var importer = new ImportADictionaryObject();
- var exporter = new ExportADictionaryObject();
-
- batch.AddPart(importer);
- batch.AddPart(exporter);
- container.Compose(batch);
-
- Assert.AreEqual(2, importer.MyDictionary.Count);
- }
-
- public class ExportACollectionObject
- {
- [Export]
- public Collection<string> MyCollection
- {
- get
- {
- var collection = new Collection<string>();
- collection.Add("a");
- collection.Add("b");
- return collection;
- }
- }
- }
-
- public class ImportACollectionObject
- {
- [Import]
- public Collection<string> MyCollection { get; set; }
- }
-
- [TestMethod]
- public void ImportCollectionAsSingleObject()
- {
- // Set variable to ensure the hack is turned off.
- Environment.SetEnvironmentVariable("ONLY_ALLOW_IMPORTMANY", "1");
-
- var container = ContainerFactory.Create();
- var batch = new CompositionBatch();
- var importer = new ImportACollectionObject();
- var exporter = new ExportACollectionObject();
-
- batch.AddPart(importer);
- batch.AddPart(exporter);
- container.Compose(batch);
-
- Assert.AreEqual(2, importer.MyCollection.Count);
- }
-#endif
-
- public void ExpectedErrorOnPartActivate(object importer, ErrorId expectedErrorId)
- {
- var container = ContainerFactory.Create();
- var batch = new CompositionBatch();
- batch.AddPart(importer);
- batch.AddExportedValue("Value", 42);
- batch.AddExportedValue("Value", 0);
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotActivate,
- expectedErrorId, RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
-
- public void ExpectedErrorOnSetImport(object importer, ErrorId expectedErrorId)
- {
- var container = ContainerFactory.Create();
- var batch = new CompositionBatch();
- batch.AddPart(importer);
- batch.AddExportedValue("Value", 42);
- batch.AddExportedValue("Value", 0);
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotSetImport,
- expectedErrorId, RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
-
- public void ExpectedChangeRejectedErrorOnSetImport(object importer, ErrorId expectedErrorId)
- {
- var container = ContainerFactory.Create();
- var batch = new CompositionBatch();
- batch.AddPart(importer);
- batch.AddExportedValue("Value", 42);
- batch.AddExportedValue("Value", 0);
-
- CompositionAssert.ThrowsChangeRejectedError(ErrorId.ImportEngine_PartCannotSetImport,
- expectedErrorId, RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionContainerCycleTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionContainerCycleTests.cs Binary files differdeleted file mode 100644 index d7c0a685587..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionContainerCycleTests.cs +++ /dev/null diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionContainerExtensibilityTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionContainerExtensibilityTests.cs deleted file mode 100644 index f088200809b..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionContainerExtensibilityTests.cs +++ /dev/null @@ -1,81 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.Linq;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class CompositionContainerExtensibilityTests
- {
- [TestMethod]
- public void Dispose_DoesNotThrow()
- {
- var container = CreateCustomCompositionContainer();
- container.Dispose();
- }
-
- [TestMethod]
- public void DerivedCompositionContainer_CanExportItself()
- {
- var container = CreateCustomCompositionContainer();
- container.AddAndComposeExportedValue<CustomCompositionContainer>(container);
-
- Assert.AreSame(container, container.GetExportedValue<CustomCompositionContainer>());
- }
-
- [TestMethod]
- public void ICompositionService_CanBeExported()
- {
- var container = CreateCustomCompositionContainer();
- container.AddAndComposeExportedValue<ICompositionService>(container);
-
- Assert.AreSame(container, container.GetExportedValue<ICompositionService>());
- }
-
- [TestMethod]
- public void CompositionContainer_CanBeExported()
- {
- var container = CreateCustomCompositionContainer();
- container.AddAndComposeExportedValue<CompositionContainer>(container);
-
- Assert.AreSame(container, container.GetExportedValue<CompositionContainer>());
- }
-
- [TestMethod]
- public void CanBeCollectedAfterDispose()
- {
- AggregateExportProvider exportProvider = new AggregateExportProvider();
- var catalog = new AggregateCatalog(CatalogFactory.CreateDefaultAttributed());
- var container = new CompositionContainer(catalog, exportProvider);
-
- WeakReference weakContainer = new WeakReference(container);
- container.Dispose();
- container = null;
-
- GC.Collect();
- GC.WaitForPendingFinalizers();
-
- Assert.IsFalse(weakContainer.IsAlive);
-
- GC.KeepAlive(exportProvider);
- GC.KeepAlive(catalog);
- }
-
- private CustomCompositionContainer CreateCustomCompositionContainer()
- {
- return new CustomCompositionContainer();
- }
-
- // Type needs to be public otherwise container.GetExportedValue<CustomCompositionContainer>
- // fails on Silverlight because it cannot construct a Lazy<T,M> factory.
- public class CustomCompositionContainer : CompositionContainer
- {
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionContainerExtensions.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionContainerExtensions.cs deleted file mode 100644 index 3a5af3d9e0e..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionContainerExtensions.cs +++ /dev/null @@ -1,86 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.Linq;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition
-{
- internal static class CompositionContainerExtensions
- {
- public static bool IsPresent<T>(this ExportProvider container)
- {
- try
- {
- container.GetExportedValue<T>();
- return true;
- }
- catch (ImportCardinalityMismatchException)
- {
- return false;
- }
- }
-
- public static bool IsPresent(this ExportProvider container, string contractName)
- {
- try
- {
- container.GetExportedValue<object>(contractName);
- return true;
- }
- catch (ImportCardinalityMismatchException)
- {
- return false;
- }
- }
-
- public static void AddAndComposeExportedValue<T>(this CompositionContainer container, T exportedValue)
- {
- var batch = new CompositionBatch();
- batch.AddExportedValue<T>(exportedValue);
- container.Compose(batch);
- }
-
- public static void AddAndComposeExportedValue<T>(this CompositionContainer container, string contractName, T exportedValue)
- {
- var batch = new CompositionBatch();
- batch.AddExportedValue<T>(contractName, exportedValue);
- container.Compose(batch);
- }
-
- public static void AddParts(this CompositionBatch batch, params object[] parts)
- {
- foreach (object instance in parts)
- {
- ComposablePart part = instance as ComposablePart;
- if (part != null)
- {
- batch.AddPart(part);
- }
- else
- {
- batch.AddPart((object)instance);
- }
- }
- }
-
- public static ComposablePart AddExportedValue(this CompositionBatch batch, string contractName, Type contractType, object exportedValue)
- {
- string typeIdentity = AttributedModelServices.GetTypeIdentity(contractType);
-
- IDictionary<string, object> metadata = null;
-
- if (typeIdentity != null)
- {
- metadata = new Dictionary<string, object>();
- metadata.Add(CompositionConstants.ExportTypeIdentityMetadataName, typeIdentity);
- }
-
- return batch.AddExport(new Export(contractName, metadata, () => exportedValue));
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionContainerImportTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionContainerImportTests.cs deleted file mode 100644 index 3c99bdc85a9..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionContainerImportTests.cs +++ /dev/null @@ -1,769 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.UnitTesting;
-using System.Linq;
-using System.Runtime.InteropServices;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class CompositionContainerImportTests
- {
- // Exporting collectin values is not supported
- [TestMethod]
- public void ImportValues()
- {
- var container = ContainerFactory.Create();
- Importer importer = new Importer();
- Exporter exporter42 = new Exporter(42);
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- batch.AddPart(exporter42);
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotSetImport,
- ErrorId.ReflectionModel_ImportNotAssignableFromExport, RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
-
- [TestMethod]
- public void ImportSingle()
- {
- var container = ContainerFactory.Create();
- var importer = new Int32Importer();
- var exporter = new Int32Exporter(42);
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- batch.AddPart(exporter);
- container.Compose(batch);
-
- Assert.AreEqual(42, importer.Value, "Expecting value to be imported");
-
- }
-
- [TestMethod]
- public void ImportSingleFromInternal()
- {
- var container = ContainerFactory.Create();
- var importer = new Int32Importer();
- var exporter = new Int32ExporterInternal(42);
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- batch.AddPart(exporter);
- container.Compose(batch);
-
- Assert.AreEqual(42, importer.Value, "Expecting value to be imported");
- }
-
- [TestMethod]
- public void ImportSingleToInternal()
- {
- var container = ContainerFactory.Create();
- var importer = new Int32ImporterInternal();
- var exporter = new Int32Exporter(42);
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- batch.AddPart(exporter);
- container.Compose(batch);
-
- Assert.AreEqual(42, importer.Value, "Expecting value to be imported");
- }
-
- [TestMethod]
- public void ImportSingleIntoCollection()
- {
- var container = ContainerFactory.Create();
- var importer = new Int32CollectionImporter();
- var exporter = new Int32Exporter(42);
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- batch.AddPart(exporter);
- container.Compose(batch);
-
- EnumerableAssert.AreEqual(importer.Values, 42);
- }
-
- [TestMethod]
- public void ImportValuesNameless()
- {
- var container = ContainerFactory.Create();
- ImporterNameless importer;
- ExporterNameless exporter42 = new ExporterNameless(42);
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer = new ImporterNameless());
- batch.AddPart(exporter42);
- container.Compose(batch);
-
- Assert.AreEqual(42, importer.ValueReadWrite);
- Assert.AreEqual(42, importer.MetadataReadWrite.Value);
- }
-
- [TestMethod]
- public void ImportValueExceptionMissing()
- {
- var container = ContainerFactory.Create();
- Importer importer;
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer = new Importer());
-
- CompositionAssert.ThrowsChangeRejectedError(ErrorId.ImportEngine_PartCannotSetImport,
- ErrorId.ImportEngine_ImportCardinalityMismatch,
- RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
-
- [TestMethod]
- public void ImportValueExceptionMultiple()
- {
- var container = ContainerFactory.Create();
- Importer importer = new Importer();
- Exporter exporter42 = new Exporter(42);
- Exporter exporter6 = new Exporter(6);
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- batch.AddPart(exporter42);
- batch.AddPart(exporter6);
-
- CompositionAssert.ThrowsChangeRejectedError(ErrorId.ImportEngine_PartCannotSetImport,
- RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
-
- [TestMethod]
- public void ImportValueExceptionSetterException()
- {
- var container = ContainerFactory.Create();
- ImporterInvalidSetterException importer = new ImporterInvalidSetterException();
- Exporter exporter42 = new Exporter(42);
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- batch.AddPart(exporter42);
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotActivate,
- ErrorId.ReflectionModel_ImportThrewException,
- RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
-
- [TestMethod]
- public void ImportValueExceptionLazily()
- {
- var catalog = new AssemblyCatalog(typeof(ImportImporterInvalidSetterExceptionLazily).Assembly);
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(ImportImporterInvalidSetterExceptionLazily), typeof(ImporterInvalidSetterException));
- var invalidLazy = container.GetExportedValue<ImportImporterInvalidSetterExceptionLazily>();
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotGetExportedValue,
- ErrorId.ImportEngine_PartCannotActivate,
- ErrorId.ReflectionModel_ImportThrewException, RetryMode.DoNotRetry, () =>
- {
- var value = invalidLazy.Value.Value;
- });
- }
-
-#if !SILVERLIGHT
-
- [TestMethod]
- public void ImportValueComComponent()
- {
- CTaskScheduler scheduler = new CTaskScheduler();
-
- try
- {
- var container = ContainerFactory.Create();
- var importer = new ImportComComponent();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddParts(importer);
- batch.AddExportedValue<ITaskScheduler>("TaskScheduler", (ITaskScheduler)scheduler);
-
- container.Compose(batch);
-
- Assert.AreEqual(scheduler, importer.TaskScheduler);
- }
- finally
- {
- Marshal.ReleaseComObject(scheduler);
- }
- }
-
- [TestMethod]
- public void DelayImportValueComComponent()
- {
- CTaskScheduler scheduler = new CTaskScheduler();
-
- try
- {
- var container = ContainerFactory.Create();
- var importer = new DelayImportComComponent();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddParts(importer);
- batch.AddExportedValue<ITaskScheduler>("TaskScheduler", (ITaskScheduler)scheduler);
-
- container.Compose(batch);
-
- Assert.AreEqual(scheduler, importer.TaskScheduler.Value);
- }
- finally
- {
- Marshal.ReleaseComObject(scheduler);
- }
- }
-#endif
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void OptionalImportsOfValueTypesAreBoundToDefaultWhenNotSatisfied()
- {
- var container = ContainerFactory.Create();
- var importer = new OptionalImport();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- container.Compose(batch);
-
- Assert.AreEqual(1, importer.ValueTypeSetCount);
- Assert.AreEqual(0, importer.ValueType);
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void OptionalImportsOfNullableValueTypesAreBoundToDefaultWhenNotSatisfied()
- {
- var container = ContainerFactory.Create();
- var importer = new OptionalImport();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- container.Compose(batch);
-
- Assert.AreEqual(1, importer.NullableValueTypeSetCount);
- Assert.IsNull(importer.NullableValueType);
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void OptionalImportsOfReferenceTypesAreBoundToDefaultWhenNotSatisfied()
- {
- var container = ContainerFactory.Create();
- var importer = new OptionalImport();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- container.Compose(batch);
-
- Assert.AreEqual(1, importer.ReferenceTypeSetCount);
- Assert.IsNull(importer.ReferenceType);
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void OptionalImportsOfExportValueTypesAreBoundToDefaultWhenNotSatisfied()
- {
- var container = ContainerFactory.Create();
- var importer = new OptionalExport();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- container.Compose(batch);
-
- Assert.AreEqual(1, importer.ValueTypeSetCount);
- Assert.IsNull(importer.ValueType);
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void OptionalImportsOfExportNullableValueTypesAreBoundToDefaultWhenNotSatisfied()
- {
- var container = ContainerFactory.Create();
- var importer = new OptionalExport();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- container.Compose(batch);
-
- Assert.AreEqual(1, importer.NullableValueTypeSetCount);
- Assert.IsNull(importer.NullableValueType);
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void OptionalImportsOfExportReferenceTypesAreBoundToDefaultWhenNotSatisfied()
- {
- var container = ContainerFactory.Create();
- var importer = new OptionalExport();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- container.Compose(batch);
-
- Assert.AreEqual(1, importer.ReferenceTypeSetCount);
- Assert.IsNull(importer.ReferenceType);
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void OptionalImportsOfValueTypesAreReboundToDefaultWhenExportIsRemoved()
- {
- var container = ContainerFactory.Create();
- var importer = new OptionalImport();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- var key = batch.AddExportedValue("ValueType", 10);
-
- container.Compose(batch);
-
- Assert.AreEqual(1, importer.ValueTypeSetCount);
- Assert.AreEqual(10, importer.ValueType);
-
- batch = new CompositionBatch();
- batch.RemovePart(key);
- container.Compose(batch);
-
- Assert.AreEqual(2, importer.ValueTypeSetCount);
- Assert.AreEqual(0, importer.ValueType);
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void OptionalImportsOfNullableValueTypesAreReboundToDefaultWhenExportIsRemoved()
- {
- var container = ContainerFactory.Create();
- var importer = new OptionalImport();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- var key = batch.AddExportedValue<int?>("NullableValueType", 10);
-
- container.Compose(batch);
- Assert.AreEqual(1, importer.NullableValueTypeSetCount);
- Assert.AreEqual(10, importer.NullableValueType);
-
- batch = new CompositionBatch();
- batch.RemovePart(key);
- container.Compose(batch);
-
- Assert.AreEqual(2, importer.NullableValueTypeSetCount);
- Assert.IsNull(importer.NullableValueType);
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void OptionalImportsOfReferenceTypesAreReboundToDefaultWhenExportIsRemoved()
- {
- var container = ContainerFactory.Create();
- var importer = new OptionalImport();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- var key = batch.AddExportedValue("ReferenceType", "Bar");
-
- container.Compose(batch);
- Assert.AreEqual(1, importer.ReferenceTypeSetCount);
- Assert.AreEqual("Bar", importer.ReferenceType);
-
- batch = new CompositionBatch();
- batch.RemovePart(key);
- container.Compose(batch);
-
- Assert.AreEqual(2, importer.ReferenceTypeSetCount);
- Assert.IsNull(importer.ReferenceType);
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void OptionalImportsOfExportValueTypesAreReboundToDefaultWhenExportIsRemoved()
- {
- var container = ContainerFactory.Create();
- var importer = new OptionalExport();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- var key = batch.AddExportedValue("ValueType", 10);
-
- container.Compose(batch);
-
- Assert.AreEqual(1, importer.ValueTypeSetCount);
- Assert.AreEqual(10, importer.ValueType.Value);
-
- batch = new CompositionBatch();
- batch.RemovePart(key);
- container.Compose(batch);
-
- Assert.AreEqual(2, importer.ValueTypeSetCount);
- Assert.IsNull(importer.ValueType);
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void OptionalImportsOfExportNullableValueTypesAreReboundToDefaultWhenExportIsRemoved()
- {
- var container = ContainerFactory.Create();
- var importer = new OptionalExport();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- var key = batch.AddExportedValue<int?>("NullableValueType", 10);
-
- container.Compose(batch);
- Assert.AreEqual(1, importer.NullableValueTypeSetCount);
- Assert.AreEqual(10, importer.NullableValueType.Value);
-
- batch = new CompositionBatch();
- batch.RemovePart(key);
- container.Compose(batch);
-
- Assert.AreEqual(2, importer.NullableValueTypeSetCount);
- Assert.IsNull(importer.NullableValueType);
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void OptionalImportsOfExportReferenceTypesAreReboundToDefaultWhenExportIsRemoved()
- {
- var container = ContainerFactory.Create();
- var importer = new OptionalExport();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- var key = batch.AddExportedValue("ReferenceType", "Bar");
-
- container.Compose(batch);
- Assert.AreEqual(1, importer.ReferenceTypeSetCount);
- Assert.AreEqual("Bar", importer.ReferenceType.Value);
-
- batch = new CompositionBatch();
- batch.RemovePart(key);
- container.Compose(batch);
-
- Assert.AreEqual(2, importer.ReferenceTypeSetCount);
- Assert.IsNull(importer.ReferenceType);
- }
-
- public class OptionalImport
- {
- public int ValueTypeSetCount;
- public int NullableValueTypeSetCount;
- public int ReferenceTypeSetCount;
-
- private int _valueType;
- private int? _nullableValueType;
- private string _referenceType;
-
- [Import("ValueType", AllowDefault = true, AllowRecomposition = true)]
- public int ValueType
- {
- get { return _valueType; }
- set
- {
- ValueTypeSetCount++;
- _valueType = value;
- }
- }
-
- [Import("NullableValueType", AllowDefault = true, AllowRecomposition = true)]
- public int? NullableValueType
- {
- get { return _nullableValueType; }
- set
- {
- NullableValueTypeSetCount++;
- _nullableValueType = value;
- }
- }
-
- [Import("ReferenceType", AllowDefault = true, AllowRecomposition = true)]
- public string ReferenceType
- {
- get { return _referenceType; }
- set
- {
- ReferenceTypeSetCount++;
- _referenceType = value;
- }
- }
- }
-
- public class OptionalExport
- {
- public int ValueTypeSetCount;
- public int NullableValueTypeSetCount;
- public int ReferenceTypeSetCount;
-
- private Lazy<int> _valueType;
- private Lazy<int?> _nullableValueType;
- private Lazy<string> _referenceType;
-
- [Import("ValueType", AllowDefault = true, AllowRecomposition = true)]
- public Lazy<int> ValueType
- {
- get { return _valueType; }
- set
- {
- ValueTypeSetCount++;
- _valueType = value;
- }
- }
-
- [Import("NullableValueType", AllowDefault = true, AllowRecomposition = true)]
- public Lazy<int?> NullableValueType
- {
- get { return _nullableValueType; }
- set
- {
- NullableValueTypeSetCount++;
- _nullableValueType = value;
- }
- }
-
- [Import("ReferenceType", AllowDefault = true, AllowRecomposition = true)]
- public Lazy<string> ReferenceType
- {
- get { return _referenceType; }
- set
- {
- ReferenceTypeSetCount++;
- _referenceType = value;
- }
- }
- }
-
- private class DelayDuckImporter
- {
- [Import("Duck")]
- public Lazy<IDuck> Duck
- {
- get;
- set;
- }
- }
-
- private class DuckImporter
- {
- [Import("Duck")]
- public IDuck Duck
- {
- get;
- set;
- }
- }
-
- public class QuackLikeADuck
- {
- public virtual string Quack()
- {
- return "Quack";
- }
- }
-
- public interface IDuck
- {
- string Quack();
- }
-
- #if !SILVERLIGHT
-
- [ComImport]
- [Guid("148BD52A-A2AB-11CE-B11F-00AA00530503")]
- private class CTaskScheduler
- { // This interface doesn't implement
- // ITaskScheduler deliberately
- }
-
- [Guid("148BD527-A2AB-11CE-B11F-00AA00530503")]
- [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
- private interface ITaskScheduler
- {
- void FakeMethod();
- }
-
- private class ImportComComponent
- {
- [Import("TaskScheduler")]
- public ITaskScheduler TaskScheduler
- {
- get;
- set;
- }
- }
-
- private class DelayImportComComponent
- {
- [Import("TaskScheduler")]
- public Lazy<ITaskScheduler> TaskScheduler
- {
- get;
- set;
- }
- }
-
-#endif
-
- public class Importer
- {
- public Importer()
- {
- }
-
- [Import("Value")]
- public int ValueReadWrite { get; set; }
-
- [ImportMany("Value")]
- public IList<int> SingleValueCollectionReadWrite { get; set; }
-
- [Import("EmptyValue", AllowDefault = true)]
- public int ValueEmptyOptional { get; set; }
-
- [ImportMany("CollectionValue", typeof(IList<int>))]
- public IList<int> ValueCollection { get; set; }
-
- }
-
- public class ImporterNameless
- {
-
- public ImporterNameless()
- {
- }
-
- [Import]
- public int ValueReadWrite { get; set; }
-
- [Import]
- public Lazy<int> MetadataReadWrite { get; set; }
-
- }
-
- public class ImporterInvalidWrongType
- {
- [Import("Value")]
- public DateTime ValueReadWrite { get; set; }
- }
-
- [Export]
- public class ImporterInvalidSetterException
- {
- [ImportMany("Value")]
- public IEnumerable<int> ValueReadWrite { get { return null; } set { throw new InvalidOperationException(); } }
- }
-
- [Export]
- public class ImportImporterInvalidSetterExceptionLazily
- {
- [Import]
- public Lazy<ImporterInvalidSetterException> Value { get; set; }
- }
-
-
- [PartNotDiscoverable]
- public class Exporter
- {
- List<int> collectionValue = new List<int>();
-
- public Exporter(int value)
- {
- Value = value;
- }
-
- [Export("Value")]
- public int Value { get; set; }
-
-
- [Export("CollectionValue")]
- public IList<int> CollectionValue { get { return collectionValue; } }
-
- }
-
- public class ExporterNameless
- {
-
- public ExporterNameless(int value)
- {
- Value = value;
- }
-
- [Export]
- public int Value { get; set; }
-
- }
-
- public class ExportsString
- {
- [Export]
- public string ExportedString = "Test";
- }
-
- public class ExportsInvalidListOfExportOfString
- {
- [Export(typeof(List<Lazy<string>>))]
- public string ExportedString = "Test";
- }
-
- public class ExportsValidListOfExportOfString
- {
- [Export(typeof(List<Lazy<string>>))]
- public List<Lazy<string>> ExportedString = new List<Lazy<string>>();
- }
-
- [Export]
- public class ImportsListOfExportOfString
- {
- [Import(AllowDefault = true)]
- public List<Lazy<string>> ExportedList { get; set; }
- }
-
- [TestMethod]
- public void ImportListOfExportWithOnlySingleElementsAvailable_ShouldNotFindExport()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(ExportsString), typeof(ImportsListOfExportOfString));
- var importer = container.GetExportedValue<ImportsListOfExportOfString>();
- Assert.IsNull(importer.ExportedList);
-
- var part = AttributedModelServices.CreatePartDefinition(typeof(ImportsListOfExportOfString), null);
- var contract = AttributedModelServices.GetContractName(typeof(List<Lazy<string>>));
- Assert.AreEqual(contract, ((ContractBasedImportDefinition)part.ImportDefinitions.First()).ContractName);
- }
-
- [TestMethod]
- public void ImportListOfExportWithInvalidCollectionAvailable_ShouldThrowMismatch()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(ExportsInvalidListOfExportOfString), typeof(ImportsListOfExportOfString));
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotGetExportedValue, () =>
- container.GetExportedValue<ImportsListOfExportOfString>());
- }
-
- [TestMethod]
- public void ImportListOfExportWithValidCollectionAvailable_ShouldSatisfyImport()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(ExportsValidListOfExportOfString), typeof(ImportsListOfExportOfString));
- var importer = container.GetExportedValue<ImportsListOfExportOfString>();
- Assert.AreEqual(0, importer.ExportedList.Count);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionContainerTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionContainerTests.cs deleted file mode 100644 index ac10766e048..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionContainerTests.cs +++ /dev/null @@ -1,2998 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Runtime.Serialization;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Factories;
-using System.UnitTesting;
-using System.ComponentModel.Composition.AttributedModel;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.UnitTesting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class CompositionContainerTests
- {
- [TestMethod]
- public void Constructor2_ArrayWithNullElementAsProvidersArgument_ShouldThrowArgumentException()
- {
- ExceptionAssert.ThrowsArgument<ArgumentException>("providers", () =>
- {
- new CompositionContainer(new ExportProvider[] { null });
- });
- }
-
- [TestMethod]
- public void Constructor3_ArrayWithNullElementAsProvidersArgument_ShouldThrowArgumentException()
- {
- var catalog = CatalogFactory.Create();
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("providers", () =>
- {
- new CompositionContainer(catalog, new ExportProvider[] { null });
- });
- }
-
- [TestMethod]
- public void Constructor2_ArrayAsProvidersArgument_ShouldNotAllowModificationAfterConstruction()
- {
- var providers = new ExportProvider[] { ExportProviderFactory.Create() };
- var container = new CompositionContainer(providers);
-
- providers[0] = null;
-
- Assert.IsNotNull(container.Providers[0]);
- }
-
- [TestMethod]
- public void Constructor3_ArrayAsProvidersArgument_ShouldNotAllowModificationAfterConstruction()
- {
- var providers = new ExportProvider[] { ExportProviderFactory.Create() };
- var container = new CompositionContainer(CatalogFactory.Create(), providers);
-
- providers[0] = null;
-
- Assert.IsNotNull(container.Providers[0]);
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetProvidersPropertyToEmptyCollection()
- {
- var container = new CompositionContainer();
-
- EnumerableAssert.IsEmpty(container.Providers);
- }
-
- [TestMethod]
- public void Constructor2_EmptyArrayAsProvidersArgument_ShouldSetProvidersPropertyToEmpty()
- {
- var container = new CompositionContainer(new ExportProvider[0]);
-
- EnumerableAssert.IsEmpty(container.Providers);
- }
-
- [TestMethod]
- public void Constructor3_EmptyArrayAsProvidersArgument_ShouldSetProvidersPropertyToEmpty()
- {
- var container = new CompositionContainer(CatalogFactory.Create(), new ExportProvider[0]);
-
- EnumerableAssert.IsEmpty(container.Providers);
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetCatalogPropertyToNull()
- {
- var container = new CompositionContainer();
-
- Assert.IsNull(container.Catalog);
- }
-
- [TestMethod]
- public void Constructor2_ShouldSetCatalogPropertyToNull()
- {
- var container = new CompositionContainer(new ExportProvider[0]);
-
- Assert.IsNull(container.Catalog);
- }
-
- [TestMethod]
- public void Constructor3_NullAsCatalogArgument_ShouldSetCatalogPropertyToNull()
- {
- var container = new CompositionContainer((ComposablePartCatalog)null, new ExportProvider[0]);
-
- Assert.IsNull(container.Catalog);
- }
-
- [TestMethod]
- public void Constructor3_ValueAsCatalogArgument_ShouldSetCatalogProperty()
- {
- var expectations = Expectations.GetCatalogs();
-
- foreach (var e in expectations)
- {
- var container = new CompositionContainer(e, new ExportProvider[0]);
-
- Assert.AreSame(e, container.Catalog);
- }
- }
-
- [TestMethod]
- public void Catalog_WhenDisposed_ShouldThrowObjectDisposed()
- {
- var container = CreateCompositionContainer();
- container.Dispose();
-
- ExceptionAssert.ThrowsDisposed(container, () =>
- {
- var catalog = container.Catalog;
- });
- }
-
- [TestMethod]
- public void Providers_WhenDisposed_ShouldThrowObjectDisposed()
- {
- var container = CreateCompositionContainer();
- container.Dispose();
-
- ExceptionAssert.ThrowsDisposed(container, () =>
- {
- var providers = container.Providers;
- });
- }
-
- [TestMethod]
- [Ignore]
- [WorkItem(579990)] // NullReferenceException
- public void ExportsChanged_Add_WhenDisposed_ShouldThrowObjectDisposed()
- {
- var container = CreateCompositionContainer();
- container.Dispose();
-
- ExceptionAssert.ThrowsDisposed(container, () =>
- {
- container.ExportsChanged += (o, s) => { };
- });
- }
-
- [TestMethod]
- [Ignore]
- [WorkItem(579990)] // NullReferenceException
- public void ExportsChanged_Remove_WhenDisposed_ShouldThrowObjectDisposed()
- {
- var container = CreateCompositionContainer();
- container.Dispose();
-
- ExceptionAssert.ThrowsDisposed(container, () =>
- {
- container.ExportsChanged -= (o, s) => { };
- });
- }
-
- [TestMethod]
- public void AddPart1_ImportOnlyPart_ShouldNotGetGarbageCollected()
- {
- var container = CreateCompositionContainer();
-
- var import = PartFactory.CreateImporter("Value", ImportCardinality.ZeroOrMore);
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(import);
- container.Compose(batch);
-
- var weakRef = new WeakReference(import);
- import = null;
-
- GC.Collect();
- GC.WaitForPendingFinalizers();
-
- Assert.IsNotNull(weakRef.Target, "Import only part should not have been collected!");
-
- GC.KeepAlive(container);
- }
-
- [TestMethod]
- public void Compose_WhenContainerDisposed_ShouldThrowObjectDisposed()
- {
- var container = CreateCompositionContainer();
- container.Dispose();
-
- CompositionBatch batch = new CompositionBatch();
- ExceptionAssert.ThrowsDisposed(container, () =>
- {
- container.Compose(batch);
- });
- }
-
- [TestMethod]
- public void GetExportOfT1_WhenContainerDisposed_ShouldThrowObjectDisposed()
- {
- var container = CreateCompositionContainer();
- container.Dispose();
-
- ExceptionAssert.ThrowsDisposed(container, () =>
- {
- container.GetExport<string>();
- });
- }
-
- [TestMethod]
- public void GetExportOfT2_WhenContainerDisposed_ShouldThrowObjectDisposed()
- {
- var container = CreateCompositionContainer();
- container.Dispose();
-
- ExceptionAssert.ThrowsDisposed(container, () =>
- {
- container.GetExport<string>("Contract");
- });
- }
-
- [TestMethod]
- public void GetExportOfTTMetadataView1_WhenContainerDisposed_ShouldThrowObjectDisposed()
- {
- var container = CreateCompositionContainer();
- container.Dispose();
-
- ExceptionAssert.ThrowsDisposed(container, () =>
- {
- container.GetExport<string, object>();
- });
- }
-
- [TestMethod]
- public void GetExportOfTTMetadataView2_WhenContainerDisposed_ShouldThrowObjectDisposed()
- {
- var container = CreateCompositionContainer();
- container.Dispose();
-
- ExceptionAssert.ThrowsDisposed(container, () =>
- {
- container.GetExport<string, object>("Contract");
- });
- }
-
- [TestMethod]
- public void GetExports1_WhenContainerDisposed_ShouldThrowObjectDisposed()
- {
- var container = CreateCompositionContainer();
- container.Dispose();
-
- var definition = ImportDefinitionFactory.Create();
- ExceptionAssert.ThrowsDisposed(container, () =>
- {
- container.GetExports(definition);
- });
- }
-
- [TestMethod]
- public void GetExports2_WhenContainerDisposed_ShouldThrowObjectDisposed()
- {
- var container = CreateCompositionContainer();
- container.Dispose();
-
- ExceptionAssert.ThrowsDisposed(container, () =>
- {
- container.GetExports(typeof(string), typeof(object), "Contract");
- });
- }
-
- [TestMethod]
- public void GetExportsOfT1_WhenContainerDisposed_ShouldThrowObjectDisposed()
- {
- var container = CreateCompositionContainer();
- container.Dispose();
-
- ExceptionAssert.ThrowsDisposed(container, () =>
- {
- container.GetExports<string>();
- });
- }
-
- [TestMethod]
- public void GetExportsOfT2_WhenContainerDisposed_ShouldThrowObjectDisposed()
- {
- var container = CreateCompositionContainer();
- container.Dispose();
-
- ExceptionAssert.ThrowsDisposed(container, () =>
- {
- container.GetExports<string>("Contract");
- });
- }
-
- [TestMethod]
- public void GetExportsOfTTMetadataView1_WhenContainerDisposed_ShouldThrowObjectDisposed()
- {
- var container = CreateCompositionContainer();
- container.Dispose();
-
- ExceptionAssert.ThrowsDisposed(container, () =>
- {
- container.GetExports<string, object>();
- });
- }
-
- [TestMethod]
- public void GetExportsOfTTMetadataView2_WhenContainerDisposed_ShouldThrowObjectDisposed()
- {
- var container = CreateCompositionContainer();
- container.Dispose();
-
- ExceptionAssert.ThrowsDisposed(container, () =>
- {
- container.GetExports<string, object>("Contract");
- });
- }
-
- [TestMethod]
- public void GetExportedValueOfT1_WhenContainerDisposed_ShouldThrowObjectDisposed()
- {
- var container = CreateCompositionContainer();
- container.Dispose();
-
- ExceptionAssert.ThrowsDisposed(container, () =>
- {
- container.GetExportedValue<string>();
- });
- }
-
-
- [TestMethod]
- public void GetExportedValueOfT2_WhenContainerDisposed_ShouldThrowObjectDisposed()
- {
- var container = CreateCompositionContainer();
- container.Dispose();
-
- ExceptionAssert.ThrowsDisposed(container, () =>
- {
- container.GetExportedValue<string>("Contract");
- });
- }
-
- [TestMethod]
- public void GetExportedValueOrDefaultOfT1_WhenContainerDisposed_ShouldThrowObjectDisposed()
- {
- var container = CreateCompositionContainer();
- container.Dispose();
-
- ExceptionAssert.ThrowsDisposed(container, () =>
- {
- container.GetExportedValueOrDefault<string>();
- });
- }
-
- [TestMethod]
- public void GetExportedValueOrDefaultOfT2_WhenContainerDisposed_ShouldThrowObjectDisposed()
- {
- var container = CreateCompositionContainer();
- container.Dispose();
-
- ExceptionAssert.ThrowsDisposed(container, () =>
- {
- container.GetExportedValueOrDefault<string>("Contract");
- });
- }
-
- [TestMethod]
- public void GetExportedValuesOfT1_WhenContainerDisposed_ShouldThrowObjectDisposed()
- {
- var container = CreateCompositionContainer();
- container.Dispose();
-
- ExceptionAssert.ThrowsDisposed(container, () =>
- {
- container.GetExportedValues<string>();
- });
- }
-
- [TestMethod]
- public void GetExportedValuesOfT2_WhenContainerDisposed_ShouldThrowObjectDisposed()
- {
- var container = CreateCompositionContainer();
- container.Dispose();
-
- ExceptionAssert.ThrowsDisposed(container, () =>
- {
- container.GetExportedValues<string>("Contract");
- });
- }
-
- [TestMethod]
- public void GetExports1_NullAsImportDefinitionArgument_ShouldThrowArgumentNull()
- {
- var container = CreateCompositionContainer();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("definition", () =>
- {
- container.GetExports((ImportDefinition)null);
- });
- }
-
- [TestMethod]
- public void GetExports2_NullAsTypeArgument_ShouldThrowArgumentNull()
- {
- var container = CreateCompositionContainer();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("type", () =>
- {
- container.GetExports((Type)null, typeof(string), "ContractName");
- });
- }
-
- [TestMethod]
- public void GetExportOfT1_AskingForContractThatDoesNotExist_ShouldThrowCardinalityMismatch()
- {
- var container = CreateCompositionContainer();
-
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- {
- container.GetExport<string>();
- });
- }
-
- [TestMethod]
- public void GetExportOfT2_AskingForContractThatDoesNotExist_ShouldThrowCardinalityMismatch()
- {
- var container = CreateCompositionContainer();
-
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- {
- container.GetExport<string>("Contract");
- });
- }
-
- [TestMethod]
- public void GetExportOfTTMetadataView1_AskingForContractThatDoesNotExist_ShouldThrowCardinalityMismatch()
- {
- var container = CreateCompositionContainer();
-
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- {
- container.GetExport<string, object>();
- });
- }
-
- [TestMethod]
- public void GetExportOfTTMetadataView2_AskingForContractThatDoesNotExist_ShouldThrowCardinalityMismatch()
- {
- var container = CreateCompositionContainer();
-
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- {
- container.GetExport<string, object>("Contract");
- });
- }
-
- [TestMethod]
- public void GetExports1_DefinitionAskingForExactlyOneContractThatDoesNotExist_ShouldThrowCardinalityMismatch()
- {
- var container = CreateCompositionContainer();
-
- var definition = ImportDefinitionFactory.Create("Contract", ImportCardinality.ExactlyOne);
-
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- {
- container.GetExports(definition);
- });
- }
-
- [TestMethod]
- public void GetExports1_DefinitionAskingForExactlyZeroOrOneContractThatDoesNotExist_ShouldReturnEmpty()
- {
- var container = CreateCompositionContainer();
-
- var definition = ImportDefinitionFactory.Create("Contract", ImportCardinality.ZeroOrOne);
-
- var exports = container.GetExports(definition);
-
- EnumerableAssert.IsEmpty(exports);
- }
-
- [TestMethod]
- public void GetExports1_DefinitionAskingForExactlyZeroOrMoreContractThatDoesNotExist_ShouldReturnEmpty()
- {
- var container = CreateCompositionContainer();
-
- var definition = ImportDefinitionFactory.Create("Contract", ImportCardinality.ZeroOrMore);
-
- var exports = container.GetExports(definition);
-
- EnumerableAssert.IsEmpty(exports);
- }
-
- [TestMethod]
- public void GetExports2_AskingForContractThatDoesNotExist_ShouldReturnNoExports()
- {
- var container = CreateCompositionContainer();
-
- var exports = container.GetExports(typeof(string), (Type)null, "Contract");
-
- EnumerableAssert.IsEmpty(exports);
- }
-
- [TestMethod]
- public void GetExportsOfT1_AskingForContractThatDoesNotExist_ShouldReturnEmpty()
- {
- var container = CreateCompositionContainer();
-
- var exports = container.GetExports<string>();
-
- EnumerableAssert.IsEmpty(exports);
- }
-
- [TestMethod]
- public void GetExportsOfT2_AskingForContractThatDoesNotExist_ShouldReturnEmpty()
- {
- var container = CreateCompositionContainer();
-
- var exports = container.GetExports<string>("Contract");
-
- EnumerableAssert.IsEmpty(exports);
- }
-
- [TestMethod]
- public void GetExportsOfTTMetadataView1_AskingForContractThatDoesNotExist_ShouldReturnEmpty()
- {
- var container = CreateCompositionContainer();
-
- var exports = container.GetExports<string, object>();
-
- EnumerableAssert.IsEmpty(exports);
- }
-
- [TestMethod]
- public void GetExportsOfTTMetadataView2_AskingForContractThatDoesNotExist_ShouldReturnEmpty()
- {
- var container = CreateCompositionContainer();
-
- var exports = container.GetExports<string, object>("Contract");
-
- EnumerableAssert.IsEmpty(exports);
- }
-
- [TestMethod]
- public void GetExportedValueOfT1_AskingForContractThatDoesNotExist_ShouldThrowCardinalityMismatch()
- {
- var container = CreateCompositionContainer();
-
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- {
- container.GetExportedValue<string>();
- });
- }
-
- [TestMethod]
- public void GetExportedValueOfT2_AskingForContractThatDoesNotExist_ShouldThrowCardinalityMismatch()
- {
- var container = CreateCompositionContainer();
-
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- {
- container.GetExportedValue<string>("Contract");
- });
- }
-
- [TestMethod]
- public void GetExportedValueOrDefaultOfT1_AskingForStringContractThatDoesNotExist_ShouldReturnNull()
- {
- var container = CreateCompositionContainer();
-
- var exportedValue = container.GetExportedValueOrDefault<string>();
-
- Assert.IsNull(exportedValue);
- }
-
- [TestMethod]
- public void GetExportedValueOrDefaultOfT2_AskingForStringContractThatDoesNotExist_ShouldReturnNull()
- {
- var container = CreateCompositionContainer();
-
- var exportedValue = container.GetExportedValueOrDefault<string>("Contract");
-
- Assert.IsNull(exportedValue);
- }
-
- [TestMethod]
- public void GetExportedValueOrDefaultOfT1_AskingForInt32ContractThatDoesNotExist_ShouldReturnZero()
- {
- var container = CreateCompositionContainer();
-
- var exportedValue = container.GetExportedValueOrDefault<int>();
-
- Assert.AreEqual(0, exportedValue);
- }
-
- [TestMethod]
- public void GetExportedValueOrDefaultOfT2_AskingForInt32ContractThatDoesNotExist_ShouldReturnZero()
- {
- var container = CreateCompositionContainer();
-
- var exportedValue = container.GetExportedValueOrDefault<int>("Contract");
-
- Assert.AreEqual(0, exportedValue);
- }
-
- [TestMethod]
- public void GetExportedValuesOfT1_AskingForContractThatDoesNotExist_ShouldReturnEmpty()
- {
- var container = CreateCompositionContainer();
-
- var exports = container.GetExportedValues<string>();
-
- EnumerableAssert.IsEmpty(exports);
- }
-
- [TestMethod]
- public void GetExportedValuesOfT2_AskingForContractThatDoesNotExist_ShouldReturnEmpty()
- {
- var container = CreateCompositionContainer();
-
- var exports = container.GetExports<string>("Contract");
-
- EnumerableAssert.IsEmpty(exports);
- }
-
- [TestMethod]
- public void GetExportOfT1_AskingForContractWithOneExport_ShouldReturnExport()
- {
- var container = ContainerFactory.Create(new MicroExport(ContractFromType(typeof(String)), "Value"));
-
- var export = container.GetExport<string>();
-
- Assert.AreEqual("Value", export.Value);
- }
-
- [TestMethod]
- public void GetExportOfT2_AskingForContractWithOneExport_ShouldReturnExport()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", "Value"));
-
- var export = container.GetExport<string>("Contract");
-
- Assert.AreEqual("Value", export.Value);
- }
-
- [TestMethod]
- public void GetExportOfTTMetadataView1_AskingForContractWithOneExport_ShouldReturnExport()
- {
- var container = ContainerFactory.Create(new MicroExport(ContractFromType(typeof(String)), "Value"));
-
- var export = container.GetExport<string, object>();
-
- Assert.AreEqual("Value", export.Value);
- }
-
- [TestMethod]
- public void GetExportOfTTMetadataView2_AskingForContractWithOneExport_ShouldReturnExport()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", "Value"));
-
- var export = container.GetExport<string, object>("Contract");
-
- Assert.AreEqual("Value", export.Value);
- }
-
- [TestMethod]
- public void GetExports1_AskingForExactlyOneContractWithOneExport_ShouldReturnExport()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", "Value"));
-
- var definition = ImportDefinitionFactory.Create("Contract", ImportCardinality.ExactlyOne);
-
- var exports = container.GetExports(definition);
-
- ExportsAssert.AreEqual(exports, "Value");
- }
-
- [TestMethod]
- public void GetExports1_AskingForZeroOrOneContractWithOneExport_ShouldReturnExport()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", "Value"));
-
- var definition = ImportDefinitionFactory.Create("Contract", ImportCardinality.ZeroOrOne);
-
- var exports = container.GetExports(definition);
-
- ExportsAssert.AreEqual(exports, "Value");
- }
-
- [TestMethod]
- public void GetExports1_AskingForZeroOrMoreContractWithOneExport_ShouldReturnExport()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", "Value"));
-
- var definition = ImportDefinitionFactory.Create("Contract", ImportCardinality.ZeroOrMore);
-
- var exports = container.GetExports(definition);
-
- ExportsAssert.AreEqual(exports, "Value");
- }
-
- [TestMethod]
- public void GetExports2_AskingForContractWithOneExport_ShouldReturnOneExport()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", "Value"));
-
- var exports = container.GetExports(typeof(string), (Type)null, "Contract");
-
- ExportsAssert.AreEqual(exports, "Value");
- }
-
- [TestMethod]
- public void GetExportsOfT1_AskingForContractWithOneExport_ShouldReturnOneExport()
- {
- var container = ContainerFactory.Create(new MicroExport(typeof(string), "Value"));
-
- var exports = container.GetExports<string>();
-
- ExportsAssert.AreEqual(exports, "Value");
- }
-
- [TestMethod]
- public void GetExportsOfT2_AskingForContractWithOneExport_ShouldReturnOneExport()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", "Value"));
-
- var exports = container.GetExports<string>("Contract");
-
- ExportsAssert.AreEqual(exports, "Value");
- }
-
- [TestMethod]
- public void GetExportsOfTTMetadataView1_AskingForContractWithOneExport_ShouldReturnOneExport()
- {
- var container = ContainerFactory.Create(new MicroExport(typeof(string), "Value"));
-
- var exports = container.GetExports<string, object>();
-
- ExportsAssert.AreEqual(exports, "Value");
- }
-
- [TestMethod]
- public void GetExportsOfTTMetadataView2_AskingForContractWithOneExport_ShouldReturnOneExport()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", "Value"));
-
- var exports = container.GetExports<string, object>("Contract");
-
- ExportsAssert.AreEqual(exports, "Value");
- }
-
- [TestMethod]
- public void GetExportedValueOfT1_AskingForContractWithOneExport_ShouldReturnExport()
- {
- var container = ContainerFactory.Create(new MicroExport(typeof(string), "Value"));
-
- var exportedValue = container.GetExportedValue<string>();
-
- Assert.AreEqual("Value", exportedValue);
- }
-
- [TestMethod]
- public void GetExportedValueOfT2_AskingForContractWithOneExport_ShouldReturnExport()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", "Value"));
-
- var exportedValue = container.GetExportedValue<string>("Contract");
-
- Assert.AreEqual("Value", exportedValue);
- }
-
- [TestMethod]
- public void GetExportedValueOrDefaultOfT1_AskingForContractWithOneExport_ShouldReturnExport()
- {
- var container = ContainerFactory.Create(new MicroExport(typeof(string), "Value"));
-
- var exportedValue = container.GetExportedValueOrDefault<string>();
-
- Assert.AreEqual("Value", exportedValue);
- }
-
- [TestMethod]
- public void GetExportedValueOrDefaultOfT2_AskingForContractWithOneExport_ShouldReturnExport()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", "Value"));
-
- var exportedValue = container.GetExportedValueOrDefault<string>("Contract");
-
- Assert.AreEqual("Value", exportedValue);
- }
-
- [TestMethod]
- public void GetExportedValuesOfT1_AskingForContractWithOneExport_ShouldReturnOneExport()
- {
- var container = ContainerFactory.Create(new MicroExport(typeof(string), "Value"));
-
- var exportedValues = container.GetExportedValues<string>();
-
- EnumerableAssert.AreEqual(exportedValues, "Value");
- }
-
- [TestMethod]
- public void GetExportedValuesOfT2_AskingForContractWithOneExport_ShouldReturnOneExport()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", "Value"));
-
- var exportedValues = container.GetExportedValues<string>("Contract");
-
- EnumerableAssert.AreEqual(exportedValues, "Value");
- }
-
- [TestMethod]
- public void GetExportOfT1_AskingForContractWithMultipleExports_ShouldThrowCardinalityMismatch()
- {
- var container = ContainerFactory.Create(new MicroExport(ContractFromType(typeof(String)), "Value1", "Value2"));
-
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- {
- container.GetExport<string>();
- });
- }
-
- [TestMethod]
- public void GetExportOfT2_AskingForContractWithMultipleExports_ShouldThrowCardinalityMismatch()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", "Value1", "Value2"));
-
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- {
- container.GetExport<string>("Contract");
- });
- }
-
- [TestMethod]
- public void GetExportOfTTMetadataView1_AskingForContractWithMultipleExports_ShouldThrowCardinalityMismatch()
- {
- var container = ContainerFactory.Create(new MicroExport(ContractFromType(typeof(String)), "Value1", "Value2"));
-
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- {
- container.GetExport<string, object>();
- });
- }
-
- [TestMethod]
- public void GetExportOfTTMetadataView2_AskingForContractWithMultipleExports_ShouldThrowCardinalityMismatch()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", "Value1", "Value2"));
-
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- {
- container.GetExport<string, object>("Contract");
- });
- }
-
- [TestMethod]
- public void GetExports1_AskingForExactlyOneContractWithMultipleExports_ShouldThrowCardinalityMismatch()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", "Value1", "Value2"));
-
- var definition = ImportDefinitionFactory.Create("Contract", ImportCardinality.ExactlyOne);
-
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- {
- container.GetExports(definition);
- });
- }
-
- [TestMethod]
- public void GetExports1_AskingForZeroOrOneContractWithMultipleExports_ShouldReturnZero()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", "Value1", "Value2"));
-
- var definition = ImportDefinitionFactory.Create("Contract", ImportCardinality.ZeroOrOne);
-
- Assert.AreEqual(0, container.GetExports(definition).Count());
- }
-
- [TestMethod]
- public void GetExports1_AskingForZeroOrMoreContractWithMultipleExports_ShouldReturnMultipleExports()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", "Value1", "Value2"));
-
- var definition = ImportDefinitionFactory.Create("Contract", ImportCardinality.ZeroOrMore);
-
- var exports = container.GetExports(definition);
-
- ExportsAssert.AreEqual(exports, "Value1", "Value2");
- }
-
- [TestMethod]
- public void GetExports2_AskingForContractWithMultipleExports_ShouldReturnMultipleExports()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", "Value1", "Value2"));
-
- var exports = container.GetExports(typeof(string), (Type)null, "Contract");
-
- ExportsAssert.AreEqual(exports, "Value1", "Value2");
- }
-
- [TestMethod]
- public void GetExportsOfT1_AskingForContractWithMultipleExports_ShouldReturnMultipleExports()
- {
- var container = ContainerFactory.Create(new MicroExport(typeof(String), "Value1", "Value2"));
-
- var exports = container.GetExports<string>();
-
- ExportsAssert.AreEqual(exports, "Value1", "Value2");
- }
-
- [TestMethod]
- public void GetExportsOfT2_AskingForContractWithMultipleExports_ShouldReturnMultipleExports()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", "Value1", "Value2"));
-
- var exports = container.GetExports<string>("Contract");
-
- ExportsAssert.AreEqual(exports, "Value1", "Value2");
- }
-
- [TestMethod]
- public void GetExportsOfTTMetadataView1_AskingForContractWithMultipleExports_ShouldReturnMultipleExports()
- {
- var container = ContainerFactory.Create(new MicroExport(typeof(string), "Value1", "Value2"));
-
- var exports = container.GetExports<string, object>();
-
- ExportsAssert.AreEqual(exports, "Value1", "Value2");
- }
-
- [TestMethod]
- public void GetExportsOfTTMetadataView2_AskingForContractWithMultipleExports_ShouldReturnMultipleExports()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", "Value1", "Value2"));
-
- var exports = container.GetExports<string, object>("Contract");
-
- ExportsAssert.AreEqual(exports, "Value1", "Value2");
- }
-
- [TestMethod]
- public void GetExportedValueOfT1_AskingForContractWithMultipleExports_ShouldThrowCardinalityMismatch()
- {
- var container = ContainerFactory.Create(new MicroExport(typeof(string), "Value1", "Value2"));
-
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- {
- container.GetExportedValue<string>();
- });
- }
-
- [TestMethod]
- public void GetExportedValueOfT2_AskingForContractWithMultipleExports_ShouldThrowCardinalityMismatch()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", "Value1", "Value2"));
-
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- {
- container.GetExportedValue<string>("Contract");
- });
- }
-
- [TestMethod]
- public void GetExportedValueOrDefaultOfT1_AskingForContractWithMultipleExports_ShouldReturnZero()
- {
- var container = ContainerFactory.Create(new MicroExport(typeof(string), "Value1", "Value2"));
-
- Assert.IsNull(container.GetExportedValueOrDefault<string>());
- }
-
- [TestMethod]
- public void GetExportedValueOrDefaultOfT2_AskingForContractWithMultipleExports_ShouldReturnZero()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", "Value1", "Value2"));
-
- Assert.IsNull(container.GetExportedValueOrDefault<string>("Contract"));
- }
-
- [TestMethod]
- public void GetExportedValuesOfT1_AskingForContractWithMultipleExports_ShouldReturnMultipleExports()
- {
- var container = ContainerFactory.Create(new MicroExport(typeof(string), "Value1", "Value2"));
-
- var exportedValues = container.GetExportedValues<string>();
-
- EnumerableAssert.AreEqual(exportedValues, "Value1", "Value2");
- }
-
- [TestMethod]
- public void GetExportedValuesOfT2_AskingForContractWithMultipleExports_ShouldReturnMultipleExports()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", typeof(string), "Value1", "Value2"));
-
- var exportedValues = container.GetExportedValues<string>("Contract");
-
- EnumerableAssert.AreEqual(exportedValues, "Value1", "Value2");
- }
-
- [TestMethod]
- public void GetExports1_AskingForExactlyOneAndAll_ShouldThrowCardinalityMismatch()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract1", "Value1", "Value2", "Value3"),
- new MicroExport("Contract2", "Value4", "Value5", "Value6"));
-
- var definition = ImportDefinitionFactory.Create(import => true, ImportCardinality.ExactlyOne);
-
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- {
- container.GetExports(definition);
- });
- }
-
- [TestMethod]
- public void GetExports1_AskingForZeroOrOneAndAll_ShouldReturnZero()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract1", "Value1", "Value2", "Value3"),
- new MicroExport("Contract2", "Value4", "Value5", "Value6"));
-
- var definition = ImportDefinitionFactory.Create(import => true, ImportCardinality.ZeroOrOne);
-
- Assert.AreEqual(0, container.GetExports(definition).Count());
- }
-
- [TestMethod]
- public void GetExports1_AskingForZeroOrMoreAndAll_ShouldReturnAll()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract1", "Value1", "Value2", "Value3"),
- new MicroExport("Contract2", "Value4", "Value5", "Value6"));
-
- var definition = ImportDefinitionFactory.Create(import => true, ImportCardinality.ZeroOrMore);
-
- var exports = container.GetExports(definition);
-
- ExportsAssert.AreEqual(exports, "Value1", "Value2", "Value3",
- "Value4", "Value5", "Value6");
- }
-
- [TestMethod]
- public void GetExportOfT1_StringAsTTypeArgumentAskingForContractWithOneObjectExport_ShouldThrowContractMismatch()
- {
- var container = ContainerFactory.Create(new MicroExport(typeof(string), new object()));
-
- var export = container.GetExport<string>();
-
- ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- {
- var value = export.Value;
- });
- }
-
- [TestMethod]
- public void GetExportOfT2_StringAsTTypeArgumentAskingForContractWithOneObjectExport_ShouldThrowContractMismatch()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", typeof(string), new object()));
-
- var export = container.GetExport<string>("Contract");
-
- ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- {
- var value = export.Value;
- });
- }
-
- [TestMethod]
- public void GetExportOfTTMetadataView1_StringAsTTypeArgumentAskingForContractWithOneObjectExport_ShouldThrowContractMismatch()
- {
- var container = ContainerFactory.Create(new MicroExport(typeof(string), new object()));
-
- var export = container.GetExport<string, object>();
-
- ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- {
- var value = export.Value;
- });
- }
-
- [TestMethod]
- public void GetExportOfTTMetadataView2_StringAsTTypeArgumentAskingForContractWithOneObjectExport_ShouldThrowContractMismatch()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", typeof(string), new object()));
-
- var export = container.GetExport<string, object>("Contract");
-
- ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- {
- var value = export.Value;
- });
- }
-
- [TestMethod]
- public void GetExports2_StringAsTTypeArgumentAskingForContractWithOneObjectExport_ShouldThrowContractMismatch()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", typeof(string), new object()));
-
- var exports = container.GetExports(typeof(string), (Type)null, "Contract");
-
- Assert.AreEqual(1, exports.Count());
-
- var export = exports.ElementAt(0);
-
- ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- {
- var value = export.Value;
- });
- }
-
- [TestMethod]
- public void GetExportsOfT1_StringAsTTypeArgumentAskingForContractWithOneObjectExport_ShouldThrowContractMismatch()
- {
- var container = ContainerFactory.Create(new MicroExport(typeof(string), new object()));
-
- var exports = container.GetExports<string>();
-
- Assert.AreEqual(1, exports.Count());
-
- var export = exports.ElementAt(0);
-
- ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- {
- var value = export.Value;
- });
- }
-
- [TestMethod]
- public void GetExportsOfT2_StringAsTTypeArgumentAskingForContractWithOneObjectExport_ShouldThrowContractMismatch()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", typeof(string), new object()));
-
- var exports = container.GetExports<string>("Contract");
-
- Assert.AreEqual(1, exports.Count());
-
- var export = exports.ElementAt(0);
-
- ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- {
- var value = export.Value;
- });
- }
-
- [TestMethod]
- public void GetExportsOfTTMetadataView1_StringAsTTypeArgumentAskingForContractWithOneObjectExport_ShouldThrowContractMismatch()
- {
- var container = ContainerFactory.Create(new MicroExport(typeof(string), new object()));
-
- var exports = container.GetExports<string, object>();
-
- Assert.AreEqual(1, exports.Count());
-
- var export = exports.ElementAt(0);
-
- ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- {
- var value = export.Value;
- });
- }
-
- [TestMethod]
- public void GetExportsOfTTMetadataView2_StringAsTTypeArgumentAskingForContractWithOneObjectExport_ShouldThrowContractMismatch()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", typeof(string), new object()));
-
- var exports = container.GetExports<string, object>("Contract");
-
- Assert.AreEqual(1, exports.Count());
-
- var export = exports.ElementAt(0);
-
- ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- {
- var value = export.Value;
- });
- }
-
- [TestMethod]
- public void GetExportedValueOfT1_StringAsTTypeArgumentAskingForContractWithObjectExport_ShouldThrowContractMismatch()
- {
- var container = ContainerFactory.Create(new MicroExport(typeof(string), new object()));
-
- ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- {
- container.GetExportedValue<string>();
- });
- }
-
- [TestMethod]
- public void GetExportedValueOfT2_StringAsTTypeArgumentAskingForContractWithObjectExport_ShouldThrowContractMismatch()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", typeof(string), new object()));
-
- ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- {
- container.GetExportedValue<string>("Contract");
- });
- }
-
- [TestMethod]
- public void GetExportedValueOrDefaultOfT1_StringAsTTypeArgumentAskingForContractWithObjectExport_ShouldThrowContractMismatch()
- {
- var container = ContainerFactory.Create(new MicroExport(typeof(string), new object()));
-
- ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- {
- container.GetExportedValueOrDefault<string>();
- });
- }
-
- [TestMethod]
- public void GetExportedValueOrDefaultOfT2_StringAsTTypeArgumentAskingForContractWithObjectExport_ShouldThrowContractMismatch()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", typeof(string), new object()));
-
- ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- {
- container.GetExportedValueOrDefault<string>("Contract");
- });
- }
-
- [TestMethod]
- public void GetExportedValuesOfT1_StringAsTTypeArgumentAskingForContractWithOneObjectExport_ShouldThrowContractMismatch()
- {
- var container = ContainerFactory.Create(new MicroExport(typeof(string), new object()));
-
- ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- {
- container.GetExportedValues<string>();
- });
- }
-
- [TestMethod]
- public void GetExportedValuesOfT2_StringAsTTypeArgumentAskingForContractWithOneObjectExport_ShouldThrowContractMismatch()
- {
- var container = ContainerFactory.Create(new MicroExport("Contract", typeof(string), new object()));
-
- ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- {
- container.GetExportedValues<string>("Contract");
- });
- }
-
-
- [TestMethod]
- public void GetExportOfT1_AskingForContractFromChildWithExportInParentContainer_ShouldReturnExport()
- {
- var parent = ContainerFactory.Create(new MicroExport(typeof(string), "Parent"));
- var child = ContainerFactory.Create(parent);
-
- var export = child.GetExport<string>();
-
- Assert.AreEqual("Parent", export.Value);
- }
-
- [TestMethod]
- public void GetExportOfT2_AskingForContractFromChildWithExportInParentContainer_ShouldReturnExport()
- {
- var parent = ContainerFactory.Create(new MicroExport("Contract", "Parent"));
- var child = ContainerFactory.Create(parent);
-
- var export = child.GetExport<string>("Contract");
-
- Assert.AreEqual("Parent", export.Value);
- }
-
- [TestMethod]
- public void GetExportOfTTMetadataView1_AskingForContractFromChildWithExportInParentContainer_ShouldReturnExport()
- {
- var parent = ContainerFactory.Create(new MicroExport(typeof(string), "Parent"));
- var child = ContainerFactory.Create(parent);
-
- var export = child.GetExport<string, object>();
-
- Assert.AreEqual("Parent", export.Value);
- }
-
- [TestMethod]
- public void GetExportOfTTMetadataView2_AskingForContractFromChildWithExportInParentContainer_ShouldReturnExport()
- {
- var parent = ContainerFactory.Create(new MicroExport("Contract", "Parent"));
- var child = ContainerFactory.Create(parent);
-
- var export = child.GetExport<string, object>("Contract");
-
- Assert.AreEqual("Parent", export.Value);
- }
-
- [TestMethod]
- public void GetExports1_AskingForExactlyOneContractFromChildWithExportInParentContainer_ShouldReturnExport()
- {
- var parent = ContainerFactory.Create(new MicroExport("Contract", "Parent"));
- var child = ContainerFactory.Create(parent);
-
- var definition = ImportDefinitionFactory.Create("Contract", ImportCardinality.ExactlyOne);
-
- var exports = child.GetExports(definition);
-
- ExportsAssert.AreEqual(exports, "Parent");
- }
-
- [TestMethod]
- public void GetExports1_AskingForZeroOrOneContractFromChildWithExportInParentContainer_ShouldReturnExport()
- {
- var parent = ContainerFactory.Create(new MicroExport("Contract", "Parent"));
- var child = ContainerFactory.Create(parent);
-
- var definition = ImportDefinitionFactory.Create("Contract", ImportCardinality.ZeroOrOne);
-
- var exports = child.GetExports(definition);
-
- ExportsAssert.AreEqual(exports, "Parent");
- }
-
- [TestMethod]
- public void GetExports1_AskingForZeroOrMoreContractFromChildWithExportInParentContainer_ShouldReturnExport()
- {
- var parent = ContainerFactory.Create(new MicroExport("Contract", "Parent"));
- var child = ContainerFactory.Create(parent);
-
- var definition = ImportDefinitionFactory.Create("Contract", ImportCardinality.ZeroOrMore);
-
- var exports = child.GetExports(definition);
-
- ExportsAssert.AreEqual(exports, "Parent");
- }
-
- [TestMethod]
- public void GetExports2_AskingForContractFromChildWithExportInParentContainer_ShouldReturnExport()
- {
- var parent = ContainerFactory.Create(new MicroExport("Contract", "Parent"));
- var child = ContainerFactory.Create(parent);
-
- var exports = child.GetExports(typeof(string), (Type)null, "Contract");
-
- ExportsAssert.AreEqual(exports, "Parent");
- }
-
- [TestMethod]
- public void GetExportsOfT1_AskingForContractFromChildWithExportInParentContainer_ShouldReturnExport()
- {
- var parent = ContainerFactory.Create(new MicroExport(typeof(string), "Parent"));
- var child = ContainerFactory.Create(parent);
-
- var exports = child.GetExports<string>();
-
- ExportsAssert.AreEqual(exports, "Parent");
- }
-
- [TestMethod]
- public void GetExportsOfT2_AskingForContractFromChildWithExportInParentContainer_ShouldReturnExport()
- {
- var parent = ContainerFactory.Create(new MicroExport("Contract", "Parent"));
- var child = ContainerFactory.Create(parent);
-
- var exports = child.GetExports<string>("Contract");
-
- ExportsAssert.AreEqual(exports, "Parent");
- }
-
- [TestMethod]
- public void GetExportsOfTTMetadataView1_AskingForContractFromChildWithExportInParentContainer_ShouldReturnExport()
- {
- var parent = ContainerFactory.Create(new MicroExport(typeof(string), "Parent"));
- var child = ContainerFactory.Create(parent);
-
- var exports = child.GetExports<string, object>();
-
- ExportsAssert.AreEqual(exports, "Parent");
- }
-
- [TestMethod]
- public void GetExportsOfTTMetadataView2_AskingForContractFromChildWithExportInParentContainer_ShouldReturnExport()
- {
- var parent = ContainerFactory.Create(new MicroExport("Contract", "Parent"));
- var child = ContainerFactory.Create(parent);
-
- var exports = child.GetExports<string, object>("Contract");
-
- ExportsAssert.AreEqual(exports, "Parent");
- }
-
- [TestMethod]
- public void GetExportedValueOfT1_AskingForContractFromChildWithExportInParentContainer_ShouldReturnExport()
- {
- var parent = ContainerFactory.Create(new MicroExport(typeof(string), "Parent"));
- var child = ContainerFactory.Create(parent);
-
- var exportedValue = child.GetExportedValue<string>();
-
- Assert.AreEqual("Parent", exportedValue);
- }
-
- [TestMethod]
- public void GetExportedValueOfT2_AskingForContractFromChildWithExportInParentContainer_ShouldReturnExport()
- {
- var parent = ContainerFactory.Create(new MicroExport("Contract", "Parent"));
- var child = ContainerFactory.Create(parent);
-
- var exportedValue = child.GetExportedValue<string>("Contract");
-
- Assert.AreEqual("Parent", exportedValue);
- }
-
- [TestMethod]
- public void GetExportedValueOrDefaultOfT1_AskingForContractFromChildWithExportInParentContainer_ShouldReturnExport()
- {
- var parent = ContainerFactory.Create(new MicroExport(typeof(string), "Parent"));
- var child = ContainerFactory.Create(parent);
-
- var exportedValue = child.GetExportedValueOrDefault<string>();
-
- Assert.AreEqual("Parent", exportedValue);
- }
-
- [TestMethod]
- public void GetExportedValueOrDefaultOfT2_AskingForContractFromChildWithExportInParentContainer_ShouldReturnExport()
- {
- var parent = ContainerFactory.Create(new MicroExport("Contract", "Parent"));
- var child = ContainerFactory.Create(parent);
-
- var exportedValue = child.GetExportedValueOrDefault<string>("Contract");
-
- Assert.AreEqual("Parent", exportedValue);
- }
-
- [TestMethod]
- public void GetExportedValuesOfT1_AskingForContractFromChildWithExportInParentContainer_ShouldReturnExport()
- {
- var parent = ContainerFactory.Create(new MicroExport(typeof(string), "Parent"));
- var child = ContainerFactory.Create(parent);
-
- var exportedValues = child.GetExportedValues<string>();
-
- EnumerableAssert.AreEqual(exportedValues, "Parent");
- }
-
- [TestMethod]
- public void GetExportedValuesOfT2_AskingForContractFromChildWithExportInParentContainer_ShouldReturnExport()
- {
- var parent = ContainerFactory.Create(new MicroExport("Contract", "Parent"));
- var child = ContainerFactory.Create(parent);
-
- var exportedValues = child.GetExportedValues<string>("Contract");
-
- EnumerableAssert.AreEqual(exportedValues, "Parent");
- }
-
- [TestMethod]
- public void GetExportOfT1_AskingForContractWithExportInBothParentAndChildContainers_ShouldReturnChildExport()
- {
- var parent = ContainerFactory.Create(new MicroExport(typeof(string), "Parent"));
- var child = ContainerFactory.Create(parent, new MicroExport(typeof(string), "Child"));
-
- var export = child.GetExport<string>();
-
- Assert.AreEqual("Child", export.Value);
- }
-
- [TestMethod]
- public void GetExportOfT2_AskingForContractWithExportInBothParentAndChildContainers_ShouldReturnChildExport()
- {
- var parent = ContainerFactory.Create(new MicroExport("Contract", "Parent"));
- var child = ContainerFactory.Create(parent, new MicroExport("Contract", "Child"));
-
- var export = child.GetExport<string>("Contract");
-
- Assert.AreEqual("Child", export.Value);
- }
-
- [TestMethod]
- public void GetExportOfTTMetadataView1_AskingForContractWithExportInBothParentAndChildContainers_ShouldReturnChildExport()
- {
- var parent = ContainerFactory.Create(new MicroExport(typeof(string), "Parent"));
- var child = ContainerFactory.Create(parent, new MicroExport(typeof(string), "Child"));
-
- var export = child.GetExport<string, object>();
-
- Assert.AreEqual("Child", export.Value);
- }
-
- [TestMethod]
- public void GetExportOfTTMetadataView2_AskingForContractWithExportInBothParentAndChildContainers_ShouldReturnChildExport()
- {
- var parent = ContainerFactory.Create(new MicroExport("Contract", "Parent"));
- var child = ContainerFactory.Create(parent, new MicroExport("Contract", "Child"));
-
- var export = child.GetExport<string, object>("Contract");
-
- Assert.AreEqual("Child", export.Value);
- }
-
- [TestMethod]
- public void GetExports1_AskingForExactlyOneContractWithExportInBothParentAndChildContainers_ShouldReturnChildExport()
- {
- var parent = ContainerFactory.Create(new MicroExport("Contract", "Parent"));
- var child = ContainerFactory.Create(parent, new MicroExport("Contract", "Child"));
-
- var definition = ImportDefinitionFactory.Create("Contract", ImportCardinality.ExactlyOne);
-
- var exports = child.GetExports(definition);
-
- ExportsAssert.AreEqual(exports, "Child");
- }
-
- [TestMethod]
- public void GetExports1_AskingForZeroOrOneContractWithExportInBothParentAndChildContainers_ShouldReturnChildExport()
- {
- var parent = ContainerFactory.Create(new MicroExport("Contract", "Parent"));
- var child = ContainerFactory.Create(parent, new MicroExport("Contract", "Child"));
-
- var definition = ImportDefinitionFactory.Create("Contract", ImportCardinality.ZeroOrOne);
-
- var exports = child.GetExports(definition);
-
- ExportsAssert.AreEqual(exports, "Child");
- }
-
- [TestMethod]
- public void GetExports1_AskingForZeroOrMoreContractWithExportInBothParentAndChildContainers_ShouldReturnBothExports()
- {
- var parent = ContainerFactory.Create(new MicroExport("Contract", "Parent"));
- var child = ContainerFactory.Create(parent, new MicroExport("Contract", "Child"));
-
- var definition = ImportDefinitionFactory.Create("Contract", ImportCardinality.ZeroOrMore);
-
- var exports = child.GetExports(definition);
-
- ExportsAssert.AreEqual(exports, "Child", "Parent");
- }
-
- [TestMethod]
- public void GetExports2_AskingForContractWithExportInBothParentAndChildContainers_ShouldReturnBothExports()
- {
- var parent = ContainerFactory.Create(new MicroExport("Contract", "Parent"));
- var child = ContainerFactory.Create(parent, new MicroExport("Contract", "Child"));
-
- var exports = child.GetExports(typeof(string), (Type)null, "Contract");
-
- ExportsAssert.AreEqual(exports, "Child", "Parent");
- }
-
- [TestMethod]
- public void GetExportsOfT1_AskingForContractWithExportInBothParentAndChildContainers_ShouldReturnBothExports()
- {
- var parent = ContainerFactory.Create(new MicroExport(typeof(string), "Parent"));
- var child = ContainerFactory.Create(parent, new MicroExport(typeof(string), "Child"));
-
- var exports = child.GetExports<string>();
-
- ExportsAssert.AreEqual(exports, "Child", "Parent");
- }
-
- [TestMethod]
- public void GetExportsOfT2_AskingForContractWithExportInBothParentAndChildContainers_ShouldReturnBothExports()
- {
- var parent = ContainerFactory.Create(new MicroExport("Contract", "Parent"));
- var child = ContainerFactory.Create(parent, new MicroExport("Contract", "Child"));
-
- var exports = child.GetExports<string>("Contract");
-
- ExportsAssert.AreEqual(exports, "Child", "Parent");
- }
-
- [TestMethod]
- public void GetExportsOfTTMetadataView1_AskingForContractWithExportInBothParentAndChildContainers_ShouldReturnBothExports()
- {
- var parent = ContainerFactory.Create(new MicroExport(typeof(string), "Parent"));
- var child = ContainerFactory.Create(parent, new MicroExport(typeof(string), "Child"));
-
-
- var exports = child.GetExports<string, object>();
-
- ExportsAssert.AreEqual(exports, "Child", "Parent");
- }
-
- [TestMethod]
- public void GetExportsOfTTMetadataView2_AskingForContractWithExportInBothParentAndChildContainers_ShouldReturnBothExports()
- {
- var parent = ContainerFactory.Create(new MicroExport("Contract", "Parent"));
- var child = ContainerFactory.Create(parent, new MicroExport("Contract", "Child"));
-
- var exports = child.GetExports<string, object>("Contract");
-
- ExportsAssert.AreEqual(exports, "Child", "Parent");
- }
-
- [TestMethod]
- public void GetExportedValueOfT1_AskingForContractWithExportInBothParentAndChildContainers_ShouldReturnChildExport()
- {
- var parent = ContainerFactory.Create(new MicroExport(typeof(string), "Parent"));
- var child = ContainerFactory.Create(parent, new MicroExport(typeof(string), "Child"));
-
- var exportedValue = child.GetExportedValue<string>();
-
- Assert.AreEqual("Child", exportedValue);
- }
-
- [TestMethod]
- public void GetExportedValueOfT2_AskingForContractWithExportInBothParentAndChildContainers_ShouldReturnChildExport()
- {
- var parent = ContainerFactory.Create(new MicroExport("Contract", "Parent"));
- var child = ContainerFactory.Create(parent, new MicroExport("Contract", "Child"));
-
- var exportedValue = child.GetExportedValue<string>("Contract");
-
- Assert.AreEqual("Child", exportedValue);
- }
-
- [TestMethod]
- public void GetExportedValueOrDefaultOfT1_AskingForContractWithExportInBothParentAndChildContainers_ShouldReturnChildExport()
- {
- var parent = ContainerFactory.Create(new MicroExport(typeof(string), "Parent"));
- var child = ContainerFactory.Create(parent, new MicroExport(typeof(string), "Child"));
-
- var exportedValue = child.GetExportedValueOrDefault<string>();
-
- Assert.AreEqual("Child", exportedValue);
- }
-
- [TestMethod]
- public void GetExportedValueOrDefaultOfT2_AskingForContractWithExportInBothParentAndChildContainers_ShouldReturnChildExport()
- {
- var parent = ContainerFactory.Create(new MicroExport("Contract", "Parent"));
- var child = ContainerFactory.Create(parent, new MicroExport("Contract", "Child"));
-
- var exportedValue = child.GetExportedValueOrDefault<string>("Contract");
-
- Assert.AreEqual("Child", exportedValue);
- }
-
- [TestMethod]
- public void GetExportedValuesOfT1_AskingForContractWithExportInBothParentAndChildContainers_ShouldReturnBothExports()
- {
- var parent = ContainerFactory.Create(new MicroExport(typeof(string), "Parent"));
- var child = ContainerFactory.Create(parent, new MicroExport(typeof(string), "Child"));
-
- var exportedValues = child.GetExportedValues<string>();
-
- EnumerableAssert.AreEqual(exportedValues, "Child", "Parent");
- }
-
- [TestMethod]
- public void GetExportedValuesOfT2_AskingForContractWithExportInBothParentAndChildContainers_ShouldReturnBothExports()
- {
- var parent = ContainerFactory.Create(new MicroExport("Contract", "Parent"));
- var child = ContainerFactory.Create(parent, new MicroExport("Contract", "Child"));
-
- var exportedValues = child.GetExportedValues<string>("Contract");
-
- EnumerableAssert.AreEqual(exportedValues, "Child", "Parent");
- }
-
- [TestMethod]
- public void GetExportOfTTMetadataView1_TypeAsMetadataViewTypeArgument_IsUsedAsMetadataConstraint()
- {
- var metadata = new Dictionary<string, object>();
- metadata.Add("Metadata1", "MetadataValue1");
- metadata.Add("Metadata2", "MetadataValue2");
- metadata.Add("Metadata3", "MetadataValue3");
-
- var container = ContainerFactory.Create(new MicroExport("Another", metadata, "Value1"),
- new MicroExport(typeof(string), metadata, "Value1"),
- new MicroExport(typeof(string), "Value2"));
-
- var export = container.GetExport<string, IMetadataView>();
- var metadataExport = (Lazy<string, IMetadataView>)export;
-
- Assert.AreEqual("Value1", metadataExport.Value);
- Assert.AreEqual("MetadataValue1", metadataExport.Metadata.Metadata1);
- Assert.AreEqual("MetadataValue2", metadataExport.Metadata.Metadata2);
- Assert.AreEqual("MetadataValue3", metadataExport.Metadata.Metadata3);
- }
-
- [TestMethod]
- public void GetExportOfTTMetadataView2_TypeAsMetadataViewTypeArgument_IsUsedAsMetadataConstraint()
- {
- var metadata = new Dictionary<string, object>();
- metadata.Add("Metadata1", "MetadataValue1");
- metadata.Add("Metadata2", "MetadataValue2");
- metadata.Add("Metadata3", "MetadataValue3");
-
- var container = ContainerFactory.Create(new MicroExport("Another", metadata, "Value1"),
- new MicroExport("Contract", metadata, "Value1"),
- new MicroExport("Contract", "Value2"));
-
- var export = container.GetExport<string, IMetadataView>("Contract");
- var metadataExport = (Lazy<string, IMetadataView>)export;
-
- Assert.AreEqual("Value1", metadataExport.Value);
- Assert.AreEqual("MetadataValue1", metadataExport.Metadata.Metadata1);
- Assert.AreEqual("MetadataValue2", metadataExport.Metadata.Metadata2);
- Assert.AreEqual("MetadataValue3", metadataExport.Metadata.Metadata3);
- }
-
- [TestMethod]
- public void GetExports1_TypeAsMetadataViewTypeArgument_IsUsedAsMetadataConstraint()
- {
- var metadata = new Dictionary<string, object>();
- metadata.Add("Metadata1", "MetadataValue1");
- metadata.Add("Metadata2", "MetadataValue2");
- metadata.Add("Metadata3", "MetadataValue3");
-
- var container = ContainerFactory.Create(new MicroExport("Another", metadata, "Value1"),
- new MicroExport("Contract", metadata, "Value1"),
- new MicroExport("Contract", "Value2"));
-
- var definition = ImportDefinitionFactory.Create(
- "Contract",
- new Dictionary<string, Type> { { "Metadata1", typeof(object) }, { "Metadata2", typeof(object) }, { "Metadata3", typeof(object) } }
- );
-
- var exports = container.GetExports(definition);
-
- Assert.AreEqual(1, exports.Count());
-
- var export = exports.First();
-
- Assert.AreEqual("Value1", export.Value);
- EnumerableAssert.AreEqual(metadata, export.Metadata);
- }
-
- [TestMethod]
- public void GetExports2_TypeAsMetadataViewTypeArgument_IsUsedAsMetadataConstraint()
- {
- var metadata = new Dictionary<string, object>();
- metadata.Add("Metadata1", "MetadataValue1");
- metadata.Add("Metadata2", "MetadataValue2");
- metadata.Add("Metadata3", "MetadataValue3");
-
- var container = ContainerFactory.Create(new MicroExport("Another", metadata, "Value1"),
- new MicroExport("Contract", metadata, "Value1"),
- new MicroExport("Contract", "Value2"));
-
- var exports = container.GetExports(typeof(string), typeof(IMetadataView), "Contract");
-
- Assert.AreEqual(1, exports.Count());
-
- var export = exports.First();
- IMetadataView exportMetadata = export.Metadata as IMetadataView;
-
- Assert.AreEqual("Value1", export.Value);
- Assert.IsNotNull(exportMetadata);
-
- Assert.AreEqual("MetadataValue1", exportMetadata.Metadata1);
- Assert.AreEqual("MetadataValue2", exportMetadata.Metadata2);
- Assert.AreEqual("MetadataValue3", exportMetadata.Metadata3);
- }
-
- [TestMethod]
- public void GetExportsOfTTMetadataView1_TypeAsMetadataViewTypeArgument_IsUsedAsMetadataConstraint()
- {
- var metadata = new Dictionary<string, object>();
- metadata.Add("Metadata1", "MetadataValue1");
- metadata.Add("Metadata2", "MetadataValue2");
- metadata.Add("Metadata3", "MetadataValue3");
-
- var container = ContainerFactory.Create(new MicroExport("Another", metadata, "Value1"),
- new MicroExport(typeof(string), metadata, "Value1"),
- new MicroExport(typeof(string), "Value2"));
-
- var exports = container.GetExports<string, IMetadataView>();
-
- Assert.AreEqual(1, exports.Count());
-
- var export = (Lazy<string, IMetadataView>)exports.First();
-
- Assert.AreEqual("Value1", export.Value);
- Assert.AreEqual("MetadataValue1", export.Metadata.Metadata1);
- Assert.AreEqual("MetadataValue2", export.Metadata.Metadata2);
- Assert.AreEqual("MetadataValue3", export.Metadata.Metadata3);
- }
-
- [TestMethod]
- public void GetExportsOfTTMetadataView2_TypeAsMetadataViewTypeArgument_IsUsedAsMetadataConstraint()
- {
- var metadata = new Dictionary<string, object>();
- metadata.Add("Metadata1", "MetadataValue1");
- metadata.Add("Metadata2", "MetadataValue2");
- metadata.Add("Metadata3", "MetadataValue3");
-
- var container = ContainerFactory.Create(new MicroExport("Another", metadata, "Value1"),
- new MicroExport("Contract", metadata, "Value1"),
- new MicroExport("Contract", "Value2"));
-
- var exports = container.GetExports<string, IMetadataView>("Contract");
-
- Assert.AreEqual(1, exports.Count());
-
- var export = (Lazy<string, IMetadataView>)exports.First();
-
- Assert.AreEqual("Value1", export.Value);
- Assert.AreEqual("MetadataValue1", export.Metadata.Metadata1);
- Assert.AreEqual("MetadataValue2", export.Metadata.Metadata2);
- Assert.AreEqual("MetadataValue3", export.Metadata.Metadata3);
- }
-
-
- [TestMethod]
- public void GetExports1_AskingForExactlyOneAndAllWhenContainerEmpty_ShouldThrowCardinalityMismatch()
- {
- var container = CreateCompositionContainer();
-
- var definition = ImportDefinitionFactory.Create(export => true, ImportCardinality.ExactlyOne);
-
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- {
- container.GetExports(definition);
- });
- }
-
- [TestMethod]
- public void GetExports1_AskingForZeroOrOneAndAllWhenContainerEmpty_ShouldReturnEmpty()
- {
- var container = CreateCompositionContainer();
-
- var definition = ImportDefinitionFactory.Create(export => true, ImportCardinality.ZeroOrOne);
-
- var exports = container.GetExports(definition);
-
- EnumerableAssert.IsEmpty(exports);
- }
-
- [TestMethod]
- public void GetExports1_AskingForExactlyOneAndAllWhenContainerEmpty_ShouldReturnEmpty()
- {
- var container = CreateCompositionContainer();
-
- var definition = ImportDefinitionFactory.Create(export => true, ImportCardinality.ZeroOrMore);
-
- var exports = container.GetExports(definition);
-
- EnumerableAssert.IsEmpty(exports);
- }
-
- [TestMethod]
- [Ignore]
- [WorkItem(465976)]
- public void RemovePart_PartNotInContainerAsPartArgument_ShouldNotCauseImportsToBeRebound()
- {
- const string contractName = "Contract";
-
- var exporter = PartFactory.CreateExporter(new MicroExport(contractName, 1));
- var importer = PartFactory.CreateImporter(contractName);
- var container = ContainerFactory.Create(exporter, importer);
-
-
- Assert.AreEqual(1, importer.Value);
- Assert.AreEqual(1, importer.ImportSatisfiedCount);
-
- var doesNotExistInContainer = PartFactory.CreateExporter(new MicroExport(contractName, 2));
-
- CompositionBatch batch = new CompositionBatch();
- batch.RemovePart(doesNotExistInContainer);
- container.Compose(batch);
-
- Assert.AreEqual(1, importer.ImportSatisfiedCount);
- }
-
- [TestMethod]
- [Ignore]
- [WorkItem(436847)]
- public void RemovePart_PartInContainerQueueAsPartArgument_ShouldNotLeavePartInContainer()
- {
- const string contractName = "Contract";
-
- var exporter = PartFactory.CreateExporter(new MicroExport(contractName, 1));
- var importer = PartFactory.CreateImporter(contractName);
- var container = ContainerFactory.Create(exporter, importer);
-
- CompositionBatch batch = new CompositionBatch();
- batch.RemovePart(exporter);
- container.Compose(batch);
-
- Assert.IsNull(importer.Value);
- Assert.AreEqual(2, importer.ImportSatisfiedCount);
- }
-
- [TestMethod]
- public void RemovePart_PartAlreadyRemovedAsPartArgument_ShouldNotThrow()
- {
- var exporter = PartFactory.CreateExporter(new MicroExport("Contract", 1));
- var container = ContainerFactory.Create(exporter);
-
- Assert.AreEqual(1, container.GetExportedValue<int>("Contract"));
-
- CompositionBatch batch = new CompositionBatch();
- batch.RemovePart(exporter);
- container.Compose(batch);
-
- Assert.IsFalse(container.IsPresent("Contract"));
-
- batch = new CompositionBatch();
- batch.RemovePart(exporter);
- container.Compose(batch);
-
- Assert.IsFalse(container.IsPresent("Contract"));
- }
-
- [TestMethod]
- public void TryComposeSimple()
- {
- var container = CreateCompositionContainer();
- Int32Importer importer = new Int32Importer();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddParts(importer, new Int32Exporter(42));
- container.Compose(batch);
-
- Assert.AreEqual(42, importer.Value, "Expected value imported from export");
- }
-
- [TestMethod]
- public void TryComposeSimpleFail()
- {
- var container = CreateCompositionContainer();
- Int32Importer importer = new Int32Importer();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddParts(importer);
-
- CompositionAssert.ThrowsChangeRejectedError(ErrorId.ImportEngine_PartCannotSetImport, ErrorId.ImportEngine_ImportCardinalityMismatch, RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
-
- Assert.AreEqual(0, importer.Value, "Expected default value to remain");
- }
-
- [TestMethod]
- public void ComposeDisposableChildContainer()
- {
- var outerContainer = CreateCompositionContainer();
- Int32Importer outerImporter = new Int32Importer();
-
- CompositionBatch outerBatch = new CompositionBatch();
- var key = outerBatch.AddExportedValue("Value", 42);
- outerBatch.AddPart(outerImporter);
- outerContainer.Compose(outerBatch);
- Assert.AreEqual(42, outerImporter.Value, "Expected value imported from export");
-
- Int32Importer innerImporter = new Int32Importer();
- var innerContainer = new CompositionContainer(outerContainer);
- CompositionBatch innerBatch = new CompositionBatch();
- innerBatch.AddPart(innerImporter);
-
- innerContainer.Compose(innerBatch);
- Assert.AreEqual(42, innerImporter.Value, "Expected value imported from export");
- Assert.AreEqual(42, outerImporter.Value, "Expected value imported from export");
-
- outerBatch = new CompositionBatch();
- outerBatch.RemovePart(key);
- key = outerBatch.AddExportedValue("Value", -5);
- outerContainer.Compose(outerBatch);
- Assert.AreEqual(-5, innerImporter.Value, "Expected update value imported from export");
- Assert.AreEqual(-5, outerImporter.Value, "Expected updated value imported from export");
-
- innerContainer.Dispose();
- outerBatch = new CompositionBatch();
- outerBatch.RemovePart(key);
- key = outerBatch.AddExportedValue("Value", 500);
- outerContainer.Compose(outerBatch);
- Assert.AreEqual(500, outerImporter.Value, "Expected updated value imported from export");
- Assert.AreEqual(-5, innerImporter.Value, "Expected value not updated");
- }
-
- [TestMethod]
- public void RemoveValueTest()
- {
- var container = CreateCompositionContainer();
- CompositionBatch batch = new CompositionBatch();
-
- var key = batch.AddExportedValue("foo", "hello");
- container.Compose(batch);
- var result = container.GetExportedValue<string>("foo");
- Assert.AreEqual("hello", result, "Should get the correct value");
-
- batch = new CompositionBatch();
- batch.RemovePart(key);
- container.Compose(batch);
-
- Assert.IsFalse(container.IsPresent("foo"));
-
- batch = new CompositionBatch();
- batch.RemovePart(key); // Remove should be idempotent
- container.Compose(batch);
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void OptionalImportsOfValueTypeBoundToDefaultValueShouldNotAffectAvailableValues()
- {
- var container = CreateCompositionContainer();
- var importer = new OptionalImporter();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- container.Compose(batch);
-
- Assert.AreEqual(0, importer.ValueType);
-
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- {
- container.GetExportedValue<int>("ValueType");
- });
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void OptionalImportsOfNullableValueTypeBoundToDefaultValueShouldNotAffectAvailableValues()
- {
- var container = CreateCompositionContainer();
- var importer = new OptionalImporter();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- container.Compose(batch);
-
- Assert.IsNull(importer.NullableValueType);
-
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- {
- container.GetExportedValue<int>("NullableValueType");
- });
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void OptionalImportsOfReferenceTypeBoundToDefaultValueShouldNotAffectAvailableValues()
- {
- var container = CreateCompositionContainer();
- var importer = new OptionalImporter();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- container.Compose(batch);
-
- Assert.IsNull(importer.ReferenceType);
-
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- {
- container.GetExportedValue<int>("ReferenceType");
- });
- }
-
- [TestMethod]
- public void ExportsChanged_ExportNothing_ShouldNotFireExportsChanged()
- {
- var container = CreateCompositionContainer();
-
- container.ExportsChanged += (sender, args) =>
- {
- Assert.Fail("Event should not be fired!");
- };
-
- CompositionBatch batch = new CompositionBatch();
- container.Compose(batch);
- }
-
- [TestMethod]
- public void ExportsChanged_ExportAdded_ShouldFireExportsChanged()
- {
- var container = CreateCompositionContainer();
- IEnumerable<string> changedNames = null;
-
- container.ExportsChanged += (sender, args) =>
- {
- Assert.AreSame(container, sender);
- Assert.IsNull(changedNames, "Ensure this event only fires once!");
- Assert.IsNotNull(args.AddedExports);
- Assert.IsNotNull(args.RemovedExports);
- Assert.IsNotNull(args.ChangedContractNames);
- changedNames = args.ChangedContractNames;
- };
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddExportedValue("MyExport", new object());
- container.Compose(batch);
-
- EnumerableAssert.AreEqual(changedNames, "MyExport");
- }
-
- [TestMethod]
- public void ExportsChanged_ExportRemoved_ShouldFireExportsChanged()
- {
- var container = CreateCompositionContainer();
- IEnumerable<string> changedNames = null;
-
- CompositionBatch batch = new CompositionBatch();
- var part = batch.AddExportedValue("MyExport", new object());
- container.Compose(batch);
-
- container.ExportsChanged += (sender, args) =>
- {
- Assert.AreSame(container, sender);
- Assert.IsNull(changedNames, "Ensure this event only fires once!");
- Assert.IsNotNull(args.AddedExports);
- Assert.IsNotNull(args.RemovedExports);
- Assert.IsNotNull(args.ChangedContractNames);
- changedNames = args.ChangedContractNames;
- };
-
- batch = new CompositionBatch();
- batch.RemovePart(part);
- container.Compose(batch);
-
- EnumerableAssert.AreEqual(changedNames, "MyExport");
- }
-
- [TestMethod]
- public void ExportsChanged_ExportAddAnother_ShouldFireExportsChanged()
- {
- var container = CreateCompositionContainer();
- IEnumerable<string> changedNames = null;
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddExportedValue("MyExport", new object());
- container.Compose(batch);
-
- container.ExportsChanged += (sender, args) =>
- {
- Assert.AreSame(container, sender);
- Assert.IsNull(changedNames, "Ensure this event only fires once!");
- Assert.IsNotNull(args.AddedExports);
- Assert.IsNotNull(args.RemovedExports);
- Assert.IsNotNull(args.ChangedContractNames);
- changedNames = args.ChangedContractNames;
- };
-
- batch = new CompositionBatch();
- // Adding another should cause an update.
- batch.AddExportedValue("MyExport", new object());
- container.Compose(batch);
-
-
- EnumerableAssert.AreEqual(changedNames, "MyExport");
- }
-
- [TestMethod]
- public void ExportsChanged_AddExportOnParent_ShouldFireExportsChangedOnBoth()
- {
- var parent = CreateCompositionContainer();
- var child = new CompositionContainer(parent);
-
- IEnumerable<string> parentNames = null;
- parent.ExportsChanged += (sender, args) =>
- {
- Assert.AreSame(parent, sender);
- parentNames = args.ChangedContractNames;
- };
-
- IEnumerable<string> childNames = null;
- child.ExportsChanged += (sender, args) =>
- {
- Assert.AreSame(child, sender);
- childNames = args.ChangedContractNames;
- };
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddExportedValue("MyExport", new object());
- parent.Compose(batch);
-
- EnumerableAssert.AreEqual(parentNames, "MyExport");
- EnumerableAssert.AreEqual(childNames, "MyExport");
- }
-
-
- [TestMethod]
- public void ExportsChanged_AddExportOnChild_ShouldFireExportsChangedOnChildOnly()
- {
- var parent = CreateCompositionContainer();
- var child = new CompositionContainer(parent);
-
- parent.ExportsChanged += (sender, args) =>
- {
- Assert.Fail("Should not fire on parent container!!");
- };
-
- IEnumerable<string> childNames = null;
- child.ExportsChanged += (sender, args) =>
- {
- Assert.AreSame(child, sender);
- childNames = args.ChangedContractNames;
- };
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddExportedValue("MyExport2", new object());
- child.Compose(batch);
-
- EnumerableAssert.AreEqual(childNames, "MyExport2");
- }
-
-
- [TestMethod]
- public void Dispose_BeforeCompose_CanBeCallMultipleTimes()
- {
- var container = ContainerFactory.Create(PartFactory.Create(), PartFactory.Create());
- container.Dispose();
- container.Dispose();
- container.Dispose();
- }
-
- [TestMethod]
- public void Dispose_AfterCompose_CanBeCallMultipleTimes()
- {
- var container = ContainerFactory.Create(PartFactory.Create(), PartFactory.Create());
- container.Dispose();
- container.Dispose();
- container.Dispose();
- }
-
- [TestMethod]
- public void Dispose_CallsGCSuppressFinalize()
- {
- bool finalizerCalled = false;
-
- var container = ContainerFactory.CreateDisposable(disposing =>
- {
- if (!disposing)
- {
- finalizerCalled = true;
- }
-
- });
-
- container.Dispose();
-
- GC.Collect();
- GC.WaitForPendingFinalizers();
- GC.Collect();
-
- Assert.IsFalse(finalizerCalled);
- }
-
- [TestMethod]
- public void Dispose_CallsDisposeBoolWithTrue()
- {
- var container = ContainerFactory.CreateDisposable(disposing =>
- {
- Assert.IsTrue(disposing);
- });
-
- container.Dispose();
- }
-
- [TestMethod]
- public void Dispose_CallsDisposeBoolOnce()
- {
- int disposeCount = 0;
-
- var container = ContainerFactory.CreateDisposable(disposing =>
- {
- disposeCount++;
- });
-
- container.Dispose();
-
- Assert.AreEqual(1, disposeCount);
- }
-
- [TestMethod]
- public void Dispose_ContainerAsExportedValue_CanBeDisposed()
- {
- using (var container = CreateCompositionContainer())
- {
- CompositionBatch batch = new CompositionBatch();
- batch.AddExportedValue<ICompositionService>(container);
- container.Compose(batch);
- }
- }
-
- [TestMethod]
- public void Dispose_ContainerAsPart_CanBeDisposed()
- { // Tests that when we re-enter CompositionContainer.Dispose, that we don't
- // stack overflow.
-
- using (var container = CreateCompositionContainer())
- {
- var part = PartFactory.CreateExporter(new MicroExport(typeof(ICompositionService), container));
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(part);
- container.Compose(batch);
-
- Assert.AreSame(container, container.GetExportedValue<ICompositionService>());
- }
- }
-
- [TestMethod]
- public void ICompositionService_ShouldNotBeImplicitlyExported()
- {
- var container = CreateCompositionContainer();
-
- Assert.IsFalse(container.IsPresent<ICompositionService>());
- }
-
- [TestMethod]
- public void CompositionContainer_ShouldNotBeImplicitlyExported()
- {
- var container = CreateCompositionContainer();
-
- Assert.IsFalse(container.IsPresent<CompositionContainer>());
- }
-
- [TestMethod]
- public void ICompositionService_ShouldNotBeImplicitlyImported()
- {
- var importer = PartFactory.CreateImporter<ICompositionService>();
- var container = ContainerFactory.Create(importer);
-
- Assert.IsNull(importer.Value);
- }
-
- [TestMethod]
- public void CompositionContainer_ShouldNotBeImplicitlyImported()
- {
- var importer = PartFactory.CreateImporter<CompositionContainer>();
- var container = ContainerFactory.Create(importer);
-
- Assert.IsNull(importer.Value);
- }
-
- [TestMethod]
- public void ICompositionService_CanBeExported()
- {
- var container = CreateCompositionContainer();
- CompositionBatch batch = new CompositionBatch();
- batch.AddExportedValue<ICompositionService>(container);
- container.Compose(batch);
-
- Assert.AreSame(container, container.GetExportedValue<ICompositionService>());
- }
-
- [TestMethod]
- public void CompositionContainer_CanBeExported()
- {
- var container = CreateCompositionContainer();
- CompositionBatch batch = new CompositionBatch();
- batch.AddExportedValue<CompositionContainer>(container);
- container.Compose(batch);
-
- Assert.AreSame(container, container.GetExportedValue<CompositionContainer>());
- }
-
- [TestMethod]
- public void ReleaseExport_Null_ShouldThrowArugmentNull()
- {
- var container = CreateCompositionContainer();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("export",
- () => container.ReleaseExport(null));
- }
-
- [TestMethod]
- public void ReleaseExports_Null_ShouldThrowArgumentNull()
- {
- var container = CreateCompositionContainer();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("exports",
- () => container.ReleaseExports(null));
- }
-
- [TestMethod]
- public void ReleaseExports_ElementNull_ShouldThrowArgument()
- {
- var container = CreateCompositionContainer();
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("exports",
- () => container.ReleaseExports(new Export[] { null }));
- }
-
- public class OptionalImporter
- {
- [Import("ValueType", AllowDefault = true)]
- public int ValueType
- {
- get;
- set;
- }
-
- [Import("NullableValueType", AllowDefault = true)]
- public int? NullableValueType
- {
- get;
- set;
- }
-
- [Import("ReferenceType", AllowDefault = true)]
- public string ReferenceType
- {
- get;
- set;
- }
- }
-
- public class ExportSimpleIntWithException
- {
- [Export("SimpleInt")]
- public int SimpleInt { get { throw new NotImplementedException(); } }
- }
-
- [TestMethod]
- public void TryGetValueWithCatalogVerifyExecptionDuringGet()
- {
- var cat = CatalogFactory.CreateDefaultAttributed();
- var container = new CompositionContainer(cat);
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotGetExportedValue, ErrorId.ReflectionModel_ExportThrewException, () =>
- {
- container.GetExportedValue<int>("SimpleInt");
- });
- }
-
- [TestMethod]
- public void TryGetExportedValueWhileLockedForNotify()
- {
- var container = CreateCompositionContainer();
- CompositionBatch batch = new CompositionBatch();
- batch.AddParts(new CallbackImportNotify(delegate
- {
- container.GetExportedValueOrDefault<int>();
- }));
-
- container.Compose(batch);
- }
-
- [TestMethod]
- public void RawExportTests()
- {
- var container = CreateCompositionContainer();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddExportedValue("foo", 1);
- container.Compose(batch);
-
- Lazy<int> export = container.GetExport<int>("foo");
-
- Assert.AreEqual(1, export.Value, "Should be the value I put in...");
- }
-
- [TestMethod]
- [Ignore]
- [WorkItem(468388)]
- public void ContainerXGetXTest()
- {
- CompositionContainer container = CreateCompositionContainer();
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(new MyExporterWithNoFoo());
- container.Compose(batch);
- ContainerXGetExportBoundValue(container);
- }
-
- [TestMethod]
- [Ignore]
- [WorkItem(468388)]
- public void ContainerXGetXByComponentCatalogTest()
- {
- CompositionContainer container = ContainerFactory.CreateWithDefaultAttributedCatalog();
- ContainerXGetExportBoundValue(container);
- }
-
- private void ContainerXGetExportBoundValue(CompositionContainer container)
- {
- Assert.Fail("This scenario (required metadata warnings) no longer works, see 468388");
-
- //string[] required = new string[] { "Foo" };
- //string[] RequiredMetadataNotFound = new string[] { CompositionIssueId.RequiredMetadataNotFound, CompositionIssueId.CardinalityMismatch };
- //container.TryGetExport<MyExporterWithNoFoo>().VerifyFailure(CompositionIssueId.CardinalityMismatch);
- //container.TryGetExport<MyExporterWithNoFoo>(required).VerifyFailure(CompositionIssueId.CardinalityMismatch);
- //container.TryGetExport<MyExporterWithNoFoo>("MyExporterWithNoFoo").VerifySuccess();
- //container.TryGetExport<MyExporterWithNoFoo>("MyExporterWithNoFoo", required).VerifyFailure(RequiredMetadataNotFound);
- //container.TryGetExports<MyExporterWithNoFoo>().VerifyFailure(CompositionIssueId.CardinalityMismatch);
- //container.TryGetExports<MyExporterWithNoFoo>(required).VerifyFailure(CompositionIssueId.CardinalityMismatch);
- //container.TryGetExports<MyExporterWithNoFoo>("MyExporterWithNoFoo").VerifySuccess();
- //container.TryGetExports<MyExporterWithNoFoo>("MyExporterWithNoFoo", required).VerifyFailure(RequiredMetadataNotFound);
- //container.TryGetExportedValue<MyExporterWithNoFoo>().VerifyFailure(CompositionIssueId.CardinalityMismatch);
- //container.TryGetExportedValue<MyExporterWithNoFoo>(required).VerifyFailure(CompositionIssueId.CardinalityMismatch);
- //container.TryGetExportedValue<MyExporterWithNoFoo>("MyExporterWithNoFoo").VerifySuccess();
- //container.TryGetExportedValue<MyExporterWithNoFoo>("MyExporterWithNoFoo", required).VerifyFailure(RequiredMetadataNotFound);
- //container.TryGetExportedValues<MyExporterWithNoFoo>().VerifyFailure(CompositionIssueId.CardinalityMismatch);
- //container.TryGetExportedValues<MyExporterWithNoFoo>(required).VerifyFailure(CompositionIssueId.CardinalityMismatch);
- //container.TryGetExportedValues<MyExporterWithNoFoo>("MyExporterWithNoFoo").VerifySuccess();
- //container.TryGetExportedValues<MyExporterWithNoFoo>("MyExporterWithNoFoo", required).VerifyFailure(RequiredMetadataNotFound);
-
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() => container.GetExportedValue<MyExporterWithNoFoo>());
- Assert.IsNotNull(container.GetExportedValue<MyExporterWithNoFoo>("MyExporterWithNoFoo"));
- }
-
- [Export("MyExporterWithNoFoo")]
- public class MyExporterWithNoFoo
- {
- }
-
- [Export("MyExporterWithFoo")]
- [ExportMetadata("Foo", "Foo value")]
- public class MyExporterWithFoo
- {
- }
-
- [Export("MyExporterWithFooBar")]
- [ExportMetadata("Foo", "Foo value")]
- [ExportMetadata("Bar", "Bar value")]
- public class MyExporterWithFooBar
- {
- }
-
-#if !SILVERLIGHT
- // Silverlight doesn't support strongly typed metadata
- [TestMethod]
- public void ConverterExportTests()
- {
- var container = CreateCompositionContainer();
- CompositionBatch batch = new CompositionBatch();
- batch.AddExportedValue("foo", 1);
- container.Compose(batch);
-
- var export = container.GetExport<int, IDictionary<string, object>>("foo");
- Assert.AreEqual(1, export.Value, "Should be the value I put in...");
- Assert.IsNotNull(export.Metadata, "Should have metadata (as an object)");
- }
-
-#endif //!SILVERLIGHT
-
- [TestMethod]
- public void RemoveFromWrongContainerTest()
- {
- CompositionContainer d1 = CreateCompositionContainer();
- CompositionContainer d2 = CreateCompositionContainer();
-
- CompositionBatch batch1 = new CompositionBatch();
- var valueKey = batch1.AddExportedValue("a", 1);
- d1.Compose(batch1);
-
- CompositionBatch batch2 = new CompositionBatch();
- batch2.RemovePart(valueKey);
- // removing entry from wrong container, shoudl be a no-op
- d2.Compose(batch2);
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void AddPartSimple()
- {
- var container = CreateCompositionContainer();
- var importer = new Int32Importer();
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- batch.AddPart(new Int32Exporter(42));
- container.Compose(batch);
-
- Assert.AreEqual(42, importer.Value, "Expected value imported from export");
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void AddPart()
- {
- var container = CreateCompositionContainer();
- Int32Importer importer = new Int32Importer();
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(AttributedModelServices.CreatePart(importer));
- batch.AddPart(new Int32Exporter(42));
- container.Compose(batch);
-
- Assert.AreEqual(42, importer.Value, "Expected value imported from export");
- }
-
- [TestMethod]
- public void ComposeReentrantChildContainerDisposed()
- {
- var container = CreateCompositionContainer();
- Int32Importer outerImporter = new Int32Importer();
- Int32Importer innerImporter = new Int32Importer();
- Int32Exporter exporter = new Int32Exporter(42);
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(exporter);
- container.Compose(batch);
- CallbackExecuteCodeDuringCompose callback = new CallbackExecuteCodeDuringCompose(() =>
- {
- using (CompositionContainer innerContainer = new CompositionContainer(container))
- {
- CompositionBatch nestedBatch = new CompositionBatch();
- nestedBatch.AddPart(innerImporter);
- innerContainer.Compose(nestedBatch);
- }
- Assert.AreEqual(42, innerImporter.Value, "Expected value imported from export");
- });
-
- batch = new CompositionBatch();
- batch.AddParts(outerImporter, callback);
- container.Compose(batch);
-
- Assert.AreEqual(42, outerImporter.Value, "Expected value imported from export");
- Assert.AreEqual(42, innerImporter.Value, "Expected value imported from export");
- }
-
- [TestMethod]
- public void ComposeSimple()
- {
- var container = CreateCompositionContainer();
- Int32Importer importer = new Int32Importer();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddParts(importer, new Int32Exporter(42));
- container.Compose(batch);
-
- Assert.AreEqual(42, importer.Value, "Expected value imported from export");
- }
-
- [TestMethod]
- public void ComposeSimpleFail()
- {
- var container = CreateCompositionContainer();
- Int32Importer importer = new Int32Importer();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
-
- CompositionAssert.ThrowsChangeRejectedError(ErrorId.ImportEngine_PartCannotSetImport, // Cannot set Int32Importer.Value because
- ErrorId.ImportEngine_ImportCardinalityMismatch, // No exports are present that match contract
- RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
-
- [TestMethod]
- public void ExceptionDuringNotify()
- {
- var container = CreateCompositionContainer();
- CompositionBatch batch = new CompositionBatch();
- batch.AddParts(new CallbackImportNotify(delegate
- {
- throw new InvalidOperationException();
- }));
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotActivate, // Cannot activate CallbackImportNotify because
- ErrorId.ReflectionModel_PartOnImportsSatisfiedThrewException, // OnImportsSatisfied threw an exception
- RetryMode.DoNotRetry, () =>
- {
- container.Compose(batch);
- });
- }
-
- [TestMethod]
- public void NeutralComposeWhileNotified()
- {
- var container = CreateCompositionContainer();
- CompositionBatch batch = new CompositionBatch();
- batch.AddParts(new CallbackImportNotify(delegate
- {
- // Is this really a supported scenario?
- container.Compose(batch);
- }));
-
- container.Compose(batch);
- }
- public class PartWithReentrantCompose : ComposablePart
- {
- private CompositionContainer _container;
-
- public PartWithReentrantCompose(CompositionContainer container)
- {
- this._container = container;
- }
-
- public override IEnumerable<ExportDefinition> ExportDefinitions
- {
- get
- {
- this._container.ComposeExportedValue<string>("ExportedString");
- return Enumerable.Empty<ExportDefinition>();
- }
- }
-
- public override IEnumerable<ImportDefinition> ImportDefinitions
- {
- get
- {
- return Enumerable.Empty<ImportDefinition>();
- }
- }
-
- public override object GetExportedValue(ExportDefinition definition)
- {
- throw new NotImplementedException();
- }
-
- public override void SetImport(ImportDefinition definition, IEnumerable<Export> exports)
- {
- throw new NotImplementedException();
- }
- }
-
- [Export]
- public class SimpleExporter
- {
-
- }
-
- [TestMethod]
- public void ThreadSafeCompositionContainer()
- {
- TypeCatalog catalog = new TypeCatalog(typeof(SimpleExporter));
-
- CompositionContainer container = new CompositionContainer(catalog, true);
- Int32Importer importer = new Int32Importer();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddParts(importer, new Int32Exporter(42));
- container.Compose(batch);
-
- Assert.IsNotNull(container.GetExportedValue<SimpleExporter>());
- Assert.AreEqual(42, importer.Value, "Expected value imported from export");
-
- container.Dispose();
-
- }
-
- [TestMethod]
- public void ReentrantencyDisabledWhileComposing()
- {
- var container = CreateCompositionContainer();
- CompositionBatch batch = new CompositionBatch();
-
- batch.AddPart(new PartWithReentrantCompose(container));
-
- ExceptionAssert.Throws<InvalidOperationException>(() =>
- container.Compose(batch));
- }
- private static Expression<Func<ExportDefinition, bool>> ConstraintFromContract(string contractName)
- {
- return ConstraintFactory.Create(contractName);
- }
-
- private static string ContractFromType(Type type)
- {
- return AttributedModelServices.GetContractName(type);
- }
-
- private static CompositionContainer CreateCompositionContainer()
- {
- return new CompositionContainer();
- }
-
- public interface IMetadataView
- {
- string Metadata1
- {
- get;
- }
-
- string Metadata2
- {
- get;
- }
-
- string Metadata3
- {
- get;
- }
- }
-
- [TestMethod]
- public void ComposeExportedValueOfT_NullStringAsExportedValueArgument_VerifyCanPullOnValue()
- {
- var container = CreateCompositionContainer();
-
- var expectation = (string)null;
- container.ComposeExportedValue<string>(expectation);
- var actualValue = container.GetExportedValue<string>();
-
- Assert.AreEqual(expectation, actualValue);
- }
-
- [TestMethod]
- public void ComposeExportedValueOfT_StringAsExportedValueArgument_VerifyCanPullOnValue()
- {
- var expectations = new List<string>();
- expectations.Add((string)null);
- expectations.Add(String.Empty);
- expectations.Add("Value");
-
- foreach (var expectation in expectations)
- {
- var container = CreateCompositionContainer();
- container.ComposeExportedValue<string>(expectation);
- var actualValue = container.GetExportedValue<string>();
-
- Assert.AreEqual(expectation, actualValue);
- }
- }
-
- [TestMethod]
- public void ComposeExportedValueOfT_StringAsIEnumerableOfCharAsExportedValueArgument_VerifyCanPullOnValue()
- {
- var expectations = new List<string>();
- expectations.Add((string)null);
- expectations.Add(String.Empty);
- expectations.Add("Value");
-
- foreach (var expectation in expectations)
- {
- var container = CreateCompositionContainer();
- container.ComposeExportedValue<IEnumerable<char>>(expectation);
- var actualValue = container.GetExportedValue<IEnumerable<char>>();
-
- Assert.AreEqual(expectation, actualValue);
- }
- }
-
- [TestMethod]
- public void ComposeExportedValueOfT_ObjectAsExportedValueArgument_VerifyCanPullOnValue()
- {
- var expectations = new List<object>();
- expectations.Add((string)null);
- expectations.Add(String.Empty);
- expectations.Add("Value");
- expectations.Add(42);
- expectations.Add(new object());
-
- foreach (var expectation in expectations)
- {
- var container = CreateCompositionContainer();
- container.ComposeExportedValue<object>(expectation);
- var actualValue = container.GetExportedValue<object>();
-
- Assert.AreEqual(expectation, actualValue);
- }
- }
-
- [TestMethod]
- public void ComposeExportedValueOfT_ExportedValue_ExportedUnderDefaultContractName()
- {
- string expectedContractName = AttributedModelServices.GetContractName(typeof(string));
- var container = CreateCompositionContainer();
- container.ComposeExportedValue<string>("Value");
-
- var importDefinition = new ImportDefinition(ed => true, null, ImportCardinality.ZeroOrMore, false, false);
- var exports = container.GetExports(importDefinition);
- Assert.AreEqual(1, exports.Count());
- Assert.AreEqual(expectedContractName, exports.Single().Definition.ContractName);
- }
-
- [TestMethod]
- public void ComposeExportedValueOfT_ExportedValue_ExportContainsEmptyMetadata()
- {
- var container = CreateCompositionContainer();
- container.ComposeExportedValue<string>("Value");
-
- var importDefinition = new ImportDefinition(ed => true, null, ImportCardinality.ZeroOrMore, false, false);
- var exports = container.GetExports(importDefinition);
- Assert.AreEqual(1, exports.Count());
- Assert.AreEqual(1, exports.Single().Metadata.Count); // contains type identity
- }
-
- [TestMethod]
- public void ComposeExportedValueOfT_ExportedValue_LazyContainsEmptyMetadata()
- {
- var container = CreateCompositionContainer();
- container.ComposeExportedValue<string>("Value");
-
- var lazy = container.GetExport<string, IDictionary<string, object>>();
- Assert.AreEqual(1, lazy.Metadata.Count); // contains type identity
- }
-
- [TestMethod]
- public void ComposeExportedValueOfT_ExportedValue_ImportsAreNotDiscovered()
- {
- var container = CreateCompositionContainer();
- var importer = new PartWithRequiredImport();
-
- container.ComposeExportedValue<object>(importer);
-
- var importDefinition = new ImportDefinition(ed => true, null, ImportCardinality.ZeroOrMore, false, false);
- var exports = container.GetExports(importDefinition);
- Assert.AreEqual(1, exports.Count()); // we only get one if the import was not discovered since the import is not satisfied
- }
-
- [TestMethod]
- public void ComposeExportedValueOfT_NullAsContractName_ThrowsArgumentNullException()
- {
- var container = CreateCompositionContainer();
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("contractName", () =>
- container.ComposeExportedValue<string>((string)null, "Value"));
- }
-
- [TestMethod]
- public void ComposeExportedValueOfT_EmptyStringAsContractName_ThrowsArgumentException()
- {
- var container = CreateCompositionContainer();
- ExceptionAssert.ThrowsArgument<ArgumentException>("contractName", () =>
- container.ComposeExportedValue<string>(String.Empty, "Value"));
- }
-
- [TestMethod]
- public void ComposeExportedValueOfT_ValidContractName_ValidExportedValue_VerifyCanPullOnValue()
- {
- var expectations = new List<Tuple<string, string>>();
- expectations.Add(new Tuple<string, string>(" ", (string)null));
- expectations.Add(new Tuple<string, string>(" ", String.Empty));
- expectations.Add(new Tuple<string, string>(" ", "Value"));
- expectations.Add(new Tuple<string, string>("ContractName", (string)null));
- expectations.Add(new Tuple<string, string>("ContractName", String.Empty));
- expectations.Add(new Tuple<string, string>("ContractName", "Value"));
-
- foreach (var expectation in expectations)
- {
- var container = CreateCompositionContainer();
- container.ComposeExportedValue<string>(expectation.Item1, expectation.Item2);
- var actualValue = container.GetExportedValue<string>(expectation.Item1);
-
- Assert.AreEqual(expectation.Item2, actualValue);
-
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- container.GetExportedValue<string>());
- }
- }
-
- [TestMethod]
- public void ComposeExportedValueOfT_ValidContractName_ExportedValue_ExportedUnderSpecifiedContractName()
- {
- string expectedContractName = "ContractName";
- var container = CreateCompositionContainer();
- container.ComposeExportedValue<string>(expectedContractName, "Value");
-
- var importDefinition = new ImportDefinition(ed => true, null, ImportCardinality.ZeroOrMore, false, false);
- var exports = container.GetExports(importDefinition);
- Assert.AreEqual(1, exports.Count());
- Assert.AreEqual(expectedContractName, exports.Single().Definition.ContractName);
- }
-
- [TestMethod]
- [Ignore]
- [WorkItem(812029)]
- public void ComposeExportedValueOfT_ValidContractName_ExportedValue_ExportContainsEmptyMetadata()
- {
- string expectedContractName = "ContractName";
- var container = CreateCompositionContainer();
- container.ComposeExportedValue<string>(expectedContractName, "Value");
-
- var importDefinition = new ImportDefinition(ed => ed.ContractName == expectedContractName, null, ImportCardinality.ZeroOrMore, false, false);
- var exports = container.GetExports(importDefinition);
- Assert.AreEqual(1, exports.Count());
- Assert.AreEqual(1, exports.Single().Metadata.Count); // contains type identity
- }
-
- [TestMethod]
- public void ComposeExportedValueOfT_ValidContractName_ExportedValue_ImportsAreNotDiscovered()
- {
- var container = CreateCompositionContainer();
- var importer = new PartWithRequiredImport();
-
- container.ComposeExportedValue<object>("ContractName", importer);
-
- var importDefinition = new ImportDefinition(ed => true, null, ImportCardinality.ZeroOrMore, false, false);
- var exports = container.GetExports(importDefinition);
- Assert.AreEqual(1, exports.Count()); // we only get one if the import was not discovered since the import is not satisfied
- }
-
- [TestMethod]
- public void TestExportedValueCachesNullValue()
- {
- var container = ContainerFactory.Create();
- var exporter = new ExportsMutableProperty();
- exporter.Property = null;
- container.ComposeParts(exporter);
- Assert.IsNull(container.GetExportedValue<string>("Property"));
- exporter.Property = "Value1";
- // Exported value should have been cached and so it shouldn't change
- Assert.IsNull(container.GetExportedValue<string>("Property"));
- }
- public class ExportsMutableProperty
- {
- [Export("Property")]
- public string Property { get; set; }
- }
-
-
- public class PartWithRequiredImport
- {
- [Import]
- public object Import { get; set; }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionErrorDebuggerProxyTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionErrorDebuggerProxyTests.cs deleted file mode 100644 index e154ccd77d3..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionErrorDebuggerProxyTests.cs +++ /dev/null @@ -1,71 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Factories;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class CompositionErrorDebuggerProxyTests
- {
- [TestMethod]
- public void Constructor_NullAsErrorArgument_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("error", () =>
- {
- new CompositionErrorDebuggerProxy((CompositionError)null);
- });
- }
-
- [TestMethod]
- public void Constructor_ValueAsErrorArgument_ShouldSetExceptionProperty()
- {
- var expectations = Expectations.GetInnerExceptionsWithNull();
-
- foreach (var e in expectations)
- {
- var error = ErrorFactory.Create(e);
-
- var proxy = new CompositionErrorDebuggerProxy(error);
-
- Assert.AreSame(error.Exception, proxy.Exception);
- }
- }
-
- [TestMethod]
- public void Constructor_ValueAsErrorArgument_ShouldSetMessageProperty()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var error = ErrorFactory.Create(e);
-
- var proxy = new CompositionErrorDebuggerProxy(error);
-
- Assert.AreSame(error.Description, proxy.Description);
- }
- }
-
- [TestMethod]
- public void Constructor_ValueAsErrorArgument_ShouldSetElementProperty()
- {
- var expectations = Expectations.GetCompositionElementsWithNull();
-
- foreach (var e in expectations)
- {
- var error = ErrorFactory.Create(e);
-
- var proxy = new CompositionErrorDebuggerProxy(error);
-
- Assert.AreSame(error.Element, proxy.Element);
- }
- }
-
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionErrorIdTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionErrorIdTests.cs deleted file mode 100644 index a1ac6f022b5..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionErrorIdTests.cs +++ /dev/null @@ -1,20 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.UnitTesting;
-using System.ComponentModel.Composition;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class CompositionErrorIdTests
- {
- [TestMethod]
- public void CompositionErrorIdsAreInSyncWithErrorIds()
- {
- ExtendedAssert.EnumsContainSameValues<CompositionErrorId, ErrorId>();
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionErrorTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionErrorTests.cs deleted file mode 100644 index 46443646017..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionErrorTests.cs +++ /dev/null @@ -1,533 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Linq;
-using System.UnitTesting;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-#if !SILVERLIGHT
-using System.Runtime.Serialization;
-#endif
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class CompositionErrorTests
- {
- [TestMethod]
- public void Constructor1_NullAsMessageArgument_ShouldSetMessagePropertyToEmptyString()
- {
- var error = new CompositionError((string)null);
-
- Assert.AreEqual("", error.Description);
- }
-
- [TestMethod]
- public void Constructor2_NullAsMessageArgument_ShouldSetMessagePropertyToEmptyString()
- {
- var error = new CompositionError((string)null, ElementFactory.Create());
-
- Assert.AreEqual("", error.Description);
- }
-
- [TestMethod]
- public void Constructor3_NullAsMessageArgument_ShouldSetMessagePropertyToEmptyString()
- {
- var error = new CompositionError((string)null, new Exception());
-
- Assert.AreEqual("", error.Description);
- }
-
- [TestMethod]
- public void Constructor4_NullAsMessageArgument_ShouldSetMessagePropertyToEmptyString()
- {
- var error = new CompositionError((string)null, ElementFactory.Create(), new Exception());
-
- Assert.AreEqual("", error.Description);
- }
-
- [TestMethod]
- public void Constructor5_NullAsMessageArgument_ShouldSetMessagePropertyToEmptyString()
- {
- var error = new CompositionError(CompositionErrorId.Unknown, (string)null, ElementFactory.Create(), new Exception());
-
- Assert.AreEqual("", error.Description);
- }
-
- [TestMethod]
- public void Constructor1_ValueAsMessageArgument_ShouldSetMessageProperty()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = new CompositionError(e);
-
- Assert.AreEqual(e, exception.Description);
- }
- }
-
- [TestMethod]
- public void Constructor2_ValueAsMessageArgument_ShouldSetMessageProperty()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = new CompositionError(e, ElementFactory.Create());
-
- Assert.AreEqual(e, exception.Description);
- }
- }
-
- [TestMethod]
- public void Constructor3_ValueAsMessageArgument_ShouldSetMessageProperty()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = new CompositionError(e, new Exception());
-
- Assert.AreEqual(e, exception.Description);
- }
- }
-
- [TestMethod]
- public void Constructor4_ValueAsMessageArgument_ShouldSetMessageProperty()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = new CompositionError(e, ElementFactory.Create(), new Exception());
-
- Assert.AreEqual(e, exception.Description);
- }
- }
-
- [TestMethod]
- public void Constructor5_ValueAsMessageArgument_ShouldSetMessageProperty()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = new CompositionError(CompositionErrorId.Unknown, e, ElementFactory.Create(), new Exception());
-
- Assert.AreEqual(e, exception.Description);
- }
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetExceptionPropertyToNull()
- {
- var error = new CompositionError("Description");
-
- Assert.IsNull(error.Exception);
- }
-
- [TestMethod]
- public void Constructor2_ShouldSetExceptionPropertyToNull()
- {
- var error = new CompositionError("Description", ElementFactory.Create());
-
- Assert.IsNull(error.Exception);
- }
-
- [TestMethod]
- public void Constructor3_NullAsExceptionArgument_ShouldSetExceptionPropertyToNull()
- {
- var error = new CompositionError("Description", (Exception)null);
-
- Assert.IsNull(error.Exception);
- }
-
- [TestMethod]
- public void Constructor4_NullAsExceptionArgument_ShouldSetExceptionPropertyToNull()
- {
- var error = new CompositionError("Description", ElementFactory.Create(), (Exception)null);
-
- Assert.IsNull(error.Exception);
- }
-
- [TestMethod]
- public void Constructor5_NullAsExceptionArgument_ShouldSetExceptionPropertyToNull()
- {
- var error = new CompositionError(CompositionErrorId.Unknown, "Description", ElementFactory.Create(), (Exception)null);
-
- Assert.IsNull(error.Exception);
- }
-
- [TestMethod]
- public void Constructor3_ValueAsExceptionArgument_ShouldSetExceptionProperty()
- {
- var expectations = Expectations.GetInnerExceptions();
-
- foreach (var e in expectations)
- {
- var error = new CompositionError("Description", e);
-
- Assert.AreSame(e, error.Exception);
- }
- }
-
- [TestMethod]
- public void Constructor4_ValueAsExceptionArgument_ShouldSetExceptionProperty()
- {
- var expectations = Expectations.GetInnerExceptions();
-
- foreach (var e in expectations)
- {
- var error = new CompositionError("Description", ElementFactory.Create(), e);
-
- Assert.AreSame(e, error.Exception);
- }
- }
-
- [TestMethod]
- public void Constructor5_ValueAsExceptionArgument_ShouldSetExceptionProperty()
- {
- var expectations = Expectations.GetInnerExceptions();
-
- foreach (var e in expectations)
- {
- var error = new CompositionError(CompositionErrorId.Unknown, "Description", ElementFactory.Create(), e);
-
- Assert.AreSame(e, error.Exception);
- }
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetInnerExceptionPropertyToNull()
- {
- var error = new CompositionError("Description");
-
- Assert.IsNull(((ICompositionError)error).InnerException);
- }
-
- [TestMethod]
- public void Constructor2_ShouldSetInnerExceptionPropertyToNull()
- {
- var error = new CompositionError("Description", ElementFactory.Create());
-
- Assert.IsNull(((ICompositionError)error).InnerException);
- }
-
- [TestMethod]
- public void Constructor3_NullAsExceptionArgument_ShouldSetInnerExceptionPropertyToNull()
- {
- var error = new CompositionError("Description", (Exception)null);
-
- Assert.IsNull(((ICompositionError)error).InnerException);
- }
-
- [TestMethod]
- public void Constructor4_NullAsExceptionArgument_ShouldSetInnerExceptionPropertyToNull()
- {
- var error = new CompositionError("Description", ElementFactory.Create(), (Exception)null);
-
- Assert.IsNull(((ICompositionError)error).InnerException);
- }
-
- [TestMethod]
- public void Constructor5_NullAsExceptionArgument_ShouldSetInnerExceptionPropertyToNull()
- {
- var error = new CompositionError(CompositionErrorId.Unknown, "Description", ElementFactory.Create(), (Exception)null);
-
- Assert.IsNull(((ICompositionError)error).InnerException);
- }
-
- [TestMethod]
- public void Constructor3_ValueAsExceptionArgument_ShouldSetInnerExceptionProperty()
- {
- var expectations = Expectations.GetInnerExceptions();
-
- foreach (var e in expectations)
- {
- var error = new CompositionError("Description", e);
-
- Assert.AreSame(e, ((ICompositionError)error).InnerException);
- }
- }
-
- [TestMethod]
- public void Constructor4_ValueAsExceptionArgument_ShouldSetInnerExceptionProperty()
- {
- var expectations = Expectations.GetInnerExceptions();
-
- foreach (var e in expectations)
- {
- var error = new CompositionError("Description", ElementFactory.Create(), e);
-
- Assert.AreSame(e, ((ICompositionError)error).InnerException);
- }
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetICompositionErrorIdPropertyToCompositionErrorIdUnknown()
- {
- var error = new CompositionError("Description");
-
- Assert.AreEqual(CompositionErrorId.Unknown, ((ICompositionError)error).Id);
- }
-
- [TestMethod]
- public void Constructor2_ShouldSetICompositionErrorIdPropertyToCompositionErrorIdUnknown()
- {
- var error = new CompositionError("Description", ElementFactory.Create());
-
- Assert.AreEqual(CompositionErrorId.Unknown, ((ICompositionError)error).Id);
- }
-
- [TestMethod]
- public void Constructor3_ShouldSetICompositionErrorIdPropertyToCompositionErrorIdUnknown()
- {
- var error = new CompositionError("Description", new Exception());
-
- Assert.AreEqual(CompositionErrorId.Unknown, ((ICompositionError)error).Id);
- }
-
- [TestMethod]
- public void Constructor4_ShouldSetICompositionErrorIdPropertyToCompositionErrorIdUnknown()
- {
- var error = new CompositionError("Description", ElementFactory.Create(), new Exception());
-
- Assert.AreEqual(CompositionErrorId.Unknown, ((ICompositionError)error).Id);
- }
-
- [TestMethod]
- public void Constructor5_ValueAsIdArgument_ShouldSetICompositionErrorIdProperty()
- {
- var expectations = Expectations.GetEnumValues<CompositionErrorId>();
-
- foreach (var e in expectations)
- {
- var error = new CompositionError(e, "Description", ElementFactory.Create(), new Exception());
-
- Assert.AreEqual(e, ((ICompositionError)error).Id);
- }
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetElementPropertyToNull()
- {
- var exception = new CompositionError("Description");
-
- Assert.IsNull(exception.Element);
- }
-
- [TestMethod]
- public void Constructor2_NullAsElementArgument_ShouldSetElementPropertyToNull()
- {
- var exception = new CompositionError("Description", (ICompositionElement)null);
-
- Assert.IsNull(exception.Element);
- }
-
- [TestMethod]
- public void Constructor3_ShouldSetElementPropertyToNull()
- {
- var exception = new CompositionError("Description", new Exception());
-
- Assert.IsNull(exception.Element);
- }
-
- [TestMethod]
- public void Constructor4_NullAsElementArgument_ShouldSetElementPropertyToNull()
- {
- var exception = new CompositionError("Description", (ICompositionElement)null, new Exception());
-
- Assert.IsNull(exception.Element);
- }
-
- [TestMethod]
- public void Constructor5_NullAsElementArgument_ShouldSetElementPropertyToNull()
- {
- var exception = new CompositionError(CompositionErrorId.Unknown, "Description", (ICompositionElement)null, new Exception());
-
- Assert.IsNull(exception.Element);
- }
-
- [TestMethod]
- public void Constructor2_ValueAsElementArgument_ShouldSetElementProperty()
- {
- var expectations = Expectations.GetCompositionElements();
-
- foreach (var e in expectations)
- {
- var exception = new CompositionError("Description", (ICompositionElement)e);
-
- Assert.AreSame(e, exception.Element);
- }
- }
-
- [TestMethod]
- public void Constructor4_ValueAsElementArgument_ShouldSetElementProperty()
- {
- var expectations = Expectations.GetCompositionElements();
-
- foreach (var e in expectations)
- {
- var exception = new CompositionError("Description", (ICompositionElement)e, new Exception());
-
- Assert.AreSame(e, exception.Element);
- }
- }
-
- [TestMethod]
- public void Constructor5_ValueAsElementArgument_ShouldSetElementProperty()
- {
- var expectations = Expectations.GetCompositionElements();
-
- foreach (var e in expectations)
- {
- var exception = new CompositionError(CompositionErrorId.Unknown, "Description", (ICompositionElement)e, new Exception());
-
- Assert.AreSame(e, exception.Element);
- }
- }
-
- [TestMethod]
- public void ToString_ShouldReturnMessageProperty()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var error = CreateCompositionError(e);
-
- Assert.AreEqual(error.Description, error.ToString());
- }
- }
-
-#if !SILVERLIGHT
-
- [TestMethod]
- public void ICompositionErrorId_CanBeSerialized()
- {
- var expectations = Expectations.GetEnumValues<CompositionErrorId>();
-
- foreach (var e in expectations)
- {
- var error = (ICompositionError)CreateCompositionError(e);
-
- var result = SerializationTestServices.RoundTrip(error);
-
- Assert.AreEqual(error.Id, result.Id);
- }
- }
-
- [TestMethod]
- public void Exception_CanBeSerialized()
- {
- var expectations = Expectations.GetInnerExceptionsWithNull();
-
- foreach (var e in expectations)
- {
- var error = CreateCompositionError(e);
-
- var result = SerializationTestServices.RoundTrip(error);
-
- ExtendedAssert.IsInstanceOfSameType(error.Exception, result.Exception);
- }
- }
-
- [TestMethod]
- public void Message_CanBeSerialized()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var error = CreateCompositionError(e);
-
- var result = SerializationTestServices.RoundTrip(error);
-
- Assert.AreEqual(error.Description, result.Description);
- }
- }
-
-#endif
-
- private static CompositionError CreateCompositionError()
- {
- return CreateCompositionError(CompositionErrorId.Unknown, (string)null, (ICompositionElement)null, (Exception)null);
- }
-
- private static CompositionError CreateCompositionError(string message)
- {
- return CreateCompositionError(CompositionErrorId.Unknown, message, (ICompositionElement)null, (Exception)null);
- }
-
- private static CompositionError CreateCompositionError(CompositionErrorId id)
- {
- return CreateCompositionError(id, (string)null, (ICompositionElement)null, (Exception)null);
- }
-
- private static CompositionError CreateCompositionError(Exception exception)
- {
- return CreateCompositionError(CompositionErrorId.Unknown, (string)null, (ICompositionElement)null, exception);
- }
-
- private static CompositionError CreateCompositionError(ICompositionElement element)
- {
- return CreateCompositionError(CompositionErrorId.Unknown, (string)null, element, (Exception)null);
- }
-
- private static CompositionError CreateCompositionError(CompositionErrorId id, string message, ICompositionElement element, Exception exception)
- {
- return new CompositionError(id, message, element, exception);
- }
-
- private static CompositionError CreateCompositionError(params string[] messages)
- {
- CompositionError error = null;
- foreach (string message in messages.Reverse())
- {
- CompositionException exception = null;
- if (error != null)
- {
- exception = CreateCompositionException(error);
- }
-
- error = ErrorFactory.Create(message, exception);
- }
-
- return error;
- }
-
- private static CompositionError CreateCompositionErrorWithException(params string[] messages)
- {
- Exception innerException = null;
- foreach (string message in messages.Skip(1).Reverse())
- {
- innerException = new Exception(message, innerException);
- }
-
- return new CompositionError(messages[0], innerException);
- }
-
- private static CompositionError CreateCompostionErrorWithCompositionException(string message1, string message2)
- {
- var exception = CreateCompositionException(new Exception(message2));
-
- return new CompositionError(message1, exception);
- }
-
- private static CompositionException CreateCompositionException(CompositionError error)
- {
- return new CompositionException(error);
- }
-
- private static CompositionException CreateCompositionException(Exception innerException)
- {
- return new CompositionException("Description", innerException, null);
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionExceptionTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionExceptionTests.cs deleted file mode 100644 index af9d9b05b04..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionExceptionTests.cs +++ /dev/null @@ -1,680 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.UnitTesting;
-using System.ComponentModel.Composition.Factories;
-using System.Globalization;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Security;
-using System.Security.Permissions;
-using System.Text;
-using System.ComponentModel.Composition.Primitives;
-using System.UnitTesting;
-using Microsoft.Internal;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-#if !SILVERLIGHT
-using System.Runtime.Serialization;
-using System.Security.Policy;
-#endif
-
-namespace System.ComponentModel.Composition
-{
- [TestClass][Serializable]
- public class CompositionExceptionTests
- {
-#if !SILVERLIGHT
- public delegate void Work(int index);
-
- public class Worker : MarshalByRefObject
- {
- public static ExpectationCollection<IEnumerable<CompositionError>, string> expectations = new ExpectationCollection<IEnumerable<CompositionError>, string>();
- static Worker()
- {
- expectations.Add(ErrorFactory.CreateFromDsl("Error"), "1<Separator> Error");
- expectations.Add(ErrorFactory.CreateFromDsl("Error|Error"), "1<Separator> Error|2<Separator> Error");
- expectations.Add(ErrorFactory.CreateFromDsl("Error|Error|Error"), "1<Separator> Error|2<Separator> Error|3<Separator> Error");
- expectations.Add(ErrorFactory.CreateFromDsl("Error(Error)"), "1<Separator> Error|<Prefix>Error");
- expectations.Add(ErrorFactory.CreateFromDsl("Error(Error|Error)"), "1<Separator> Error|<Prefix>Error|2<Separator> Error|<Prefix>Error");
- expectations.Add(ErrorFactory.CreateFromDsl("Error(Error|Error|Error)"), "1<Separator> Error|<Prefix>Error|2<Separator> Error|<Prefix>Error|3<Separator> Error|<Prefix>Error");
- expectations.Add(ErrorFactory.CreateFromDsl("Error(Error(Exception))"), "1<Separator> Exception|<Prefix>Error|<Prefix>Error");
- expectations.Add(ErrorFactory.CreateFromDsl("Error(Error|Exception)"), "1<Separator> Error|<Prefix>Error|2<Separator> Exception|<Prefix>Error");
- expectations.Add(ErrorFactory.CreateFromDsl("Error(Exception)"), "1<Separator> Exception|<Prefix>Error");
- expectations.Add(ErrorFactory.CreateFromDsl("Error(Exception(Exception))"), "1<Separator> Exception|<Prefix>Exception|<Prefix>Error");
- expectations.Add(ErrorFactory.CreateFromDsl("Error(Error(Exception)|Error)"), "1<Separator> Exception|<Prefix>Error|<Prefix>Error|2<Separator> Error|<Prefix>Error");
- }
-
- public Work Action;
-
- internal void DoWork(int index)
- {
- Action(index);
- }
-
- }
-
-#endif
-
- [TestMethod]
- public void Constructor1_ShouldSetMessagePropertyToDefault()
- {
- var exception = new CompositionException();
-
- ExceptionAssert.HasDefaultMessage(exception);
- }
-
- [TestMethod]
- public void Constructor2_NullAsMessageArgument_ShouldSetMessagePropertyToDefault()
- {
- var exception = new CompositionException((string)null);
-
- ExceptionAssert.HasDefaultMessage(exception);
- }
-
- [TestMethod]
- public void Constructor3_EmptyEnumerableAsErrorsArgument_ShouldSetMessagePropertyToDefault()
- {
- var exception = new CompositionException(Enumerable.Empty<CompositionError>());
-
- ExceptionAssert.HasDefaultMessage(exception);
- }
-
- [TestMethod]
- public void Constructor4_NullAsMessageArgument_ShouldSetMessagePropertyToDefault()
- {
- var exception = new CompositionException((string)null, new Exception());
-
- ExceptionAssert.HasDefaultMessage(exception);
- }
-
- [TestMethod]
- public void Constructor5_NullAsMessageArgument_ShouldSetMessagePropertyToDefault()
- {
- var exception = new CompositionException((string)null, new Exception(), Enumerable.Empty<CompositionError>());
-
- ExceptionAssert.HasDefaultMessage(exception);
- }
-
- [TestMethod]
- public void Constructor2_ValueAsMessageArgument_ShouldSetMessageProperty()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = new CompositionException(e);
-
- Assert.AreEqual(e, exception.Message);
- }
- }
-
- [TestMethod]
- public void Constructor4_ValueAsMessageArgument_ShouldSetMessageProperty()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = new CompositionException(e, new Exception());
-
- Assert.AreEqual(e, exception.Message);
- }
- }
-
- [TestMethod]
- public void Constructor5_ValueAsMessageArgument_ShouldSetMessageProperty()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = new CompositionException(e, new Exception(), Enumerable.Empty<CompositionError>());
-
- Assert.AreEqual(e, exception.Message);
- }
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetInnerExceptionPropertyToNull()
- {
- var exception = new CompositionException();
-
- Assert.IsNull(exception.InnerException);
- }
-
- [TestMethod]
- public void Constructor2_ShouldSetInnerExceptionPropertyToNull()
- {
- var exception = new CompositionException("Message");
-
- Assert.IsNull(exception.InnerException);
- }
-
- [TestMethod]
- public void Constructor3_ShouldSetInnerExceptionPropertyToNull()
- {
- var exception = new CompositionException(Enumerable.Empty<CompositionError>());
-
- Assert.IsNull(exception.InnerException);
- }
-
- [TestMethod]
- public void Constructor4_NullAsInnerExceptionArgument_ShouldSetInnerExceptionPropertyToNull()
- {
- var exception = new CompositionException("Message", (Exception)null);
-
- Assert.IsNull(exception.InnerException);
- }
-
- [TestMethod]
- public void Constructor5_NullAsInnerExceptionArgument_ShouldSetInnerExceptionPropertyToNull()
- {
- var exception = new CompositionException("Message", (Exception)null, Enumerable.Empty<CompositionError>());
-
- Assert.IsNull(exception.InnerException);
- }
-
- [TestMethod]
- public void Constructor4_ValueAsInnerExceptionArgument_ShouldSetInnerExceptionProperty()
- {
- var expectations = Expectations.GetInnerExceptions();
-
- foreach (var e in expectations)
- {
- var exception = new CompositionException("Message", e);
-
- Assert.AreSame(e, exception.InnerException);
- }
- }
-
- [TestMethod]
- public void Constructor5_ValueAsInnerExceptionArgument_ShouldSetInnerExceptionProperty()
- {
- var expectations = Expectations.GetInnerExceptions();
-
- foreach (var e in expectations)
- {
- var exception = new CompositionException("Message", e, Enumerable.Empty<CompositionError>());
-
- Assert.AreSame(e, exception.InnerException);
- }
- }
-
- [TestMethod]
- public void Constructor2_ArrayWithNullAsErrorsArgument_ShouldThrowArgument()
- {
- var errors = new CompositionError[] { null };
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("errors", () =>
- {
- new CompositionException(errors);
- });
- }
-
- [TestMethod]
- public void Constructor5_ArrayWithNullAsErrorsArgument_ShouldThrowArgument()
- {
- var errors = new CompositionError[] { null };
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("errors", () =>
- {
- new CompositionException("Message", new Exception(), errors);
- });
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetErrorsPropertyToEmpty()
- {
- var exception = new CompositionException();
-
- EnumerableAssert.IsEmpty(exception.Errors);
- }
-
- [TestMethod]
- public void Constructor2_NullAsErrorsArgument_ShouldSetErrorsPropertyToEmptyEnumerable()
- {
- var exception = new CompositionException((IEnumerable<CompositionError>)null);
-
- EnumerableAssert.IsEmpty(exception.Errors);
- }
-
- [TestMethod]
- public void Constructor2_EmptyEnumerableAsErrorsArgument_ShouldSetErrorsPropertyToEmptyEnumerable()
- {
- var exception = new CompositionException(Enumerable.Empty<CompositionError>());
-
- EnumerableAssert.IsEmpty(exception.Errors);
- }
-
- [TestMethod]
- public void Constructor2_ValueAsErrorsArgument_ShouldSetErrorsProperty()
- {
- var expectations = Expectations.GetCompositionErrors();
-
- foreach (var e in expectations)
- {
- var exception = new CompositionException(e);
-
- EnumerableAssert.AreSequenceSame(e, exception.Errors);
- }
- }
-
- [TestMethod]
- public void Constructor2_ArrayAsAsErrorsArgument_ShouldNotAllowModificationAfterConstruction()
- {
- var error = CreateCompositionError();
- var errors = new CompositionError[] { error };
-
- var exception = new CompositionException(errors);
-
- errors[0] = null;
-
- EnumerableAssert.AreEqual(exception.Errors, error);
- }
-
- [TestMethod]
- public void Constructor3_ShouldSetErrorsPropertyToEmpty()
- {
- var exception = new CompositionException();
-
- EnumerableAssert.IsEmpty(exception.Errors);
- }
-
- [TestMethod]
- public void Constructor4_ShouldSetErrorsPropertyToEmptyEnumerable()
- {
- var exception = new CompositionException("Message", new Exception());
-
- EnumerableAssert.IsEmpty(exception.Errors);
- }
-
- [TestMethod]
- public void Constructor5_NullAsErrorsArgument_ShouldSetErrorsPropertyToEmptyEnumerable()
- {
- var exception = new CompositionException("Message", new Exception(), (IEnumerable<CompositionError>)null);
-
- EnumerableAssert.IsEmpty(exception.Errors);
- }
-
- [TestMethod]
- public void Constructor5_EmptyEnumerableAsErrorsArgument_ShouldSetErrorsPropertyToEmptyEnumerable()
- {
- var exception = new CompositionException("Message", new Exception(), Enumerable.Empty<CompositionError>());
-
- EnumerableAssert.IsEmpty(exception.Errors);
- }
-
- [TestMethod]
- public void Constructor5_ValueAsErrorsArgument_ShouldSetErrorsProperty()
- {
- var expectations = Expectations.GetCompositionErrors();
-
- foreach (var e in expectations)
- {
- var exception = new CompositionException("Message", new Exception(), e);
-
- EnumerableAssert.AreSequenceSame(e, exception.Errors);
- }
- }
-
- [TestMethod]
- public void Constructor5_ArrayAsAsErrorsArgument_ShouldNotAllowModificationAfterConstruction()
- {
- var error = CreateCompositionError();
- var errors = new CompositionError[] { error };
-
- var exception = new CompositionException("Message", new Exception(), errors);
-
- errors[0] = null;
-
- EnumerableAssert.AreEqual(exception.Errors, error);
- }
-
- [TestMethod]
- public void Message_ShouldIncludeElementGraph()
- {
- var expectations = new ExpectationCollection<CompositionError, string>();
- CompositionError error = null;
-
- error = CreateCompositionErrorWithElementChain(1);
- expectations.Add(error, GetElementGraphString(error));
-
- error = CreateCompositionErrorWithElementChain(2);
- expectations.Add(error, GetElementGraphString(error));
-
- error = CreateCompositionErrorWithElementChain(3);
- expectations.Add(error, GetElementGraphString(error));
-
- error = CreateCompositionErrorWithElementChain(10);
- expectations.Add(error, GetElementGraphString(error));
-
-
- foreach (var e in expectations)
- {
- var exception = CreateCompositionException(new CompositionError[] { e.Input });
-
- string result = exception.ToString();
- string expected = FixMessage(e.Output);
- StringAssert.Contains(result, expected);
- }
- }
-
-#if !SILVERLIGHT && CLR40
- [TestMethod]
- public void Message_ShouldIncludeElementGraphAccrossAppDomain()
- {
- PermissionSet ps = new PermissionSet(PermissionState.None);
- ps.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution));
- ps.AddPermission(new ReflectionPermission(ReflectionPermissionFlag.MemberAccess));
-
- //Create a new sandboxed domain
- AppDomainSetup setup = AppDomain.CurrentDomain.SetupInformation;
- AppDomain newDomain = AppDomain.CreateDomain("test domain", null, setup, ps);
-
- Worker remoteWorker = (Worker)newDomain.CreateInstanceAndUnwrap(
- Assembly.GetExecutingAssembly().FullName,
- typeof(Worker).FullName);
-
- var expectationIndex = new int[] { 1, 2, 3, 10};
-
- var expectations = new ExpectationCollection<CompositionError, string>();
- CompositionError error = null;
-
- error = CreateCompositionErrorWithElementChain(1);
- expectations.Add(error, GetElementGraphString(error));
-
- error = CreateCompositionErrorWithElementChain(2);
- expectations.Add(error, GetElementGraphString(error));
-
- error = CreateCompositionErrorWithElementChain(3);
- expectations.Add(error, GetElementGraphString(error));
-
- error = CreateCompositionErrorWithElementChain(10);
- expectations.Add(error, GetElementGraphString(error));
-
- int index = 0;
- foreach (var e in expectations)
- {
- try
- {
- remoteWorker.Action = (int x) =>
- {
- var lclExpectations = new ExpectationCollection<CompositionError, string>();
-
- var lclError = CreateCompositionErrorWithElementChain(x);
- lclExpectations.Add(lclError, GetElementGraphString(lclError));
-
- var ce = CreateCompositionException(new CompositionError[] { lclExpectations[0].Input });
- throw ce;
- };
- remoteWorker.DoWork(expectationIndex[index]);
- }
- catch (CompositionException compositionException)
- {
- string result = compositionException.ToString();
- string expected = FixMessage(e.Output);
- StringAssert.Contains(result, expected);
- }
- catch (Exception exception)
- {
- Assert.Fail(exception.ToString());
- }
- ++index;
- }
- }
-#endif
- [TestMethod]
- public void Message_ShouldIncludeErrors()
- {
- var expectations = new ExpectationCollection<IEnumerable<CompositionError>, string>();
- expectations.Add(ErrorFactory.CreateFromDsl("Error"), "1<Separator> Error");
- expectations.Add(ErrorFactory.CreateFromDsl("Error|Error"), "1<Separator> Error|2<Separator> Error");
- expectations.Add(ErrorFactory.CreateFromDsl("Error|Error|Error"), "1<Separator> Error|2<Separator> Error|3<Separator> Error");
- expectations.Add(ErrorFactory.CreateFromDsl("Error(Error)"), "1<Separator> Error|<Prefix>Error");
- expectations.Add(ErrorFactory.CreateFromDsl("Error(Error|Error)"), "1<Separator> Error|<Prefix>Error|2<Separator> Error|<Prefix>Error");
- expectations.Add(ErrorFactory.CreateFromDsl("Error(Error|Error|Error)"), "1<Separator> Error|<Prefix>Error|2<Separator> Error|<Prefix>Error|3<Separator> Error|<Prefix>Error");
- expectations.Add(ErrorFactory.CreateFromDsl("Error(Error(Exception))"), "1<Separator> Exception|<Prefix>Error|<Prefix>Error");
- expectations.Add(ErrorFactory.CreateFromDsl("Error(Error|Exception)"), "1<Separator> Error|<Prefix>Error|2<Separator> Exception|<Prefix>Error");
- expectations.Add(ErrorFactory.CreateFromDsl("Error(Exception)"), "1<Separator> Exception|<Prefix>Error");
- expectations.Add(ErrorFactory.CreateFromDsl("Error(Exception(Exception))"), "1<Separator> Exception|<Prefix>Exception|<Prefix>Error");
- expectations.Add(ErrorFactory.CreateFromDsl("Error(Error(Exception)|Error)"), "1<Separator> Exception|<Prefix>Error|<Prefix>Error|2<Separator> Error|<Prefix>Error");
-
- foreach (var e in expectations)
- {
- var exception = CreateCompositionException(e.Input);
-
- AssertMessage(exception, e.Output.Split('|'));
- }
- }
-
-#if !SILVERLIGHT && CLR40
- [TestMethod]
- public void Message_ShouldIncludeErrorsAccrossAppDomain()
- {
- PermissionSet ps = new PermissionSet(PermissionState.None);
- ps.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution));
- ps.AddPermission(new ReflectionPermission(ReflectionPermissionFlag.MemberAccess));
-
- //Create a new sandboxed domain
- AppDomainSetup setup = AppDomain.CurrentDomain.SetupInformation;
- AppDomain newDomain = AppDomain.CreateDomain("test domain", null, setup, ps);
-
- Worker remoteWorker = (Worker)newDomain.CreateInstanceAndUnwrap(
- Assembly.GetExecutingAssembly().FullName,
- typeof(Worker).FullName);
-
- int index = 0;
- foreach (var expectation in Worker.expectations)
- {
- try
- {
- remoteWorker.Action = (int x) =>
- {
- Exception e = CreateCompositionException(Worker.expectations[x].Input);
- throw e;
- };
-
- remoteWorker.DoWork(index);
- }
- catch(CompositionException e)
- {
- AssertMessage(e, expectation.Output.Split('|'));
- }
- catch(Exception e)
- {
- Assert.Fail(e.ToString());
- }
- ++index;
- }
- }
-#endif
- [TestMethod]
- public void Messsage_ShouldIncludeCountOfRootCauses()
- {
- var expectations = new ExpectationCollection<IEnumerable<CompositionError>, int>();
- expectations.Add(ErrorFactory.CreateFromDsl("Error"), 1);
- expectations.Add(ErrorFactory.CreateFromDsl("Error|Error"), 2);
- expectations.Add(ErrorFactory.CreateFromDsl("Error|Error|Error"), 3);
- expectations.Add(ErrorFactory.CreateFromDsl("Error(Error)"), 1);
- expectations.Add(ErrorFactory.CreateFromDsl("Error(Error)|Error(Error)"), 2);
- expectations.Add(ErrorFactory.CreateFromDsl("Error(Error|Error)"), 2);
- expectations.Add(ErrorFactory.CreateFromDsl("Error(Error|Error|Exception)"), 3);
-
- foreach (var e in expectations)
- {
- var exception = CreateCompositionException(e.Input);
-
- AssertMessage(exception, e.Output, CultureInfo.CurrentCulture);
- }
- }
-
- [TestMethod]
- public void Message_ShouldFormatCountOfRootCausesUsingTheCurrentCulture()
- {
- var cultures = Expectations.GetCulturesForFormatting();
-
- foreach (var culture in cultures)
- {
- using (new CurrentCultureContext(culture))
- {
- var errors = CreateCompositionErrors(1000);
- var exception = CreateCompositionException(errors);
- AssertMessage(exception, 1000, culture);
-
- errors = CreateCompositionErrors(1);
- exception = CreateCompositionException(errors);
- AssertMessage(exception, 1, culture);
- }
- }
- }
-
-#if !SILVERLIGHT && CLR40
-
- [TestMethod]
- public void Message_CanBeSerialized()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = CreateCompositionException(e);
-
- var result = SerializationTestServices.RoundTrip(exception);
-
- Assert.AreEqual(exception.Message, result.Message);
- }
- }
-
- [TestMethod]
- public void Errors_CanBeSerialized()
- {
- var expectations = Expectations.GetCompositionErrors();
-
- foreach (var e in expectations)
- {
- var exception = CreateCompositionException(e);
-
- var result = SerializationTestServices.RoundTrip(exception);
-
- EnumerableAssert.AreSequenceEqual(exception.Errors, result.Errors, (index, expected, actual) =>
- {
- CompositionAssert.AreEqual(expected, actual);
- });
- }
- }
-
-#endif
- private string GetElementGraphString(CompositionError error)
- {
- StringBuilder writer = new StringBuilder();
- ICompositionElement element = error.Element;
- writer.AppendFormat(CultureInfo.CurrentCulture, Strings.CompositionException_ElementPrefix, element.DisplayName);
-
- while ((element = element.Origin) != null)
- {
- writer.AppendFormat(CultureInfo.CurrentCulture, Strings.CompositionException_OriginFormat, Strings.CompositionException_OriginSeparator, element.DisplayName);
- }
-
- return writer.ToString();
- }
-
- private void AssertMessage(CompositionException exception, int rootCauseCount, CultureInfo culture)
- {
- using (StringReader reader = new StringReader(exception.Message))
- {
- string line = reader.ReadLine();
-
- if (rootCauseCount == 1)
- {
- Assert.IsTrue(line.Contains(Strings.CompositionException_SingleErrorWithSinglePath));
- }
- else
- {
- Assert.IsTrue(
- line.Contains(string.Format(CultureInfo.CurrentCulture, Strings.CompositionException_SingleErrorWithMultiplePaths, rootCauseCount)) ||
- line.Contains(string.Format(CultureInfo.CurrentCulture, Strings.CompositionException_MultipleErrorsWithMultiplePaths, rootCauseCount))
- );
- }
- }
- }
-
- private void AssertMessage(CompositionException exception, string[] expected)
- {
- using (StringReader reader = new StringReader(exception.Message))
- {
- // Skip header
- reader.ReadLine();
-
- foreach (string expect in expected)
- {
- // Skip blank line
- reader.ReadLine();
- Assert.AreEqual(FixMessage(expect), reader.ReadLine());
- }
- }
- }
-
- private string FixMessage(string expect)
- {
- string fixedPrefix = expect.Replace("<Prefix>", Strings.CompositionException_ErrorPrefix + " ");
- string fixedSeparator = fixedPrefix.Replace("<Separator>", Strings.CompositionException_PathsCountSeparator);
- return fixedSeparator.Replace("<OriginSeparator>", Strings.CompositionException_OriginSeparator);
- }
-
- private static CompositionError CreateCompositionError()
- {
- return CreateCompositionError("Description");
- }
-
- private static CompositionError CreateCompositionError(string message)
- {
- return new CompositionError(message);
- }
-
- private static CompositionError CreateCompositionErrorWithElementChain(int count)
- {
- return new CompositionError("Description", ElementFactory.CreateChain(count));
- }
-
- private static CompositionError[] CreateCompositionErrors(int count)
- {
- CompositionError[] errors = new CompositionError[count];
-
- for (int i = 0; i < count; i++)
- {
- errors[i] = CreateCompositionError("Description" + (i + 1));
- }
-
- return errors;
- }
-
- private static CompositionException CreateCompositionException()
- {
- return CreateCompositionException((string)null, (Exception)null, (IEnumerable<CompositionError>)null);
- }
-
- private static CompositionException CreateCompositionException(string message)
- {
- return CreateCompositionException(message, (Exception)null, (IEnumerable<CompositionError>)null);
- }
-
- private static CompositionException CreateCompositionException(IEnumerable<CompositionError> errors)
- {
- return CreateCompositionException((string)null, (Exception)null, errors);
- }
-
- private static CompositionException CreateCompositionException(Exception innerException)
- {
- return CreateCompositionException((string)null, innerException, (IEnumerable<CompositionError>)null);
- }
-
- private static CompositionException CreateCompositionException(string message, Exception innerException, IEnumerable<CompositionError> errors)
- {
- return new CompositionException(message, innerException, errors);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionResultOfTTest.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionResultOfTTest.cs deleted file mode 100644 index 98a2960c245..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionResultOfTTest.cs +++ /dev/null @@ -1,460 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.UnitTesting;
-using System.ComponentModel.Composition.Factories;
-using System.Linq;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class CompositionResultOfTTest
- {
- [TestMethod]
- public void Constructor1_ShouldSetErrorsPropertyToEmptyEnumerable()
- {
- var result = new CompositionResult<string>();
-
- EnumerableAssert.IsEmpty(result.Errors);
- }
-
- [TestMethod]
- public void Constructor2_ShouldSetErrorsPropertyToEmptyEnumerable()
- {
- var result = new CompositionResult<string>("Value");
-
- EnumerableAssert.IsEmpty(result.Errors);
- }
-
- [TestMethod]
- public void Constructor3_NullAsErrorsArgument_ShouldSetErrorsPropertyToEmptyEnumerable()
- {
- var result = new CompositionResult<string>((CompositionError[])null);
-
- EnumerableAssert.IsEmpty(result.Errors);
- }
-
- [TestMethod]
- public void Constructor4_NullAsErrorsArgument_ShouldSetErrorsPropertyToEmptyEnumerable()
- {
- var result = new CompositionResult<string>((IEnumerable<CompositionError>)null);
-
- EnumerableAssert.IsEmpty(result.Errors);
- }
-
- [TestMethod]
- public void Constructor5_NullAsErrorsArgument_ShouldSetErrorsPropertyToEmptyEnumerable()
- {
- var result = new CompositionResult<string>("Value", (IEnumerable<CompositionError>)null);
-
- EnumerableAssert.IsEmpty(result.Errors);
- }
-
- [TestMethod]
- public void Constructor3_EmptyAsErrorsArgument_ShouldSetErrorsPropertyToEmptyEnumerable()
- {
- var result = new CompositionResult<string>(new CompositionError[0]);
-
- EnumerableAssert.IsEmpty(result.Errors);
- }
-
- [TestMethod]
- public void Constructor4_EmptyAsErrorsArgument_ShouldSetErrorsPropertyToEmptyEnumerable()
- {
- var result = new CompositionResult<string>(Enumerable.Empty<CompositionError>());
-
- EnumerableAssert.IsEmpty(result.Errors);
- }
-
- [TestMethod]
- public void Constructor5_EmptyAsErrorsArgument_ShouldSetErrorsPropertyToEmptyEnumerable()
- {
- var result = new CompositionResult<string>("Value", Enumerable.Empty<CompositionError>());
-
- EnumerableAssert.IsEmpty(result.Errors);
- }
-
- [TestMethod]
- public void Constructor3_ValuesAsErrorsArgument_ShouldSetErrorsProperty()
- {
- var errors = Expectations.GetCompositionErrors();
-
- foreach (var e in errors)
- {
- var result = new CompositionResult<string>(e.ToArray());
-
- EnumerableAssert.AreEqual(e, result.Errors);
- }
- }
-
- [TestMethod]
- public void Constructor4_ValuesAsErrorsArgument_ShouldSetErrorsProperty()
- {
- var errors = Expectations.GetCompositionErrors();
-
- foreach (var e in errors)
- {
- var result = new CompositionResult<string>(e);
-
- EnumerableAssert.AreEqual(e, result.Errors);
- }
- }
-
- [TestMethod]
- public void Constructor5_ValuesAsErrorsArgument_ShouldSetErrorsProperty()
- {
- var errors = Expectations.GetCompositionErrors();
-
- foreach (var e in errors)
- {
- var result = new CompositionResult<string>("Value", e);
-
- EnumerableAssert.AreEqual(e, result.Errors);
- }
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetSucceededPropertyToTrue()
- {
- var result = new CompositionResult<string>();
-
- Assert.IsTrue(result.Succeeded);
- }
-
-
- [TestMethod]
- public void Constructor2_ShouldSetSucceededPropertyToTrue()
- {
- var result = new CompositionResult<string>("Value");
-
- Assert.IsTrue(result.Succeeded);
- }
-
- [TestMethod]
- public void Constructor3_NullAsErrorsArgument_ShouldSetSucceededPropertyToTrue()
- {
- var result = new CompositionResult<string>((CompositionError[])null);
-
- Assert.IsTrue(result.Succeeded);
- }
-
- [TestMethod]
- public void Constructor4_NullAsErrorsArgument_ShouldSetSucceededPropertyToTrue()
- {
- var result = new CompositionResult<string>((IEnumerable<CompositionError>)null);
-
- Assert.IsTrue(result.Succeeded);
- }
-
- [TestMethod]
- public void Constructor5_NullAsErrorsArgument_ShouldSetSucceededPropertyToTrue()
- {
- var result = new CompositionResult<string>("Value", (IEnumerable<CompositionError>)null);
-
- Assert.IsTrue(result.Succeeded);
- }
-
- [TestMethod]
- public void Constructor3_EmptyAsErrorsArgument_ShouldSetSucceededPropertyToTrue()
- {
- var result = new CompositionResult<string>(new CompositionError[0]);
-
- Assert.IsTrue(result.Succeeded);
- }
-
- [TestMethod]
- public void Constructor4_EmptyAsErrorsArgument_ShouldSetSucceededPropertyToTrue()
- {
- var result = new CompositionResult<string>(Enumerable.Empty<CompositionError>());
-
- Assert.IsTrue(result.Succeeded);
- }
-
- [TestMethod]
- public void Constructor5_EmptyAsErrorsArgument_ShouldSetSucceededPropertyToTrue()
- {
- var result = new CompositionResult<string>("Value", Enumerable.Empty<CompositionError>());
-
- Assert.IsTrue(result.Succeeded);
- }
-
- [TestMethod]
- public void Constructor3_ValuesAsErrorsArgument_ShouldSetSucceededPropertyToTrueIfThereAreErrors()
- {
- var errors = Expectations.GetCompositionErrors();
-
- foreach (var e in errors)
- {
- var result = new CompositionResult<string>(e.ToArray());
-
- if (e.Count() > 0)
- {
- Assert.IsFalse(result.Succeeded);
- }
- else
- {
- Assert.IsTrue(result.Succeeded);
- }
- }
- }
-
- [TestMethod]
- public void Constructor4_ValuesAsErrorsArgument_ShouldSetSucceededPropertyToTrueIfThereAreErrors()
- {
- var errors = Expectations.GetCompositionErrors();
-
- foreach (var e in errors)
- {
- var result = new CompositionResult<string>(e);
-
- if (e.Count() > 0)
- {
- Assert.IsFalse(result.Succeeded);
- }
- else
- {
- Assert.IsTrue(result.Succeeded);
- }
- }
- }
-
- [TestMethod]
- public void Constructor5_ValuesAsErrorsArgument_ShouldSetSucceededPropertyToTrueIfThereAreErrors()
- {
- var errors = Expectations.GetCompositionErrors();
-
- foreach (var e in errors)
- {
- var result = new CompositionResult<string>("Value", e);
-
- if (e.Count() > 0)
- {
- Assert.IsFalse(result.Succeeded);
- }
- else
- {
- Assert.IsTrue(result.Succeeded);
- }
- }
- }
-
- [TestMethod]
- public void ToResult_NullAsErrorsArgument_ShouldReturnResultWithEmptyErrorsProperty()
- {
- var result = CreateCompositionResult<string>((IEnumerable<CompositionError>)null);
-
- var copy = result.ToResult();
-
- EnumerableAssert.IsEmpty(copy.Errors);
- }
-
- [TestMethod]
- public void ToResult_EmptyEnumerableAsErrorsArgument_ShouldReturnResultWithEmptyErrorsProperty()
- {
- var result = CreateCompositionResult<string>(Enumerable.Empty<CompositionError>());
-
- var copy = result.ToResult();
-
- EnumerableAssert.IsEmpty(copy.Errors);
- }
-
- [TestMethod]
- public void ToResult_ValueAsErrorsArgument_ShouldReturnResultWithErrorsPropertySet()
- {
- var expectations = Expectations.GetCompositionErrors();
-
- foreach (var e in expectations)
- {
- var result = CreateCompositionResult<string>(e);
-
- var copy = result.ToResult();
-
- EnumerableAssert.AreSequenceSame(result.Errors, copy.Errors);
- }
- }
-
- [TestMethod]
- public void ToResultOfT_NullAsErrorsArgument_ShouldReturnResultWithEmptyErrorsProperty()
- {
- var result = CreateCompositionResult<string>((IEnumerable<CompositionError>)null);
-
- var copy = result.ToResult<string>();
-
- EnumerableAssert.IsEmpty(copy.Errors);
- }
-
- [TestMethod]
- public void ToResultOfT_EmptyEnumerableAsErrorsArgument_ShouldReturnResultWithEmptyErrorsProperty()
- {
- var result = CreateCompositionResult<string>(Enumerable.Empty<CompositionError>());
-
- var copy = result.ToResult<string>();
-
- EnumerableAssert.IsEmpty(copy.Errors);
- }
-
- [TestMethod]
- public void ToResultOfT_ValueAsErrorsArgument_ShouldReturnResultWithErrorsPropertySet()
- {
- var expectations = Expectations.GetCompositionErrors();
-
- foreach (var e in expectations)
- {
- var result = CreateCompositionResult<string>(e);
-
- var copy = result.ToResult<string>();
-
- EnumerableAssert.AreSequenceSame(result.Errors, copy.Errors);
- }
- }
-
- [TestMethod]
- public void ToResultOfT_ReferenceValueAsValueArgument_ShouldReturnResultWithNullValueProperty()
- {
- var expectations = Expectations.GetObjectsReferenceTypes();
-
- foreach (var e in expectations)
- {
- var result = CreateCompositionResult<object>(e);
-
- var copy = result.ToResult<object>();
-
- Assert.IsNull(copy.Value);
- }
- }
-
- [TestMethod]
- public void ToResultOfT_ValueTypeValueAsValueArgument_ShouldReturnResultWithNullValueProperty()
- {
- var expectations = Expectations.GetObjectsValueTypes();
-
- foreach (var e in expectations)
- {
- var result = CreateCompositionResult<ValueType>(e);
-
- var copy = result.ToResult<ValueType>();
-
- Assert.IsNull(copy.Value);
- }
- }
-
- [TestMethod]
- public void Value_NullAsErrorsArgumentAndValueAsValueArgument_ShouldReturnValue()
- {
- var expectations = Expectations.GetObjectsReferenceTypes();
-
- foreach (var e in expectations)
- {
- var result = CreateCompositionResult<object>(e, (IEnumerable<CompositionError>)null);
-
- Assert.AreEqual(e, result.Value);
- }
- }
-
- [TestMethod]
- public void Value_EmptyEnumerableAsErrorsArgumentAndValueAsValueArgument_ShouldReturnValue()
- {
- var expectations = Expectations.GetObjectsReferenceTypes();
-
- foreach (var e in expectations)
- {
- var result = CreateCompositionResult<object>(e, Enumerable.Empty<CompositionError>());
-
- Assert.AreEqual(e, result.Value);
- }
- }
-
- [TestMethod]
- public void Value_SingleValueAsErrorsArgument_ShouldThrowComposition()
- {
- var errorIds = Expectations.GetEnumValues<CompositionErrorId>();
-
- foreach (var errorId in errorIds)
- {
- var result = CreateCompositionResult<string>(errorId);
-
- CompositionAssert.ThrowsError((ErrorId)errorId, () =>
- {
- var value = result.Value;
- });
- }
- }
-
- [TestMethod]
- public void Value_TwoSameValuesAsErrorsArgument_ShouldThrowComposition()
- {
- var errorIds = Expectations.GetEnumValues<CompositionErrorId>();
-
- foreach (var errorId in errorIds)
- {
- var result = CreateCompositionResult<string>(errorId, errorId);
-
- CompositionAssert.ThrowsErrors((ErrorId)errorId, (ErrorId)errorId, () =>
- {
- var value = result.Value;
- });
- }
- }
-
- [TestMethod]
- public void Value_TwoDifferentValuesAsErrorsArgument_ShouldThrowComposition()
- {
- var errorIds1 = Expectations.GetEnumValues<CompositionErrorId>();
- var errorIds2 = Expectations.GetEnumValues<CompositionErrorId>();
-
- for (int i = 0; i < errorIds1.Count(); i++)
- {
- var errorId1 = errorIds1.ElementAt(i);
- var errorId2 = errorIds1.ElementAt(errorIds2.Count() - 1 - i);
-
- var result = CreateCompositionResult<string>(errorId1, errorId2);
-
- CompositionAssert.ThrowsErrors((ErrorId)errorId1, (ErrorId)errorId2, () =>
- {
- var value = result.Value;
- });
- }
- }
-
- private CompositionResult<T> CreateCompositionResult<T>(params CompositionErrorId[] errorIds)
- {
- return new CompositionResult<T>(errorIds.Select(id =>
- {
- return ErrorFactory.Create(id);
- }));
- }
-
- private CompositionResult<T> CreateCompositionResult<T>(int count)
- {
- var expectations = Expectations.GetEnumValues<CompositionErrorId>();
-
- List<CompositionError> errors = new List<CompositionError>();
-
- foreach (var e in expectations.Take(count))
- {
- errors.Add(ErrorFactory.Create(e));
- }
-
- return CreateCompositionResult<T>(errors);
- }
-
- private CompositionResult<T> CreateCompositionResult<T>(IEnumerable<CompositionError> errors)
- {
- return new CompositionResult<T>(errors);
- }
-
- private CompositionResult<T> CreateCompositionResult<T>(T value)
- {
- return new CompositionResult<T>(value);
- }
-
- private CompositionResult<T> CreateCompositionResult<T>(T value, IEnumerable<CompositionError> errors)
- {
- return new CompositionResult<T>(value, errors);
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionResultTest.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionResultTest.cs deleted file mode 100644 index 7231c46aa7b..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionResultTest.cs +++ /dev/null @@ -1,494 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.UnitTesting;
-using System.Linq;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Factories;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class CompositionResultTest
- {
- [TestMethod]
- public void Constructor1_ShouldSetErrorsPropertyToEmptyEnumerable()
- {
- var result = new CompositionResult();
-
- EnumerableAssert.IsEmpty(result.Errors);
- }
-
- [TestMethod]
- public void Constructor2_NullAsErrorsArgument_ShouldSetErrorsPropertyToEmptyEnumerable()
- {
- var result = new CompositionResult((CompositionError[])null);
-
- EnumerableAssert.IsEmpty(result.Errors);
- }
-
- [TestMethod]
- public void Constructor3_NullAsErrorsArgument_ShouldSetErrorsPropertyToEmptyEnumerable()
- {
- var result = new CompositionResult((IEnumerable<CompositionError>)null);
-
- EnumerableAssert.IsEmpty(result.Errors);
- }
-
- [TestMethod]
- public void Constructor2_EmptyAsErrorsArgument_ShouldSetErrorsPropertyToEmptyEnumerable()
- {
- var result = new CompositionResult(new CompositionError[0]);
-
- EnumerableAssert.IsEmpty(result.Errors);
- }
-
- [TestMethod]
- public void Constructor3_EmptyAsErrorsArgument_ShouldSetErrorsPropertyToEmptyEnumerable()
- {
- var result = new CompositionResult(Enumerable.Empty<CompositionError>());
-
- EnumerableAssert.IsEmpty(result.Errors);
- }
-
- [TestMethod]
- public void Constructor2_ValuesAsErrorsArgument_ShouldSetErrorsProperty()
- {
- var errors = Expectations.GetCompositionErrors();
-
- foreach (var e in errors)
- {
- var result = new CompositionResult(e.ToArray());
-
- EnumerableAssert.AreEqual(e, result.Errors);
- }
- }
-
- [TestMethod]
- public void Constructor3_ValuesAsErrorsArgument_ShouldSetErrorsProperty()
- {
- var errors = Expectations.GetCompositionErrors();
-
- foreach (var e in errors)
- {
- var result = new CompositionResult(e);
-
- EnumerableAssert.AreEqual(e, result.Errors);
- }
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetSucceededPropertyToTrue()
- {
- var result = new CompositionResult();
-
- Assert.IsTrue(result.Succeeded);
- }
-
- [TestMethod]
- public void Constructor2_NullAsErrorsArgument_ShouldSetSucceededPropertyToTrue()
- {
- var result = new CompositionResult((CompositionError[])null);
-
- Assert.IsTrue(result.Succeeded);
- }
-
- [TestMethod]
- public void Constructor3_NullAsErrorsArgument_ShouldSetSucceededPropertyToTrue()
- {
- var result = new CompositionResult((IEnumerable<CompositionError>)null);
-
- Assert.IsTrue(result.Succeeded);
- }
-
- [TestMethod]
- public void Constructor2_EmptyAsErrorsArgument_ShouldSetSucceededPropertyToTrue()
- {
- var result = new CompositionResult(new CompositionError[0]);
-
- Assert.IsTrue(result.Succeeded);
- }
-
- [TestMethod]
- public void Constructor3_EmptyAsErrorsArgument_ShouldSetSucceededPropertyToTrue()
- {
- var result = new CompositionResult(Enumerable.Empty<CompositionError>());
-
- Assert.IsTrue(result.Succeeded);
- }
-
- [TestMethod]
- public void Constructor2_ValuesAsErrorsArgument_ShouldSetSucceededPropertyToTrueIfThereAreErrors()
- {
- var errors = Expectations.GetCompositionErrors();
-
- foreach (var e in errors)
- {
- var result = new CompositionResult(e.ToArray());
-
- if (e.Count() > 0)
- {
- Assert.IsFalse(result.Succeeded);
- }
- else
- {
- Assert.IsTrue(result.Succeeded);
- }
- }
- }
-
- [TestMethod]
- public void Constructor3_ValuesAsErrorsArgument_ShouldSetSucceededPropertyToTrueIfThereAreErrors()
- {
- var errors = Expectations.GetCompositionErrors();
-
- foreach (var e in errors)
- {
- var result = new CompositionResult(e);
-
- if (e.Count() > 0)
- {
- Assert.IsFalse(result.Succeeded);
- }
- else
- {
- Assert.IsTrue(result.Succeeded);
- }
- }
- }
-
- [TestMethod]
- public void MergeResult_ResultWithNullErrorsAsResultArgument_ShouldReturnResultWithSameErrors()
- {
- var emptyResult = CreateCompositionResult((IEnumerable<CompositionError>)null);
-
- var expectations = Expectations.GetCompositionErrors();
-
- foreach (var e in expectations)
- {
- var result = CreateCompositionResult(e);
-
- var mergedResult = result.MergeResult(emptyResult);
-
- CompositionAssert.AreEqual(result, mergedResult);
- }
- }
-
- [TestMethod]
- public void MergeResult_ResultWithEmptyErrorsAsResultArgument_ShouldReturnResultWithSameErrors()
- {
- var emptyResult = CreateCompositionResult(Enumerable.Empty<CompositionError>());
-
- var expectations = Expectations.GetCompositionErrors();
-
- foreach (var e in expectations)
- {
- var result = CreateCompositionResult(e);
-
- var mergedResult = result.MergeResult(emptyResult);
-
- CompositionAssert.AreEqual(result, mergedResult);
- }
- }
-
- [TestMethod]
- public void MergeResult_ResultWithErrorsAsResultArgument_ShouldReturnResultWithCombinedErrors()
- {
- var expectations = Expectations.GetCompositionErrors();
-
- foreach (var e in expectations)
- {
- var result1 = CreateCompositionResult(e);
- var result2 = CreateCompositionResult(e);
-
- var mergedResult = result1.MergeResult(result2);
- var mergedErrors = result1.Errors.Concat(result2.Errors);
-
- EnumerableAssert.AreSequenceSame(mergedErrors, mergedResult.Errors);
- Assert.AreEqual(mergedResult.Succeeded, result1.Succeeded | result2.Succeeded);
- }
- }
-
- [TestMethod]
- public void MergeError_ValueAsErrorArgumentWhenMergedWithResultWithNullErrors_ShouldReturnResultWithCombinedErrors()
- {
- var result = CreateCompositionResult((IEnumerable<CompositionError>)null);
- var expectations = Expectations.GetEnumValues<CompositionErrorId>();
-
- foreach (var e in expectations)
- {
- var error = ErrorFactory.Create(e);
-
- var mergedResult = result.MergeError(error);
- var mergedErrors = result.Errors.Concat(new CompositionError[] { error });
-
- EnumerableAssert.AreSequenceSame(mergedErrors, mergedResult.Errors);
- Assert.IsFalse(mergedResult.Succeeded);
- }
- }
-
- [TestMethod]
- public void MergeError_ValueAsErrorArgumentWhenMergedWithResultWithEmptyErrors_ShouldReturnResultWithCombinedErrors()
- {
- var result = CreateCompositionResult(Enumerable.Empty<CompositionError>());
- var expectations = Expectations.GetEnumValues<CompositionErrorId>();
-
- foreach (var e in expectations)
- {
- var error = ErrorFactory.Create(e);
-
- var mergedResult = result.MergeError(error);
- var mergedErrors = result.Errors.Concat(new CompositionError[] { error });
-
- EnumerableAssert.AreSequenceSame(mergedErrors, mergedResult.Errors);
- Assert.IsFalse(mergedResult.Succeeded);
- }
- }
-
- [TestMethod]
- public void MergeError_ValueAsErrorArgumentWhenMergedWithResultWithErrors_ShouldReturnResultWithCombinedErrors()
- {
- var result = CreateCompositionResult(2);
- var expectations = Expectations.GetEnumValues<CompositionErrorId>();
-
- foreach (var e in expectations)
- {
- var error = ErrorFactory.Create(e);
-
- var mergedResult = result.MergeError(error);
- var mergedErrors = result.Errors.Concat(new CompositionError[] { error });
-
- EnumerableAssert.AreSequenceSame(mergedErrors, mergedResult.Errors);
- Assert.IsFalse(mergedResult.Succeeded);
- }
- }
-
- [TestMethod]
- public void MergeErrors_ValueAsErrorArgumentWhenMergedWithResultWithNullErrors_ShouldReturnResultWithCombinedErrors()
- {
- var result = CreateCompositionResult((IEnumerable<CompositionError>)null);
- var expectations = Expectations.GetCompositionErrors();
-
- foreach (var e in expectations)
- {
- var mergedResult = result.MergeErrors(e);
- var mergedErrors = result.Errors.Concat(e);
-
- EnumerableAssert.AreSequenceSame(mergedErrors, mergedResult.Errors);
- Assert.AreEqual(!e.Any(), mergedResult.Succeeded);
- }
- }
-
- [TestMethod]
- public void MergeErrors_ValueAsErrorArgumentWhenMergedWithResultWithEmptyErrors_ShouldReturnResultWithCombinedErrors()
- {
- var result = CreateCompositionResult(Enumerable.Empty<CompositionError>());
- var expectations = Expectations.GetCompositionErrors();
-
- foreach (var e in expectations)
- {
- var mergedResult = result.MergeErrors(e);
- var mergedErrors = result.Errors.Concat(e);
-
- EnumerableAssert.AreSequenceSame(mergedErrors, mergedResult.Errors);
- Assert.AreEqual(!e.Any(), mergedResult.Succeeded);
- }
- }
-
- [TestMethod]
- public void MergeErrors_ValueAsErrorArgumentWhenMergedWithResultWithErrors_ShouldReturnResultWithCombinedErrors()
- {
- var result = CreateCompositionResult(2);
- var expectations = Expectations.GetCompositionErrors();
-
- foreach (var e in expectations)
- {
- var mergedResult = result.MergeErrors(e);
- var mergedErrors = result.Errors.Concat(e);
-
- EnumerableAssert.AreSequenceSame(mergedErrors, mergedResult.Errors);
- Assert.IsFalse(mergedResult.Succeeded);
- }
- }
-
- [TestMethod]
- public void ThrowOnErrors_NullAsErrorsArgument_ShouldNotThrow()
- {
- var result = CreateCompositionResult((IEnumerable<CompositionError>)null);
-
- result.ThrowOnErrors();
- }
-
- [TestMethod]
- public void ThrowOnErrors_EmptyEnumerableAsErrorsArgument_ShouldNotThrow()
- {
- var result = CreateCompositionResult(Enumerable.Empty<CompositionError>());
-
- result.ThrowOnErrors();
- }
-
- [TestMethod]
- public void ThrowOnErrors_SingleValueAsErrorsArgument_ShouldThrowComposition()
- {
- var errorIds = Expectations.GetEnumValues<CompositionErrorId>();
-
- foreach (var errorId in errorIds)
- {
- var result = CreateCompositionResult(errorId);
-
- CompositionAssert.ThrowsError((ErrorId)errorId, () =>
- {
- result.ThrowOnErrors();
- });
- }
- }
-
- [TestMethod]
- public void ThrowOnErrors_TwoSameValuesAsErrorsArgument_ShouldThrowComposition()
- {
- var errorIds = Expectations.GetEnumValues<CompositionErrorId>();
-
- foreach (var errorId in errorIds)
- {
- var result = CreateCompositionResult(errorId, errorId);
-
- CompositionAssert.ThrowsErrors((ErrorId)errorId, (ErrorId)errorId, () =>
- {
- result.ThrowOnErrors();
- });
- }
- }
-
- [TestMethod]
- public void ThrowOnErrors_TwoDifferentValuesAsErrorsArgument_ShouldThrowComposition()
- {
- var errorIds1 = Expectations.GetEnumValues<CompositionErrorId>();
- var errorIds2 = Expectations.GetEnumValues<CompositionErrorId>();
-
- for (int i = 0; i < errorIds1.Count(); i++)
- {
- var errorId1 = errorIds1.ElementAt(i);
- var errorId2 = errorIds1.ElementAt(errorIds2.Count() - 1 - i);
-
- var result = CreateCompositionResult(errorId1, errorId2);
-
- CompositionAssert.ThrowsErrors((ErrorId)errorId1, (ErrorId)errorId2, () =>
- {
- result.ThrowOnErrors();
- });
- }
- }
-
- [TestMethod]
- public void ToResultOfT_NullAsErrorsArgument_ShouldReturnResultWithEmptyErrorsProperty()
- {
- var result = CreateCompositionResult((IEnumerable<CompositionError>)null);
-
- var copy = result.ToResult<string>("Value");
-
- EnumerableAssert.IsEmpty(copy.Errors);
- }
-
- [TestMethod]
- public void ToResultOfT_EmptyEnumerableAsErrorsArgument_ShouldReturnResultWithEmptyErrorsProperty()
- {
- var result = CreateCompositionResult(Enumerable.Empty<CompositionError>());
-
- var copy = result.ToResult<string>("Value");
-
- EnumerableAssert.IsEmpty(copy.Errors);
- }
-
- [TestMethod]
- public void ToResultOfT_ValueAsErrorsArgument_ShouldReturnResultWithErrorsPropertySet()
- {
- var expectations = Expectations.GetCompositionErrors();
-
- foreach (var e in expectations)
- {
- var result = CreateCompositionResult(e);
-
- var copy = result.ToResult<string>("Value");
-
- EnumerableAssert.AreSequenceSame(result.Errors, copy.Errors);
- }
- }
-
- [TestMethod]
- public void ToResultOfT_ReferenceValueAsValueArgument_ShouldReturnResultWithValuePropertySet()
- {
- var expectations = Expectations.GetObjectsReferenceTypes();
-
- foreach (var e in expectations)
- {
- var result = CreateCompositionResult();
-
- var copy = result.ToResult<object>(e);
-
- Assert.AreSame(e, copy.Value);
- }
- }
-
- [TestMethod]
- public void ToResultOfT_ValueTypeValueAsValueArgument_ShouldReturnResultWithValuePropertySet()
- {
- var expectations = Expectations.GetObjectsValueTypes();
-
- foreach (var e in expectations)
- {
- var result = CreateCompositionResult();
-
- var copy = result.ToResult<object>(e);
-
- Assert.AreEqual(e, copy.Value);
- }
- }
-
- [TestMethod]
- public void SucceededResult_ShouldSetSuccessPropertyToTrue()
- {
- var succeeded = CompositionResult.SucceededResult.Succeeded;
-
- Assert.IsTrue(succeeded);
- }
-
- [TestMethod]
- public void SucceededResult_ShouldSetErrorsPropertyToEmptyEnumerable()
- {
- var errors = CompositionResult.SucceededResult.Errors;
-
- EnumerableAssert.IsEmpty(errors);
- }
-
- private CompositionResult CreateCompositionResult(params CompositionErrorId[] errorIds)
- {
- return new CompositionResult(errorIds.Select(id =>
- {
- return ErrorFactory.Create(id);
- }));
- }
-
- private CompositionResult CreateCompositionResult(int count)
- {
- var expectations = Expectations.GetEnumValues<CompositionErrorId>();
-
- List<CompositionError> errors = new List<CompositionError>();
-
- foreach (var e in expectations.Take(count))
- {
- errors.Add(ErrorFactory.Create(e));
- }
-
- return CreateCompositionResult(errors);
- }
-
- private CompositionResult CreateCompositionResult(IEnumerable<CompositionError> errors)
- {
- return new CompositionResult(errors);
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionServiceExtensionsTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionServiceExtensionsTests.cs deleted file mode 100644 index f611c10aebd..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionServiceExtensionsTests.cs +++ /dev/null @@ -1,150 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Factories;
-using System.Linq;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.AttributedModel;
-using System.ComponentModel.Composition.ReflectionModel;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class CompositionServiceExtensionsTests
- {
- [TestMethod]
- public void SatisfyImports_BooleanOverride_PartAndFalseHaveBeenPassed()
- {
- MockCompositionService compositionService = new MockCompositionService();
- ComposablePart part = PartFactory.Create();
-
- bool importsSatisfiedCalled = false;
- compositionService.ImportsSatisfied += delegate(object sender, SatisfyImportsEventArgs e)
- {
- Assert.IsFalse(importsSatisfiedCalled);
- Assert.AreEqual(part, e.Part);
- importsSatisfiedCalled = true;
- };
-
- compositionService.SatisfyImportsOnce(part);
- Assert.IsTrue(importsSatisfiedCalled);
- }
-
-
- [TestMethod]
- public void SatisfyImports_AttributedOverride_NullAsCompositionService()
- {
- ICompositionService compositionService = null;
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("compositionService", () =>
- {
- compositionService.SatisfyImportsOnce(new MockAttributedPart());
- });
- }
-
- [TestMethod]
- public void SatisfyImports_AttributedOverride_NullAsAttributedPart()
- {
- MockCompositionService compositionService = new MockCompositionService();
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("attributedPart", () =>
- {
- compositionService.SatisfyImportsOnce((object)null);
- });
- }
-
- [TestMethod]
- public void SatisfyImports_AttributedOverride_PartAndFalseHaveBeenPassed()
- {
- MockCompositionService compositionService = new MockCompositionService();
- object attributedPart = new MockAttributedPart();
-
- bool importsSatisfiedCalled = false;
- compositionService.ImportsSatisfied += delegate(object sender, SatisfyImportsEventArgs e)
- {
- Assert.IsFalse(importsSatisfiedCalled);
- Assert.IsTrue(e.Part is ReflectionComposablePart);
- Assert.IsTrue(((ReflectionComposablePart)e.Part).Definition.GetPartType() == typeof(MockAttributedPart));
- importsSatisfiedCalled = true;
- };
-
- compositionService.SatisfyImportsOnce(attributedPart);
- Assert.IsTrue(importsSatisfiedCalled);
- }
-
- [TestMethod]
- public void SatisfyImports_AttributedAndBooleanOverride_NullAsCompositionService()
- {
- ICompositionService compositionService = null;
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("compositionService", () =>
- {
- compositionService.SatisfyImportsOnce(new MockAttributedPart());
- });
- }
-
- [TestMethod]
- public void SatisfyImports_AttributedAndBooleanOverride_NullAsAttributedPart()
- {
- MockCompositionService compositionService = new MockCompositionService();
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("attributedPart", () =>
- {
- compositionService.SatisfyImportsOnce((object)null);
- });
- }
-
- [TestMethod]
- public void SatisfyImports_AttributedAndBooleanOverride_PartAndFalseHaveBeenPassed()
- {
- MockCompositionService compositionService = new MockCompositionService();
- object attributedPart = new MockAttributedPart();
-
- bool importsSatisfiedCalled = false;
- compositionService.ImportsSatisfied += delegate(object sender, SatisfyImportsEventArgs e)
- {
- Assert.IsFalse(importsSatisfiedCalled);
- Assert.IsTrue(e.Part is ReflectionComposablePart);
- Assert.IsTrue(((ReflectionComposablePart)e.Part).Definition.GetPartType() == typeof(MockAttributedPart));
- importsSatisfiedCalled = true;
- };
-
- compositionService.SatisfyImportsOnce(attributedPart);
- Assert.IsTrue(importsSatisfiedCalled);
- }
-
- internal class SatisfyImportsEventArgs : EventArgs
- {
- public SatisfyImportsEventArgs(ComposablePart part)
- {
- this.Part = part;
- }
-
- public ComposablePart Part { get; private set; }
- }
-
- internal class MockCompositionService : ICompositionService
- {
- public MockCompositionService()
- {
- }
-
- public void SatisfyImportsOnce(ComposablePart part)
- {
- if (this.ImportsSatisfied != null)
- {
- this.ImportsSatisfied.Invoke(this, new SatisfyImportsEventArgs(part));
- }
- }
-
- public event EventHandler<SatisfyImportsEventArgs> ImportsSatisfied;
- }
-
- public class MockAttributedPart
- {
- public MockAttributedPart()
- {
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionServiceProxy.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionServiceProxy.cs deleted file mode 100644 index db50ffd3674..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionServiceProxy.cs +++ /dev/null @@ -1,24 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition
-{
- internal class CompositionServiceProxy : ICompositionService
- {
- private readonly CompositionContainer _container;
-
- public CompositionServiceProxy(CompositionContainer container)
- {
- this._container = container;
- }
-
- public void SatisfyImportsOnce(ComposablePart part)
- {
- this._container.SatisfyImportsOnce(part);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionServicesTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionServicesTests.cs deleted file mode 100644 index b8ee4c4bd6d..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionServicesTests.cs +++ /dev/null @@ -1,117 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.Hosting;
-using System.Text;
-using Microsoft.Internal;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.UnitTesting;
-using Tests.Integration;
-using System.Reflection;
-using System.Reflection.Emit;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class CompositionServicesTests
- {
- private static readonly Type NonGenericType = typeof(int);
-
- [TestMethod]
- public void GetContractName_NullAsTypeArgument_ThrowsArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("type", () =>
- {
- AttributedModelServices.GetContractName((Type)null);
- });
- }
-
- [TestMethod]
- [Description("Verifies adding custom modifiers to contract name.")]
- public void ContractNameServicesAddCustomModifiersTest()
- {
- Type[] modifiers = new Type[] { typeof(int), typeof(List<int>), typeof(double) };
- StringBuilder typeName = new StringBuilder();
- ContractNameServices.WriteCustomModifiers(typeName, "test", modifiers);
- Assert.AreEqual<string>(
- string.Format(" {0}(System.Int32,System.Collections.Generic.List(System.Int32),System.Double)", "test"),
- typeName.ToString(),
- "Expecting correct modifiers text.");
- }
-
- [TestMethod]
- [Description("Verifies CompositionServices.GetDefaultContractName method.")]
- public void GetDefaultContractNameTest()
- {
- ExpectationCollection<Type, string> expectations = new ExpectationCollection<Type, string>();
-
- expectations.Add(typeof(string), "System.String");
- expectations.Add(typeof(int?), "System.Nullable(System.Int32)");
- expectations.Add(typeof(NestedParent.NestedChild), "System.ComponentModel.Composition.NestedParent+NestedChild");
- expectations.Add(typeof(int[,]), "System.Int32[,]");
- expectations.Add(typeof(int[,][][]), "System.Int32[,][][]");
- expectations.Add(typeof(Array[,][][]).MakePointerType(), "System.Array[,][][]*");
- expectations.Add(typeof(int).MakePointerType(), "System.Int32*");
- expectations.Add(typeof(int).MakePointerType().MakeArrayType(3).MakeArrayType().MakePointerType(), "System.Int32*[][,,]*");
- expectations.Add(typeof(int).MakeByRefType(), "System.Int32&");
- expectations.Add(typeof(int).MakePointerType().MakeArrayType(4).MakeArrayType().MakeByRefType(), "System.Int32*[][,,,]&");
- expectations.Add(typeof(List<>), "System.Collections.Generic.List()");
- expectations.Add(typeof(Dictionary<int,double>), "System.Collections.Generic.Dictionary(System.Int32,System.Double)");
- expectations.Add(typeof(Dictionary<Dictionary<int,double>,double>), "System.Collections.Generic.Dictionary(System.Collections.Generic.Dictionary(System.Int32,System.Double),System.Double)");
- expectations.Add(typeof(GenericContract1<int>.GenericContract2.GenericContract3<double>), "System.ComponentModel.Composition.GenericContract1(System.Int32)+GenericContract2+GenericContract3(System.Double)");
- expectations.Add(typeof(GenericContract4<int,double>.GenericContract5<double,int>.GenericContract6<int,double>), "System.ComponentModel.Composition.GenericContract4(System.Int32,System.Double)+GenericContract5(System.Double,System.Int32)+GenericContract6(System.Int32,System.Double)");
- expectations.Add(typeof(GenericContract4<,>.GenericContract5<,>.GenericContract6<,>), "System.ComponentModel.Composition.GenericContract4(,)+GenericContract5(,)+GenericContract6(,)");
- expectations.Add(typeof(GenericContract7), "System.ComponentModel.Composition.GenericContract7");
- expectations.Add(typeof(GenericContract8<int>), "System.ComponentModel.Composition.GenericContract8(System.Int32)");
- expectations.Add(typeof(GenericContract4<int,double>.GenericContract5<double,int>[][,,,,]), "System.ComponentModel.Composition.GenericContract4(System.Int32,System.Double)+GenericContract5(System.Double,System.Int32)[][,,,,]");
- expectations.Add(typeof(GenericContract4<int,double>.GenericContract5<double,int>).MakePointerType(), "System.ComponentModel.Composition.GenericContract4(System.Int32,System.Double)+GenericContract5(System.Double,System.Int32)*");
- expectations.Add(typeof(GenericContract4<int,double>.GenericContract5<double,int>[][,]).MakePointerType().MakeArrayType(4), "System.ComponentModel.Composition.GenericContract4(System.Int32,System.Double)+GenericContract5(System.Double,System.Int32)[][,]*[,,,]"); expectations.Add(typeof(OuterClassWithGenericNested.GenericNested<int>), "System.ComponentModel.Composition.OuterClassWithGenericNested+GenericNested(System.Int32)");
- expectations.Add(typeof(Delegate), "System.Delegate");
- expectations.Add(typeof(MulticastDelegate), "System.MulticastDelegate");
- expectations.Add(typeof(Action), "System.Void()");
- expectations.Add(typeof(Func<Func<string>>), "System.Func(System.String)()");
- expectations.Add(typeof(DelegateCompositionTests.DoWorkDelegate), "System.Object(System.Int32,System.Object&,System.String&)");
- expectations.Add(typeof(DelegateCompositionTests.DelegateOneArg), "System.Int32(System.Int32)");
- expectations.Add(typeof(DelegateCompositionTests.DelegateTwoArgs), "System.Int32(System.Int32,System.Int32)");
- expectations.Add(typeof(DelegateCompositionTests.SimpleDelegate), "System.Int32()");
- expectations.Add(typeof(DelegateCompositionTests.ActionWith9Args), "System.Void(System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)");
- expectations.Add(typeof(DelegateCompositionTests.FuncWith9Args), "System.Int32(System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)");
- expectations.Add(EmitGenericType("MyGeneratedType", typeof(int)), "MyGeneratedType(System.Int32)");
- expectations.Add(EmitGenericType("MyGeneratedType`1", typeof(string)), "MyGeneratedType(System.String)");
- expectations.Add(EmitGenericType("_name_", typeof(List<>)), "_name_(System.Collections.Generic.List())");
-
- // This particular case can clash with the name generation for methods because we use () for both generics and methods
- // we may want to fix this clash by changing the generic markers but it is likely to be very rare.
- expectations.Add(EmitGenericType("System.Void", typeof(int)), "System.Void(System.Int32)");
-
- foreach (var e in expectations)
- {
- string typeIdentity = AttributedModelServices.GetTypeIdentity(e.Input);
- Assert.AreEqual(e.Output, typeIdentity);
- }
-
- // Do it again to excerise the cache.
- foreach (var e in expectations)
- {
- string typeIdentity = AttributedModelServices.GetTypeIdentity(e.Input);
- Assert.AreEqual(e.Output, typeIdentity);
- }
- }
-
- public Type EmitGenericType(string typeName, Type genericArgumentType)
- {
- var assemblyName = new AssemblyName("EmittedTestAssembly");
- var assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run);
- var moduleBuilder = assemblyBuilder.DefineDynamicModule("EmittedTestModule");
- var typeBuilder = moduleBuilder.DefineType(typeName, TypeAttributes.Public);
-
- GenericTypeParameterBuilder T = typeBuilder.DefineGenericParameters(new string[] { "T" })[0];
- typeBuilder.SetCustomAttribute(new CustomAttributeBuilder(typeof(ExportAttribute).GetConstructor(Type.EmptyTypes), new object[0]));
-
- return typeBuilder.CreateType().MakeGenericType(genericArgumentType);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ConcreteComposablePart.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ConcreteComposablePart.cs deleted file mode 100644 index e436fc36709..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ConcreteComposablePart.cs +++ /dev/null @@ -1,93 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.Linq;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition
-{
- internal class ConcreteComposablePart : ComposablePart, IDisposable
- {
- private readonly List<Export> _exports = new List<Export>();
- private readonly List<ImportDefinition> _imports = new List<ImportDefinition>();
- private readonly IDictionary<string, IEnumerable<Export>> _setImports = new Dictionary<string, IEnumerable<Export>>();
-
- public ConcreteComposablePart()
- {
- }
-
- public override IDictionary<string, object> Metadata
- {
- get { return MetadataServices.EmptyMetadata; }
- }
-
- public IDictionary<string, IEnumerable<Export>> SetImports
- {
- get { return this._setImports; }
- }
-
- public override IEnumerable<ExportDefinition> ExportDefinitions
- {
- get { return this._exports.Select(export => export.Definition); }
- }
-
- public override IEnumerable<ImportDefinition> ImportDefinitions
- {
- get { return this._imports; }
- }
-
- public ImportDefinition AddImport(string contractName, ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite)
- {
- var import = ImportDefinitionFactory.CreateDefault(contractName, cardinality, isRecomposable, isPrerequisite);
-
- this.AddImport(import);
- return import;
- }
-
- public void AddImport(ImportDefinition import)
- {
- this._imports.Add(import);
- }
-
- public void AddExport(string contractName, object value)
- {
- this.AddExport(ExportFactory.Create(contractName, () => value));
- }
-
- public void AddExport(Export export)
- {
- this._exports.Add(export);
- }
-
- public override object GetExportedValue(ExportDefinition definition)
- {
- Export export = _exports.First(e => e.Definition == definition);
-
- return export.Value;
- }
-
- public override void SetImport(ImportDefinition definition, IEnumerable<Export> exports)
- {
- ContractBasedImportDefinition contractBasedDefinition = (ContractBasedImportDefinition)definition;
- this._setImports[contractBasedDefinition.ContractName] = exports;
-
- foreach (Export export in exports)
- {
- var value = export.Value;
- }
- }
-
- void IDisposable.Dispose()
- {
- foreach (var disposable in _exports.Select(export => export.Value).OfType<IDisposable>())
- {
- disposable.Dispose();
- }
- }
- }
-}
-
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ConstraintServicesTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ConstraintServicesTests.cs deleted file mode 100644 index 9ef33a3f852..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ConstraintServicesTests.cs +++ /dev/null @@ -1,327 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Linq;
-using System.Linq.Expressions;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.ReflectionModel;
-using System.Reflection;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class ConstraintServicesTests
- {
- [TestMethod]
- public void TypeIdentityConstraint_ValidMatchingExportDef_ShouldMatch()
- {
- var contractName = "MyContract";
- var typeIdentity = AttributedModelServices.GetTypeIdentity(typeof(ConstraintServicesTests));
- var metadata = new Dictionary<string, object>();
- metadata.Add(CompositionConstants.ExportTypeIdentityMetadataName, typeIdentity);
-
- var exportDefinition = new ExportDefinition(contractName, metadata);
-
- var constraint = ConstraintServices.CreateConstraint(contractName, typeIdentity, null, CreationPolicy.Any);
-
- var predicate = constraint.Compile();
-
- Assert.IsTrue(predicate(exportDefinition));
- }
-
- [TestMethod]
- public void TypeIdentityConstraint_ValidNonMatchingExportDef_ShouldNotMatch()
- {
- var contractName = "MyContract";
- var typeIdentity = AttributedModelServices.GetTypeIdentity(typeof(ConstraintServicesTests));
- var metadata = new Dictionary<string, object>();
- metadata.Add(CompositionConstants.ExportTypeIdentityMetadataName, typeIdentity + "Another Identity");
-
- var exportDefinition = new ExportDefinition(contractName, metadata);
-
- var constraint = ConstraintServices.CreateConstraint(contractName, typeIdentity, null, CreationPolicy.Any);
-
- var predicate = constraint.Compile();
-
- Assert.IsFalse(predicate(exportDefinition));
- }
-
- [TestMethod]
- public void TypeIdentityConstraint_InvalidExportDef_ShouldNotMatch()
- {
- var contractName = "MyContract";
- var typeIdentity = AttributedModelServices.GetTypeIdentity(typeof(ConstraintServicesTests));
- var metadata = new Dictionary<string, object>();
-
- var exportDefinition = new ExportDefinition(contractName, metadata);
-
- var constraint = ConstraintServices.CreateConstraint(contractName, typeIdentity, null, CreationPolicy.Any);
-
- var predicate = constraint.Compile();
-
- Assert.IsFalse(predicate(exportDefinition));
- }
-
- [TestMethod]
- public void CreationPolicyConstraint_ValidMatchingCreationPolicy_ShouldMatch()
- {
- var contractName = "MyContract";
- var metadata = new Dictionary<string, object>();
- metadata.Add(CompositionConstants.PartCreationPolicyMetadataName, CreationPolicy.Shared);
-
- var exportDefinition = new ExportDefinition(contractName, metadata);
-
- var constraint = ConstraintServices.CreateConstraint(contractName, null, null, CreationPolicy.Shared);
-
- var predicate = constraint.Compile();
-
- Assert.IsTrue(predicate(exportDefinition));
- }
-
- [TestMethod]
- public void CreationPolicyConstraint_ValidNonMatchingCreationPolicy_ShouldNotMatch()
- {
- var contractName = "MyContract";
- var metadata = new Dictionary<string, object>();
- metadata.Add(CompositionConstants.PartCreationPolicyMetadataName, CreationPolicy.NonShared);
-
- var exportDefinition = new ExportDefinition(contractName, metadata);
-
- var constraint = ConstraintServices.CreateConstraint(contractName, null, null, CreationPolicy.Shared);
-
- var predicate = constraint.Compile();
-
- Assert.IsFalse(predicate(exportDefinition));
- }
-
- [TestMethod]
- public void CreationPolicyConstraint_InvalidCreationPolicy_ShouldNotMatch()
- {
- var contractName = "MyContract";
- var metadata = new Dictionary<string, object>();
- metadata.Add(CompositionConstants.PartCreationPolicyMetadataName, "Shared");
-
- var exportDefinition = new ExportDefinition(contractName, metadata);
-
- var constraint = ConstraintServices.CreateConstraint(contractName, null, null, CreationPolicy.Shared);
-
- var predicate = constraint.Compile();
-
- Assert.IsFalse(predicate(exportDefinition));
- }
-
- [TestMethod]
- public void CreationPolicyConstraint_NoCreationPolicy_ShouldNotMatch()
- {
- var contractName = "MyContract";
- var metadata = new Dictionary<string, object>();
-
- var exportDefinition = new ExportDefinition(contractName, metadata);
-
- var constraint = ConstraintServices.CreateConstraint(contractName, null, null, CreationPolicy.Shared);
-
- var predicate = constraint.Compile();
-
- Assert.IsTrue(predicate(exportDefinition));
- }
-
- [TestMethod]
- public void PartCreatorConstraint_ShouldMatchPartCreatorExportDefinition()
- {
- var partCreatorImportDef = ReflectionModelServices.CreateImportDefinition(
- new LazyMemberInfo(MemberTypes.Field, () => new MemberInfo[] { typeof(ConstraintServicesTests) }),
- "Foo",
- "Foo",
- new KeyValuePair<string, Type>[] { new KeyValuePair<string, Type>("MDKey", typeof(string)) },
- ImportCardinality.ZeroOrMore,
- false,
- CreationPolicy.Any,
- true, // IsPartCreator
- null);
-
- var metadata = new Dictionary<string, object>();
- metadata["MDKey"] = "MDValue";
- metadata[CompositionConstants.ExportTypeIdentityMetadataName] = "Foo";
-
- var productExportDefinition = new ExportDefinition("Foo", metadata);
-
- metadata = new Dictionary<string, object>(metadata);
- metadata[CompositionConstants.ExportTypeIdentityMetadataName] = CompositionConstants.PartCreatorTypeIdentity;
- metadata[CompositionConstants.ProductDefinitionMetadataName] = productExportDefinition;
-
- var exportDefinition = new ExportDefinition(CompositionConstants.PartCreatorContractName, metadata);
-
- var predicate = partCreatorImportDef.Constraint.Compile();
- Assert.IsTrue(partCreatorImportDef.IsConstraintSatisfiedBy(exportDefinition));
- Assert.IsTrue(predicate(exportDefinition));
- }
-
- [TestMethod]
- public void TryParseConstraint_ConstraintFromCreateConstraintAsConstraintArgument1_CanParse()
- {
- var expectations = Expectations.GetContractNamesWithEmpty();
-
- foreach (var e in expectations)
- {
- var constraint = ConstraintServices.CreateConstraint((string)e, null, null, CreationPolicy.Any);
-
- AssertCanParse(constraint, e, new Dictionary<string, Type>());
- }
- }
-
- [TestMethod]
- public void TryParseConstraint_ConstraintFromCreateConstraintAsConstraintArgument2_CanParse()
- {
- var expectations = Expectations.GetRequiredMetadata();
-
- foreach (var e in expectations)
- {
- var constraint = ConstraintServices.CreateConstraint((IEnumerable<KeyValuePair<string, Type>>)e);
-
- AssertCanParse(constraint, (string)null, e);
- }
- }
-
- [TestMethod]
- public void TryParseConstraint_ConstraintFromCreateConstraintAsConstraintArgument3_CanParse()
- {
- var contractNames = Expectations.GetContractNames();
- var metadataValues = Expectations.GetRequiredMetadata();
-
- foreach (var contractName in contractNames)
- {
- foreach (var metadataValue in metadataValues)
- {
- var constraint = ConstraintServices.CreateConstraint(contractName, null, metadataValue, CreationPolicy.Any);
-
- AssertCanParse(constraint, contractName, metadataValue);
- }
- }
- }
-
- [TestMethod]
- public void TryParseConstraint_ContractNameOperatorEqualsAsConstraintArgument_CanParse()
- {
- var expectations = new ExpectationCollection<Expression<Func<ExportDefinition, bool>>, string>();
- expectations.Add(item => item.ContractName == "", "");
- expectations.Add(item => item.ContractName == " ", " ");
- expectations.Add(item => item.ContractName == " ", " ");
- expectations.Add(item => item.ContractName == "ContractName", "ContractName");
- expectations.Add(item => item.ContractName == "contractName", "contractName");
- expectations.Add(item => item.ContractName == "{ContractName}", "{ContractName}");
- expectations.Add(item => item.ContractName == "{ContractName}Name", "{ContractName}Name");
- expectations.Add(item => item.ContractName == "System.Windows.Forms.Control", "System.Windows.Forms.Control");
- expectations.Add(item => item.ContractName == "{System.Windows.Forms}Control", "{System.Windows.Forms}Control");
-
- foreach (var e in expectations)
- {
- AssertCanParse(e.Input, e.Output, new Dictionary<string, Type>());
- }
- }
-
- [TestMethod]
- public void TryParseConstraint_MetadataContainsKeyAsConstraintArgument_CanParse()
- {
- var expectations = new ExpectationCollection<Expression<Func<ExportDefinition, bool>>, Dictionary<string, Type>>();
- expectations.Add(
- item => typeof(string).IsInstanceOfType(item.Metadata[""]),
- new Dictionary<string, Type>{ {"", typeof(string) }});
- expectations.Add(
- item => typeof(string).IsInstanceOfType(item.Metadata["value"]),
- new Dictionary<string, Type>{ {"value", typeof(string) } });
- expectations.Add(
- item => typeof(string).IsInstanceOfType(item.Metadata["Value"]),
- new Dictionary<string, Type>{ {"Value", typeof(string) } });
- expectations.Add(
- item => typeof(string).IsInstanceOfType(item.Metadata["Value"]) && typeof(int).IsInstanceOfType(item.Metadata["value"]),
- new Dictionary<string, Type>{ {"Value", typeof(string)}, {"value", typeof(int) }});
- expectations.Add(
- item => typeof(string).IsInstanceOfType(item.Metadata["Value"]) && typeof(int).IsInstanceOfType(item.Metadata["value"]) && typeof(object).IsInstanceOfType(item.Metadata["Metadata"]),
- new Dictionary<string, Type>{ {"Value", typeof(string)}, {"value", typeof(int)}, {"Metadata", typeof(object) } });
-
- foreach (var e in expectations)
- {
- AssertCanParse(e.Input, (string)null, e.Output);
- }
- }
-
- [TestMethod]
- public void TryParseConstraint_ContractNameOperatorEqualsAndMetadataContainsKeyAsConstraintArgumen_CanParse()
- {
- var expectations = new ExpectationCollection<Expression<Func<ExportDefinition, bool>>, KeyValuePair<string, Type>[]>();
- expectations.Add(
- item => item.ContractName == "ContractName" && typeof(string).IsInstanceOfType(item.Metadata[""]),
- new KeyValuePair<string, Type>[] { new KeyValuePair<string, Type>("", typeof(string)) });
- expectations.Add(
- item => item.ContractName == "ContractName" && typeof(string).IsInstanceOfType(item.Metadata["value"]),
- new KeyValuePair<string, Type>[] { new KeyValuePair<string, Type>("value", typeof(string)) });
- expectations.Add(
- item => item.ContractName == "ContractName" && typeof(string).IsInstanceOfType(item.Metadata["Value"]),
- new KeyValuePair<string, Type>[] { new KeyValuePair<string, Type>("Value", typeof(string)) });
- expectations.Add(
- item => item.ContractName == "ContractName" && typeof(string).IsInstanceOfType(item.Metadata["Value"]) && typeof(int).IsInstanceOfType(item.Metadata["value"]),
- new KeyValuePair<string, Type>[] { new KeyValuePair<string, Type>("Value", typeof(string)), new KeyValuePair<string, Type>("value", typeof(int)) });
- expectations.Add(
- item => item.ContractName == "ContractName" && typeof(string).IsInstanceOfType(item.Metadata["Value"]) && typeof(int).IsInstanceOfType(item.Metadata["value"]) && typeof(object).IsInstanceOfType(item.Metadata["Metadata"]),
- new KeyValuePair<string, Type>[] { new KeyValuePair<string, Type>("Value", typeof(string)), new KeyValuePair<string, Type>("value", typeof(int)), new KeyValuePair<string, Type>("Metadata", typeof(object)) });
-
- foreach (var e in expectations)
- {
- AssertCanParse(e.Input, "ContractName", e.Output);
- }
- }
-
-
- [TestMethod]
- public void TryParseConstraint_ContractNameReverseOperatorEqualsAsConstraintArgument_CanParse()
- {
- var expectations = new ExpectationCollection<Expression<Func<ExportDefinition, bool>>, string>();
- expectations.Add(item => "" == item.ContractName, "");
- expectations.Add(item => " " == item.ContractName, " ");
- expectations.Add(item => " " == item.ContractName, " ");
- expectations.Add(item => "ContractName" == item.ContractName, "ContractName");
- expectations.Add(item => "contractName" == item.ContractName, "contractName");
- expectations.Add(item => "{ContractName}" == item.ContractName, "{ContractName}");
- expectations.Add(item => "{ContractName}Name" == item.ContractName, "{ContractName}Name");
- expectations.Add(item => "System.Windows.Forms.Control" == item.ContractName, "System.Windows.Forms.Control");
- expectations.Add(item => "{System.Windows.Forms}Control" == item.ContractName, "{System.Windows.Forms}Control");
-
- foreach (var e in expectations)
- {
- AssertCanParse(e.Input, e.Output, new Dictionary<string, Type>());
- }
- }
-
- private static void AssertCanParse(Expression<Func<ExportDefinition, bool>> constraint, string contractName, IEnumerable<KeyValuePair<string, Type>> requiredMetadata)
- {
- Assert.IsNotNull(constraint);
-
- string contractNameResult = null;
- IEnumerable<KeyValuePair<string, Type>> requiredMetadataResult = null;
- bool success = ContraintParser.TryParseConstraint(constraint, out contractNameResult, out requiredMetadataResult);
-
- Assert.IsTrue(success);
- Assert.AreEqual(contractName, contractNameResult);
- EnumerableAssert.AreEqual(requiredMetadata, requiredMetadataResult);
- }
-
- private static void AssertCanNotParse(Expression<Func<ExportDefinition, bool>> constraint)
- {
- Assert.IsNotNull(constraint);
-
- string contractNameResult;
- IEnumerable<KeyValuePair<string, Type>> requiredMetadataResult;
-
- var success = ContraintParser.TryParseConstraint(constraint, out contractNameResult, out requiredMetadataResult);
- Assert.IsFalse(success);
- Assert.IsNull(contractNameResult);
- Assert.IsNull(requiredMetadataResult);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ContractBasedImportDefinitionTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ContractBasedImportDefinitionTests.cs deleted file mode 100644 index 19dd66bf5a6..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ContractBasedImportDefinitionTests.cs +++ /dev/null @@ -1,370 +0,0 @@ -//------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.Linq.Expressions;
-using System.UnitTesting;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.UnitTesting;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.Hosting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class ContractBasedImportDefinitionTests
- {
- [TestMethod]
- public void Constructor1_ShouldSetRequiredMetadataPropertyToEmptyEnumerable()
- {
- var definition = new NoOverridesContractBasedImportDefinition();
-
- EnumerableAssert.IsEmpty(definition.RequiredMetadata);
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetCardinalityPropertyToExactlyOne()
- {
- var definition = new NoOverridesContractBasedImportDefinition();
-
- Assert.AreEqual(ImportCardinality.ExactlyOne, definition.Cardinality);
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetIsPrerequisitePropertyToTrue()
- {
- var definition = new NoOverridesContractBasedImportDefinition();
-
- Assert.IsTrue(definition.IsPrerequisite);
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetIsRecomposablePropertyToFalse()
- {
- var definition = new NoOverridesContractBasedImportDefinition();
-
- Assert.IsFalse(definition.IsRecomposable);
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetRequiredCreationPolicyToAny()
- {
- var definition = new NoOverridesContractBasedImportDefinition();
-
- Assert.AreEqual(CreationPolicy.Any, definition.RequiredCreationPolicy);
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetRequiredTypeIdentityToNull()
- {
- var definition = new NoOverridesContractBasedImportDefinition();
-
- Assert.IsNull(definition.RequiredTypeIdentity);
- }
-
- [TestMethod]
- public void Constructor2_NullAsContractNameArgument_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("contractName", () =>
- {
- new ContractBasedImportDefinition((string)null, (string)null, Enumerable.Empty<KeyValuePair<string, Type>>(), ImportCardinality.ExactlyOne, false, false, CreationPolicy.Any);
- });
- }
-
- [TestMethod]
- public void Constructor2_EmptyStringAsContractNameArgument_ShouldThrowArgument()
- {
- ExceptionAssert.ThrowsArgument<ArgumentException>("contractName", () =>
- {
- new ContractBasedImportDefinition("", (string)null, Enumerable.Empty<KeyValuePair<string, Type>>(), ImportCardinality.ExactlyOne, false, false, CreationPolicy.Any);
- });
- }
-
- [TestMethod]
- public void RequiredMetadata_ArrayWithNullKeyAsRequiredMetadataArgument_ShouldThrowInvalidOperation()
- {
- var requiredMetadata = new KeyValuePair<string, Type>[] { new KeyValuePair<string, Type>(null, typeof(object)) };
-
- var import = new ContractBasedImportDefinition("requiredMetadata", (string)null, requiredMetadata, ImportCardinality.ExactlyOne, false, false, CreationPolicy.Any);
-
- ExceptionAssert.Throws<InvalidOperationException>(() =>
- {
- var m = import.RequiredMetadata;
- });
- }
-
- [TestMethod]
- public void RequiredMetadata_ArrayWithNullValueAsRequiredMetadataArgument_ShouldThrowInvalidOperation()
- {
- var requiredMetadata = new KeyValuePair<string, Type>[] { new KeyValuePair<string, Type>("key", null) };
- var import = new ContractBasedImportDefinition("requiredMetadata", (string)null, requiredMetadata, ImportCardinality.ExactlyOne, false, false, CreationPolicy.Any);
-
- ExceptionAssert.Throws<InvalidOperationException>(() =>
- {
- var m = import.RequiredMetadata;
- });
- }
-
-
- [TestMethod]
- public void Constructor2_NullAsRequiredMetadataArgument_ShouldSetRequiredMetadataToEmptyEnumerable()
- {
- var definition = new ContractBasedImportDefinition("requiredMetadata", (string)null, (IEnumerable<KeyValuePair<string, Type>>)null, ImportCardinality.ExactlyOne, false, false, CreationPolicy.Any);
-
- EnumerableAssert.IsEmpty(definition.RequiredMetadata);
- }
-
- [TestMethod]
- public void Constructor2_OutOfRangeValueAsCardinalityArgument_ShouldThrowArgument()
- {
- var expectations = Expectations.GetInvalidEnumValues<ImportCardinality>();
-
- foreach (var e in expectations)
- {
- ExceptionAssert.ThrowsArgument<ArgumentException>("cardinality", () =>
- {
- new ContractBasedImportDefinition((string)null, (string)null, Enumerable.Empty<KeyValuePair<string, Type>>(), e, false, false, CreationPolicy.Any);
- });
- }
- }
-
- [TestMethod]
- public void Constructor2_ValueAsCardinalityArgument_ShouldSetCardinalityProperty()
- {
- var expectations = Expectations.GetEnumValues<ImportCardinality>();
-
- foreach (var e in expectations)
- {
- var definition = new ContractBasedImportDefinition("ContractName", (string)null, Enumerable.Empty<KeyValuePair<string, Type>>(), e, false, false, CreationPolicy.Any);
-
- Assert.AreEqual(e, definition.Cardinality);
- }
- }
-
- [TestMethod]
- public void Constructor2_ValueAsContractNameArgument_ShouldSetContractNameProperty()
- {
- var expectations = Expectations.GetContractNames();
-
- foreach (var e in expectations)
- {
- var definition = new ContractBasedImportDefinition(e, (string)null, Enumerable.Empty<KeyValuePair<string, Type>>(), ImportCardinality.ExactlyOne, false, false, CreationPolicy.Any);
-
- Assert.AreEqual(e, definition.ContractName);
- }
- }
-
- [TestMethod]
- public void Constructor2_ValueAsRequiredMetadataArgument_ShouldSetRequiredMetadataProperty()
- {
- var expectations = Expectations.GetRequiredMetadataWithEmpty();
-
- foreach (var e in expectations)
- {
- var definition = new ContractBasedImportDefinition("ContractName", (string)null, e, ImportCardinality.ExactlyOne, false, false, CreationPolicy.Any);
-
- EnumerableAssert.AreEqual(e, definition.RequiredMetadata);
- }
- }
-
- [TestMethod]
- public void Constructor2_ValueAsIsRecomposableArgument_ShouldSetIsRecomposableProperty()
- {
- var expectations = Expectations.GetBooleans();
-
- foreach (var e in expectations)
- {
- var definition = new ContractBasedImportDefinition("ContractName", (string)null, Enumerable.Empty<KeyValuePair<string, Type>>(), ImportCardinality.ExactlyOne, e, false, CreationPolicy.Any);
-
- Assert.AreEqual(e, definition.IsRecomposable);
- }
- }
-
- [TestMethod]
- public void Constructor2_ValueAsIsPrerequisiteArgument_ShouldSetIsPrerequisiteProperty()
- {
- var expectations = Expectations.GetBooleans();
-
- foreach (var e in expectations)
- {
- var definition = new ContractBasedImportDefinition("ContractName", (string)null, Enumerable.Empty<KeyValuePair<string, Type>>(), ImportCardinality.ExactlyOne, false, e, CreationPolicy.Any);
-
- Assert.AreEqual(e, definition.IsPrerequisite);
- }
- }
-
- [TestMethod]
- public void Constructor2_ShouldSetRequiredCreationPolicyToAny()
- {
- var expectations = Expectations.GetEnumValues<CreationPolicy>();
-
- foreach (var e in expectations)
- {
- var definition = new ContractBasedImportDefinition("ContractName", (string)null, Enumerable.Empty<KeyValuePair<string, Type>>(), ImportCardinality.ExactlyOne, false, false, e);
-
- Assert.AreEqual(e, definition.RequiredCreationPolicy);
- }
- }
-
- [TestMethod]
- public void Constraint_ShouldIncludeContractNameProperty()
- {
- var expectations = Expectations.GetContractNames();
-
- foreach (var e in expectations)
- {
- var definition = new ContractBasedImportDefinition(e, (string)null, (IEnumerable<KeyValuePair<string, Type>>)null, ImportCardinality.ExactlyOne, true, false, CreationPolicy.Any);
-
- ConstraintAssert.Contains(definition.Constraint, e);
- }
- }
-
- [TestMethod]
- public void Constraint_ShouldIncludeRequiredMetadataProperty()
- {
- var expectations = Expectations.GetRequiredMetadataWithEmpty();
-
- foreach (var e in expectations)
- {
- var definition = new ContractBasedImportDefinition("ContractName", (string)null, e, ImportCardinality.ExactlyOne, true, false, CreationPolicy.Any);
-
- ConstraintAssert.Contains(definition.Constraint, "ContractName", e);
- }
- }
-
- [TestMethod]
- public void Constraint_ShouldIncludeOverriddenContractNameProperty()
- {
- var expectations = Expectations.GetContractNames();
-
- foreach (var e in expectations)
- {
- var definition = new DerivedContractBasedImportDefinition(e);
-
- ConstraintAssert.Contains(definition.Constraint, e);
- }
- }
-
- [TestMethod]
- public void Constraint_ShouldIncludeOverriddenRequiredMetadata()
- {
- var expectations = Expectations.GetRequiredMetadataWithEmpty();
-
- foreach (var e in expectations)
- {
- var definition = new DerivedContractBasedImportDefinition("ContractName", e);
-
- ConstraintAssert.Contains(definition.Constraint, "ContractName", e);
- }
- }
-
- [TestMethod]
- public void IsConstraintSatisfiedBy_ContractNameMatch()
- {
- var export = CreateSimpleExport();
- var import = CreateSimpleImport("ContractName", "ContractName", new string[0], new Type[0]);
- Assert.IsTrue(import.IsConstraintSatisfiedBy(export));
- }
-
- [TestMethod]
- public void IsConstraintSatisfiedBy_ContractNameMismatch()
- {
- var export = CreateSimpleExport();
- var import = CreateSimpleImport("NonContractName", "ContractName", new string[0], new Type[0]);
- Assert.IsFalse(import.IsConstraintSatisfiedBy(export));
- }
-
- [TestMethod]
- public void IsConstraintSatisfiedBy_TypeIdentityMismatch()
- {
- var export = CreateSimpleExport();
- var import = CreateSimpleImport("ContractName", "NonContractName", new string[0], new Type[0]);
- Assert.IsFalse(import.IsConstraintSatisfiedBy(export));
- }
-
- [TestMethod]
- public void IsConstraintSatisfiedBy_MetadataMatch()
- {
- var export = CreateSimpleExport();
- var import = CreateSimpleImport("ContractName", "ContractName", new string[]{"Int", "String", "Type"}, new Type[]{typeof(int), typeof(string), typeof(Type)});
- Assert.IsTrue(import.IsConstraintSatisfiedBy(export));
- }
-
- [TestMethod]
- public void IsConstraintSatisfiedBy_MetadataKeyMismatch()
- {
- var export = CreateSimpleExport();
- var import = CreateSimpleImport("ContractName", "ContractName", new string[] { "Int", "String1", "Type" }, new Type[] { typeof(int), typeof(string), typeof(Type) });
- Assert.IsFalse(import.IsConstraintSatisfiedBy(export));
- }
-
- [TestMethod]
- public void IsConstraintSatisfiedBy_MetadataTypeMatch()
- {
- var export = CreateSimpleExport();
- var import = CreateSimpleImport("ContractName", "ContractName", new string[] { "Int", "String", "Type" }, new Type[] { typeof(int), typeof(string), typeof(int) });
- Assert.IsFalse(import.IsConstraintSatisfiedBy(export));
- }
-
- private static ExportDefinition CreateSimpleExport()
- {
- var metadata = new Dictionary<string, object>();
- metadata.Add("Int", 42);
- metadata.Add("String", "42");
- metadata.Add("Type", typeof(string));
- metadata.Add(CompositionConstants.ExportTypeIdentityMetadataName, "ContractName");
- return new ExportDefinition("ContractName", metadata);
- }
-
- private static ContractBasedImportDefinition CreateSimpleImport(string contractName, string typeIdentity, string[] metadataKeys, Type[] metadataTypes)
- {
- Dictionary<string, Type> requiredMetadata = new Dictionary<string, Type>();
- Assert.AreEqual(metadataKeys.Length, metadataTypes.Length);
- for(int i=0; i< metadataKeys.Length; i++)
- {
- requiredMetadata[metadataKeys[i]] = metadataTypes[i];
- }
- return new ContractBasedImportDefinition(contractName, typeIdentity, requiredMetadata, ImportCardinality.ZeroOrMore, false, false, CreationPolicy.Any);
-
- }
-
- private class NoOverridesContractBasedImportDefinition : ContractBasedImportDefinition
- {
- public NoOverridesContractBasedImportDefinition()
- {
- }
- }
-
- private class DerivedContractBasedImportDefinition : ContractBasedImportDefinition
- {
- private readonly string _contractName;
- private readonly IEnumerable<KeyValuePair<string, Type>> _requiredMetadata;
-
- public DerivedContractBasedImportDefinition(string contractName)
- {
- _contractName = contractName;
- }
-
- public DerivedContractBasedImportDefinition(string contractName, IEnumerable<KeyValuePair<string, Type>> requiredMetadata)
- {
- _contractName = contractName;
- _requiredMetadata = requiredMetadata;
- }
-
- public override string ContractName
- {
- get { return _contractName; }
- }
-
- public override IEnumerable<KeyValuePair<string, Type>> RequiredMetadata
- {
- get { return _requiredMetadata; }
- }
- }
- }
-}
-
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ContractMismatchExceptionTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ContractMismatchExceptionTests.cs deleted file mode 100644 index ca3c5d672d3..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ContractMismatchExceptionTests.cs +++ /dev/null @@ -1,174 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-#if !SILVERLIGHT
-using System.Runtime.Serialization;
-#endif
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class ContractMismatchExceptionTests
- {
- [TestMethod]
- public void Constructor1_ShouldSetMessagePropertyToDefault()
- {
- var exception = new CompositionContractMismatchException();
-
- ExceptionAssert.HasDefaultMessage(exception);
- }
-
- [TestMethod]
- public void Constructor2_NullAsMessageArgument_ShouldSetMessagePropertyToDefault()
- {
- var exception = new CompositionContractMismatchException((string)null);
-
- ExceptionAssert.HasDefaultMessage(exception);
- }
-
- [TestMethod]
- public void Constructor3_NullAsMessageArgument_ShouldSetMessagePropertyToDefault()
- {
- var exception = new CompositionContractMismatchException((string)null, new Exception());
-
- ExceptionAssert.HasDefaultMessage(exception);
- }
-
- [TestMethod]
- public void Constructor2_ValueAsMessageArgument_ShouldSetMessageProperty()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = new CompositionContractMismatchException(e);
-
- Assert.AreEqual(e, exception.Message);
- }
- }
-
- [TestMethod]
- public void Constructor3_ValueAsMessageArgument_ShouldSetMessageProperty()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = new CompositionContractMismatchException(e, new Exception());
-
- Assert.AreEqual(e, exception.Message);
- }
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetInnerExceptionPropertyToNull()
- {
- var exception = new CompositionContractMismatchException();
-
- Assert.IsNull(exception.InnerException);
- }
-
- [TestMethod]
- public void Constructor2_ShouldSetInnerExceptionPropertyToNull()
- {
- var exception = new CompositionContractMismatchException("Message");
-
- Assert.IsNull(exception.InnerException);
- }
-
- [TestMethod]
- public void Constructor3_NullAsInnerExceptionArgument_ShouldSetInnerExceptionPropertyToNull()
- {
- var exception = new CompositionContractMismatchException("Message", (Exception)null);
-
- Assert.IsNull(exception.InnerException);
- }
-
- [TestMethod]
- public void Constructor3_ValueAsInnerExceptionArgument_ShouldSetInnerExceptionProperty()
- {
- var expectations = Expectations.GetInnerExceptions();
-
- foreach (var e in expectations)
- {
- var exception = new CompositionContractMismatchException("Message", e);
-
- Assert.AreSame(e, exception.InnerException);
- }
- }
-
-#if !SILVERLIGHT
-
- [TestMethod]
- public void Constructor4_NullAsInfoArgument_ShouldThrowArgumentNull()
- {
- var context = new StreamingContext();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("info", () =>
- {
- SerializationTestServices.Create<CompositionContractMismatchException>((SerializationInfo)null, context);
- });
- }
-
- [TestMethod]
- public void InnerException_CanBeSerialized()
- {
- var expectations = Expectations.GetInnerExceptionsWithNull();
-
- foreach (var e in expectations)
- {
- var exception = CreateContractMismatchException(e);
-
- var result = SerializationTestServices.RoundTrip(exception);
-
- ExtendedAssert.IsInstanceOfSameType(exception.InnerException, result.InnerException);
- }
- }
-
- [TestMethod]
- public void Message_CanBeSerialized()
- {
- var expectations = Expectations.GetExceptionMessages();
-
- foreach (var e in expectations)
- {
- var exception = CreateContractMismatchException(e);
-
- var result = SerializationTestServices.RoundTrip(exception);
-
- Assert.AreEqual(exception.Message, result.Message);
- }
- }
-
-#endif
-
- private static CompositionContractMismatchException CreateContractMismatchException()
- {
- return CreateContractMismatchException((string)null, (Exception)null);
- }
-
- private static CompositionContractMismatchException CreateContractMismatchException(string message)
- {
- return CreateContractMismatchException(message, (Exception)null);
- }
-
- private static CompositionContractMismatchException CreateContractMismatchExceptionFromId(string id)
- {
- return CreateContractMismatchException((string)null, (Exception)null);
- }
-
- private static CompositionContractMismatchException CreateContractMismatchException(Exception innerException)
- {
- return CreateContractMismatchException((string)null, innerException);
- }
-
- private static CompositionContractMismatchException CreateContractMismatchException(string message, Exception innerException)
- {
- return new CompositionContractMismatchException(message, innerException);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Diagnostics/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Diagnostics/.gitattributes deleted file mode 100644 index c78a36da4cb..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Diagnostics/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -/CompositionTraceIdTests.cs -crlf -/CompositionTraceSourceTests.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Diagnostics/CompositionTraceIdTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Diagnostics/CompositionTraceIdTests.cs deleted file mode 100644 index 477237fcfdd..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Diagnostics/CompositionTraceIdTests.cs +++ /dev/null @@ -1,20 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.UnitTesting;
-using System.ComponentModel.Composition;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition.Diagnostics
-{
- [TestClass]
- public class CompositionTraceIdTests
- {
- [TestMethod]
- public void CompositionTraceIdsAreInSyncWithTraceIds()
- {
- ExtendedAssert.EnumsContainSameValues<CompositionTraceId, TraceId>();
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Diagnostics/CompositionTraceSourceTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Diagnostics/CompositionTraceSourceTests.cs deleted file mode 100644 index 32f74b8ce7d..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Diagnostics/CompositionTraceSourceTests.cs +++ /dev/null @@ -1,528 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Diagnostics;
-
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.UnitTesting;
-using System.Collections.Generic;
-
-namespace System.ComponentModel.Composition.Diagnostics
-{
- [TestClass]
- public class ComposableTraceSourceTests
- {
-#if !SILVERLIGHT
- [TestMethod]
- public void CanWriteInformation_ShouldReturnFalseByDefault()
- {
- Assert.IsFalse(CompositionTraceSource.CanWriteInformation);
- }
-
- [TestMethod]
- public void CanWriteWarning_ShouldReturnTrueByDefault()
- {
- Assert.IsTrue(CompositionTraceSource.CanWriteWarning);
- }
-
- [TestMethod]
- public void CanWriteError_ShouldReturnTrueByDefault()
- {
- Assert.IsTrue(CompositionTraceSource.CanWriteError);
- }
-
- [TestMethod]
- public void CanWriteInformation_WhenSwitchLevelLessThanInformation_ShouldReturnFalse()
- {
- var levels = GetSourceLevelsLessThan(SourceLevels.Information);
- foreach (var level in levels)
- {
- using (new TraceContext(level))
- {
- Assert.IsFalse(CompositionTraceSource.CanWriteInformation);
- }
- }
- }
-
- [TestMethod]
- public void CanWriteInformation_WhenSwitchLevelGreaterThanOrEqualToInformation_ShouldReturnTrue()
- {
- var levels = GetSourceLevelsGreaterThanOrEqualTo(SourceLevels.Information);
- foreach (var level in levels)
- {
- using (new TraceContext(level))
- {
- Assert.IsTrue(CompositionTraceSource.CanWriteInformation);
- }
- }
- }
-
- [TestMethod]
- public void CanWriteWarning_WhenSwitchLevelLessThanWarning_ShouldReturnFalse()
- {
- var levels = GetSourceLevelsLessThan(SourceLevels.Warning);
- foreach (var level in levels)
- {
- using (new TraceContext(level))
- {
- Assert.IsFalse(CompositionTraceSource.CanWriteWarning);
- }
- }
- }
-
- [TestMethod]
- public void CanWriteWarning_WhenSwitchLevelGreaterThanOrEqualToWarning_ShouldReturnTrue()
- {
- var levels = GetSourceLevelsGreaterThanOrEqualTo(SourceLevels.Warning);
- foreach (var level in levels)
- {
- using (new TraceContext(level))
- {
- Assert.IsTrue(CompositionTraceSource.CanWriteWarning);
- }
- }
- }
-
- [TestMethod]
- public void CanWriteError_WhenSwitchLevelLessThanError_ShouldReturnFalse()
- {
- var levels = GetSourceLevelsLessThan(SourceLevels.Error);
- foreach (var level in levels)
- {
- using (new TraceContext(level))
- {
- Assert.IsFalse(CompositionTraceSource.CanWriteError);
- }
- }
- }
-
- [TestMethod]
- public void CanWriteError_WhenSwitchLevelGreaterThanOrEqualToError_ShouldReturnTrue()
- {
- var levels = GetSourceLevelsGreaterThanOrEqualTo(SourceLevels.Error);
- foreach (var level in levels)
- {
- using (new TraceContext(level))
- {
- Assert.IsTrue(CompositionTraceSource.CanWriteError);
- }
- }
- }
-
- [TestMethod]
- public void WriteInformation_WhenSwitchLevelLessThanInformation_ShouldThrowInternalError()
- {
- var levels = GetSourceLevelsLessThan(SourceLevels.Information);
- foreach (var level in levels)
- {
- using (TraceContext context = new TraceContext(level))
- {
- ThrowsInternalError(() =>
- {
- CompositionTraceSource.WriteInformation(0, "format", "arguments");
- });
- }
- }
- }
-
- [TestMethod]
- public void WriteInformation_WhenSwitchLevelGreaterThanOrEqualToInformation_ShouldWriteToTraceListener()
- {
- var levels = GetSourceLevelsGreaterThanOrEqualTo(SourceLevels.Information);
- foreach (var level in levels)
- {
- using (TraceContext context = new TraceContext(level))
- {
- CompositionTraceSource.WriteInformation(0, "format", "arguments");
-
- Assert.IsNotNull(context.LastTraceEvent);
- }
- }
- }
-
- [TestMethod]
- public void WriteWarning_WhenSwitchLevelLessThanWarning_ShouldThrowInternalError()
- {
- var levels = GetSourceLevelsLessThan(SourceLevels.Warning);
- foreach (var level in levels)
- {
- using (TraceContext context = new TraceContext(level))
- {
- ThrowsInternalError(() =>
- {
- CompositionTraceSource.WriteWarning(0, "format", "arguments");
- });
- }
- }
- }
-
- [TestMethod]
- public void WriteWarning_WhenSwitchLevelGreaterThanOrEqualToWarning_ShouldWriteToTraceListener()
- {
- var levels = GetSourceLevelsGreaterThanOrEqualTo(SourceLevels.Information);
- foreach (var level in levels)
- {
- using (TraceContext context = new TraceContext(level))
- {
- CompositionTraceSource.WriteWarning(0, "format", "arguments");
-
- Assert.IsNotNull(context.LastTraceEvent);
- }
- }
- }
-
- [TestMethod]
- public void WriteError_WhenSwitchLevelLessThanError_ShouldThrowInternalError()
- {
- var levels = GetSourceLevelsLessThan(SourceLevels.Error);
- foreach (var level in levels)
- {
- using (TraceContext context = new TraceContext(level))
- {
- ThrowsInternalError(() =>
- {
- CompositionTraceSource.WriteError(0, "format", "arguments");
- });
- }
- }
- }
-
- [TestMethod]
- public void WriteError_WhenSwitchLevelGreaterThanOrEqualToError_ShouldWriteToTraceListener()
- {
- var levels = GetSourceLevelsGreaterThanOrEqualTo(SourceLevels.Error);
- foreach (var level in levels)
- {
- using (TraceContext context = new TraceContext(level))
- {
- CompositionTraceSource.WriteError(0, "format", "arguments");
-
- Assert.IsNotNull(context.LastTraceEvent);
- }
- }
- }
-
- [TestMethod]
- public void WriteInformation_ShouldWriteTraceEventTypeInformationToTraceListener()
- {
- using (var context = new TraceContext(SourceLevels.Information))
- {
- CompositionTraceSource.WriteInformation(0, "format", "arguments");
-
- Assert.AreEqual(TraceEventType.Information, context.LastTraceEvent.EventType);
- }
- }
-
- [TestMethod]
- public void WriteWarning_ShouldWriteTraceEventTypeWarningToTraceListener()
- {
- using (var context = new TraceContext(SourceLevels.Warning))
- {
- CompositionTraceSource.WriteWarning(0, "format", "arguments");
-
- Assert.AreEqual(TraceEventType.Warning, context.LastTraceEvent.EventType);
- }
- }
-
- [TestMethod]
- public void WriteError_ShouldWriteTraceEventTypeWarningToTraceListener()
- {
- using (var context = new TraceContext(SourceLevels.Error))
- {
- CompositionTraceSource.WriteError(0, "format", "arguments");
-
- Assert.AreEqual(TraceEventType.Error, context.LastTraceEvent.EventType);
- }
- }
-
- [TestMethod]
- public void WriteInformation_ShouldWriteCorrectSourceToTraceListener()
- {
- using (var context = new TraceContext(SourceLevels.Information))
- {
- CompositionTraceSource.WriteInformation(0, "format", "arguments");
-
- Assert.AreEqual("System.ComponentModel.Composition", context.LastTraceEvent.Source);
- }
- }
-
- [TestMethod]
- public void WriteWarning_ShouldWriteCorrectSourceToTraceListener()
- {
- using (var context = new TraceContext(SourceLevels.Warning))
- {
- CompositionTraceSource.WriteWarning(0, "format", "arguments");
-
- Assert.AreEqual("System.ComponentModel.Composition", context.LastTraceEvent.Source);
- }
- }
-
- [TestMethod]
- public void WriteError_ShouldWriteCorrectSourceToTraceListener()
- {
- using (var context = new TraceContext(SourceLevels.Error))
- {
- CompositionTraceSource.WriteError(0, "format", "arguments");
-
- Assert.AreEqual("System.ComponentModel.Composition", context.LastTraceEvent.Source);
- }
- }
-
- [TestMethod]
- public void WriteInformation_ValueAsTraceId_ShouldWriteIdToTraceListener()
- {
- using (var context = new TraceContext(SourceLevels.Information))
- {
- var expectations = Expectations.GetEnumValues<CompositionTraceId>();
- foreach (var e in expectations)
- {
- CompositionTraceSource.WriteInformation(e, "format", "arguments");
-
- Assert.AreEqual(e, (CompositionTraceId)context.LastTraceEvent.Id);
- }
- }
- }
-
- [TestMethod]
- public void WriteWarning_ValueAsTraceId_ShouldWriteIdToTraceListener()
- {
- using (var context = new TraceContext(SourceLevels.Warning))
- {
- var expectations = Expectations.GetEnumValues<CompositionTraceId>();
- foreach (var e in expectations)
- {
- CompositionTraceSource.WriteWarning(e, "format", "arguments");
-
- Assert.AreEqual(e, (CompositionTraceId)context.LastTraceEvent.Id);
- }
- }
- }
-
- [TestMethod]
- public void WriteError_ValueAsTraceId_ShouldWriteIdToTraceListener()
- {
- using (var context = new TraceContext(SourceLevels.Error))
- {
- var expectations = Expectations.GetEnumValues<CompositionTraceId>();
- foreach (var e in expectations)
- {
- CompositionTraceSource.WriteError(e, "format", "arguments");
-
- Assert.AreEqual(e, (CompositionTraceId)context.LastTraceEvent.Id);
- }
- }
- }
-
- [TestMethod]
- public void WriteInformation_ValueAsFormat_ShouldWriteFormatToTraceListener()
- {
- using (var context = new TraceContext(SourceLevels.Information))
- {
- var expectations = Expectations.GetExceptionMessages();
- foreach (var e in expectations)
- {
- CompositionTraceSource.WriteInformation(0, e, "arguments");
-
- Assert.AreEqual(e, context.LastTraceEvent.Format);
- }
- }
- }
-
- [TestMethod]
- public void WriteWarning_ValueAsFormat_ShouldWriteFormatToTraceListener()
- {
- using (var context = new TraceContext(SourceLevels.Warning))
- {
- var expectations = Expectations.GetExceptionMessages();
- foreach (var e in expectations)
- {
- CompositionTraceSource.WriteWarning(0, e, "arguments");
-
- Assert.AreEqual(e, context.LastTraceEvent.Format);
- }
- }
- }
-
- [TestMethod]
- public void WriteError_ValueAsFormat_ShouldWriteFormatToTraceListener()
- {
- using (var context = new TraceContext(SourceLevels.Error))
- {
- var expectations = Expectations.GetExceptionMessages();
- foreach (var e in expectations)
- {
- CompositionTraceSource.WriteError(0, e, "arguments");
-
- Assert.AreEqual(e, context.LastTraceEvent.Format);
- }
- }
- }
-
- [TestMethod]
- public void WriteInformation_ValueAsArgs_ShouldWriteArgsToTraceListener()
- {
- using (var context = new TraceContext(SourceLevels.Information))
- {
- var expectations = Expectations.GetObjectArraysWithNull();
- foreach (var e in expectations)
- {
- CompositionTraceSource.WriteInformation(0, "format", e);
-
- Assert.AreSame(e, context.LastTraceEvent.Args);
- }
- }
- }
-
- [TestMethod]
- public void WriteWarning_ValueAsArgs_ShouldWriteArgsToTraceListener()
- {
- using (var context = new TraceContext(SourceLevels.Warning))
- {
- var expectations = Expectations.GetObjectArraysWithNull();
- foreach (var e in expectations)
- {
- CompositionTraceSource.WriteWarning(0, "format", e);
-
- Assert.AreSame(e, context.LastTraceEvent.Args);
- }
- }
- }
-
- [TestMethod]
- public void WriteError_ValueAsArgs_ShouldWriteArgsToTraceListener()
- {
- using (var context = new TraceContext(SourceLevels.Error))
- {
- var expectations = Expectations.GetObjectArraysWithNull();
- foreach (var e in expectations)
- {
- CompositionTraceSource.WriteError(0, "format", e);
-
- Assert.AreSame(e, context.LastTraceEvent.Args);
- }
- }
- }
-
- private static IEnumerable<SourceLevels> GetSourceLevelsLessThan(SourceLevels level)
- {
- return GetOnSourceLevels(level, false);
- }
-
- private static IEnumerable<SourceLevels> GetSourceLevelsGreaterThanOrEqualTo(SourceLevels level)
- {
- return GetOnSourceLevels(level, true);
- }
-
- private static IEnumerable<SourceLevels> GetOnSourceLevels(SourceLevels sourceLevel, bool on)
- {
- // SourceSwitch determines if a particular level gets traced based on whether its bit is
- // set in the current level. For example, if the current level was Warning (0000 0111),
- // then Warning (0000 0111), Error (0000 0011), and Critical (0000 0001) all get traced.
-
- var levels = TestServices.GetEnumValues<SourceLevels>();
-
- foreach (var level in levels)
- {
- if (level == 0)
- continue;
-
- if (((level & sourceLevel) == sourceLevel) == on)
- {
- yield return level;
- }
- }
-
- if (!on)
- {
- yield return SourceLevels.Off;
- }
- }
-
- private static void ThrowsInternalError(Action action)
- {
- try
- {
- action();
- Assert.Fail();
- }
- catch (Exception ex)
- {
- Type exceptionType = ex.GetType();
-
- // The exception should not be a
- // publicily catchable exception
- Assert.IsFalse(exceptionType.IsVisible);
- }
- }
-#endif
-
-#if SILVERLIGHT
- [TestMethod]
- public void CanWriteInformation_ShouldReturnFalse()
- {
- Assert.IsFalse(CompositionTraceSource.CanWriteInformation);
- }
-
- [TestMethod]
- public void CanWriteWarning_ShouldReturnDebuggerLogging()
- {
- Assert.AreEqual(CompositionTraceSource.CanWriteWarning, Debugger.IsLogging());
- }
-
- [TestMethod]
- public void CanWriteError_ShouldReturnDebuggerLogging()
- {
- Assert.AreEqual(CompositionTraceSource.CanWriteError, Debugger.IsLogging());
- }
-
- [TestMethod]
- public void CreateLogMessage_ContainsTraceEventType()
- {
- IEnumerable<SilverlightTraceWriter.TraceEventType> eventTypes = Expectations.GetEnumValues<SilverlightTraceWriter.TraceEventType>();
-
- foreach(var eventType in eventTypes)
- {
- string message = SilverlightTraceWriter.CreateLogMessage(eventType, CompositionTraceId.Discovery_AssemblyLoadFailed, "Format");
- Assert.IsTrue(message.Contains(eventType.ToString()), "Should contain enum string of EventType");
- }
- }
-
- [TestMethod]
- public void CreateLogMessage_ContainsTraceIdAsInt()
- {
- IEnumerable<CompositionTraceId> traceIds = Expectations.GetEnumValues<CompositionTraceId>();
-
- foreach(var traceId in traceIds)
- {
- string message = SilverlightTraceWriter.CreateLogMessage(SilverlightTraceWriter.TraceEventType.Information, traceId, "Format");
- Assert.IsTrue(message.Contains(((int)traceId).ToString()), "Should contain int version of TraceId");
- }
- }
-
- [TestMethod]
- public void CreateLogMessage_FormatNull_ThrowsArugmentNull()
- {
- ExceptionAssert.ThrowsArgumentNull("format", () =>
- SilverlightTraceWriter.CreateLogMessage(SilverlightTraceWriter.TraceEventType.Information, CompositionTraceId.Discovery_AssemblyLoadFailed, null));
- }
-
- [TestMethod]
- public void CreateLogMessage_ArgumentsNull_ShouldCreateValidString()
- {
- string message = SilverlightTraceWriter.CreateLogMessage(SilverlightTraceWriter.TraceEventType.Information, CompositionTraceId.Discovery_AssemblyLoadFailed, "Format", null);
-
- Assert.IsFalse(string.IsNullOrEmpty(message));
- }
-
- [TestMethod]
- public void CreateLogMessage_ArgumentsPassed_ShouldCreateValidString()
- {
- string message = SilverlightTraceWriter.CreateLogMessage(SilverlightTraceWriter.TraceEventType.Information, CompositionTraceId.Discovery_AssemblyLoadFailed, "{0}", 9999);
-
- Assert.IsTrue(message.Contains("9999"));
- }
-#endif
-
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/DynamicMetadata.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/DynamicMetadata.cs deleted file mode 100644 index 14272bce8e7..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/DynamicMetadata.cs +++ /dev/null @@ -1,335 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.ComponentModel.Composition;
-using System.Linq;
-using System.Reflection;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Hosting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class DynamicMetadata
- {
- [TestMethod]
- public void SimpleAttachment()
- {
- MetadataStore.Container = new CompositionContainer();
- DynamicMetadataTestClass val = DynamicMetadataTestClass.Get("42");
-
- var notYetAttached = TypeDescriptor.GetConverter(val);
- Assert.IsFalse(notYetAttached.CanConvertFrom(typeof(string)), "The default type converter for DynamicMetadataTestClass shouldn't support round tripping");
-
- MetadataStore.AddAttribute(
- typeof(DynamicMetadataTestClass),
- ( type, attributes) =>
- Enumerable.Concat(
- attributes,
- new Attribute[] { new TypeConverterAttribute(typeof(DynamicMetadataTestClassConverter)) }
- )
- );
- var attached = TypeDescriptor.GetConverter(val);
- Assert.IsTrue(attached.CanConvertFrom(typeof(string)), "The new type converter for DynamicMetadataTestClass should support round tripping");
- }
-
- [TestMethod]
- public void LocalContainer()
- {
- var container1 = new CompositionContainer();
- TypeDescriptorServices dat = new TypeDescriptorServices();
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(dat);
- container1.Compose(batch);
- MetadataStore.AddAttribute(
- typeof(DynamicMetadataTestClass),
- ( type, attributes) =>
- Enumerable.Concat(
- attributes,
- new Attribute[] { new TypeConverterAttribute(typeof(DynamicMetadataTestClassConverter)) }
- ),
- container1
- );
- DynamicMetadataTestClass val = DynamicMetadataTestClass.Get("42");
-
- var notYetAttached = TypeDescriptor.GetConverter(val.GetType());
- Assert.IsFalse(notYetAttached.CanConvertFrom(typeof(string)), "The default type converter for DynamicMetadataTestClass shouldn't support round tripping");
-
- var attached = dat.GetConverter(val.GetType());
- Assert.IsTrue(attached.CanConvertFrom(typeof(string)), "The new type converter for DynamicMetadataTestClass should support round tripping");
- }
-
- [TestMethod]
- public void DualContainers()
- {
- var container1 = new CompositionContainer();
- TypeDescriptorServices dat1 = new TypeDescriptorServices();
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(dat1);
- container1.Compose(batch);
- MetadataStore.AddAttribute(
- typeof(DynamicMetadataTestClass),
- ( type, attributes) =>
- Enumerable.Concat(
- attributes,
- new Attribute[] { new TypeConverterAttribute(typeof(DynamicMetadataTestClassConverter)) }
- ),
- container1
- );
-
-
- var container2 = new CompositionContainer();
- CompositionBatch batch2 = new CompositionBatch();
- TypeDescriptorServices dat2 = new TypeDescriptorServices();
- batch2.AddPart(dat2);
- container2.Compose(batch2);
-
- DynamicMetadataTestClass val = DynamicMetadataTestClass.Get("42");
-
- var attached1 = dat1.GetConverter(val.GetType());
- Assert.IsTrue(attached1.CanConvertFrom(typeof(string)), "The new type converter for DynamicMetadataTestClass should support round tripping");
-
- var attached2 = dat2.GetConverter(val.GetType());
- Assert.IsFalse(attached2.CanConvertFrom(typeof(string)), "The default type converter for DynamicMetadataTestClass shouldn't support round tripping");
- }
-
- [TestCleanup]
- public void ResetContainer()
- {
- MetadataStore.Container = null;
- }
- }
-
-
- [Export]
- public class TypeDescriptorServices
- {
- Dictionary<Type, TypeDescriptionProvider> providers = new Dictionary<Type, TypeDescriptionProvider>();
-
- internal Dictionary<Type, TypeDescriptionProvider> Providers
- {
- get { return providers; }
- set { providers = value; }
- }
-
- public ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance)
- {
- if (Providers.ContainsKey(objectType))
- {
- return Providers[objectType].GetTypeDescriptor(objectType);
- }
- else
- {
- return null;
- }
- }
- public void AddProvider(TypeDescriptionProvider provider, Type type)
- {
- Providers[type] = provider;
- }
- public TypeConverter GetConverter(Type type)
- {
- var ictd = GetTypeDescriptor(type, null);
- if (ictd != null)
- {
- return ictd.GetConverter();
- }
- else
- {
- return TypeDescriptor.GetConverter(type);
- }
- }
- }
-
- public static class MetadataStore
- {
- public static CompositionContainer Container { get; set; }
- static Dictionary<Type, TypeDescriptionProvider> registeredRedirect = new Dictionary<Type, TypeDescriptionProvider>();
-
- public static void AddAttribute(Type target, Func<MemberInfo, IEnumerable<Attribute>, IEnumerable<Attribute>> provider)
- {
- AddAttribute(target, provider, MetadataStore.Container);
- }
- public static void AddAttribute(Type target, Func<MemberInfo, IEnumerable<Attribute>, IEnumerable<Attribute>> provider, CompositionContainer container)
- {
- ContainerUnawareProviderRedirect.GetRedirect(container)[target] = new MetadataStoreProvider(target, provider);
- RegisterTypeDescriptorInterop(target);
- }
- private static void RegisterTypeDescriptorInterop(Type target)
- {
- if (!registeredRedirect.ContainsKey(target))
- {
- var r = new ContainerUnawareProviderRedirect(target);
- TypeDescriptor.AddProvider(r, target);
- registeredRedirect[target] = r;
- }
- else
- {
- // force a uncache of the information from TypeDescriptor
- //
- TypeDescriptor.RemoveProvider(registeredRedirect[target], target);
- TypeDescriptor.AddProvider(registeredRedirect[target], target);
- }
- }
- public static TypeDescriptorServices GetTypeDescriptorServicesForContainer(CompositionContainer container)
- {
- if (container != null)
- {
- var result = container.GetExportedValueOrDefault<TypeDescriptorServices>();
- if (result == null)
- {
- var v = new TypeDescriptorServices();
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(v);
- container.Compose(batch);
- return v;
- }
-
- return result;
- }
- return null;
- }
-
- private class ContainerUnawareProviderRedirect : TypeDescriptionProvider
- {
- public ContainerUnawareProviderRedirect(Type forType)
- : base(TypeDescriptor.GetProvider(forType))
- {
- }
- public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance)
- {
- var datd = GetTypeDescriptorServicesForContainer(MetadataStore.Container);
- if (datd == null || !datd.Providers.ContainsKey(objectType))
- {
- return base.GetTypeDescriptor(objectType, instance);
- }
- else
- {
- return datd.GetTypeDescriptor(objectType, instance);
- }
- }
-
- internal static Dictionary<Type, TypeDescriptionProvider> GetRedirect(CompositionContainer container)
- {
- TypeDescriptorServices v = GetTypeDescriptorServicesForContainer(container);
- return v != null ? v.Providers : null;
- }
- }
-
- private class MetadataStoreProvider : TypeDescriptionProvider
- {
- Func<MemberInfo, IEnumerable<Attribute>, IEnumerable<Attribute>> provider;
- public MetadataStoreProvider(Type forType, Func<MemberInfo, IEnumerable<Attribute>, IEnumerable<Attribute>> provider)
- : base(TypeDescriptor.GetProvider(forType))
- {
- this.provider = provider;
- }
- public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance)
- {
- ICustomTypeDescriptor descriptor = base.GetTypeDescriptor(objectType, instance);
- descriptor = new MetadataStoreTypeDescriptor(objectType, descriptor, provider);
- return descriptor;
- }
-
- }
-
- private class MetadataStoreTypeDescriptor : CustomTypeDescriptor
- {
- Type targetType;
- Func<MemberInfo, IEnumerable<Attribute>, IEnumerable<Attribute>> provider;
- public MetadataStoreTypeDescriptor(Type targetType, ICustomTypeDescriptor parent, Func<MemberInfo, IEnumerable<Attribute>, IEnumerable<Attribute>> provider)
- : base(parent)
- {
- this.targetType = targetType;
- this.provider = provider;
- }
- public override TypeConverter GetConverter()
- {
- TypeConverterAttribute attribute = (TypeConverterAttribute)GetAttributes()[typeof(TypeConverterAttribute)];
- if (attribute != null)
- {
- Type c = this.GetTypeFromName(attribute.ConverterTypeName);
- if ((c != null) && typeof(TypeConverter).IsAssignableFrom(c))
- {
- return (TypeConverter)Activator.CreateInstance(c);
- }
- }
- return base.GetConverter();
- }
- private Type GetTypeFromName(string typeName)
- {
- if ((typeName == null) || (typeName.Length == 0))
- {
- return null;
- }
- int length = typeName.IndexOf(',');
- Type type = null;
- if (length == -1)
- {
- type = targetType.Assembly.GetType(typeName);
- }
- if (type == null)
- {
- type = Type.GetType(typeName);
- }
- if ((type == null) && (length != -1))
- {
- type = Type.GetType(typeName.Substring(0, length));
- }
- return type;
- }
- public override AttributeCollection GetAttributes()
- {
- var n = new List<Attribute>();
- foreach (var attr in provider(targetType, base.GetAttributes().OfType<Attribute>()))
- {
- n.Add(attr);
- }
- return new AttributeCollection(n.ToArray());
- }
- }
- }
-
- public class DynamicMetadataTestClass
- {
- int i;
-
- private DynamicMetadataTestClass(int i)
- {
- this.i = i;
- }
-
- public override string ToString()
- {
- return i.ToString();
- }
-
- public static DynamicMetadataTestClass Get(string s)
- {
- return new DynamicMetadataTestClass(Int32.Parse(s));
- }
- }
-
- public class DynamicMetadataTestClassConverter : TypeConverter
- {
- public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
- {
- return sourceType == typeof(string);
- }
- public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
- {
- return ((DynamicMetadataTestClass)value).ToString();
- }
- public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
- {
- return DynamicMetadataTestClass.Get((string)value);
- }
- public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
- {
- return destinationType == typeof(string);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Expectations.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Expectations.cs deleted file mode 100644 index 7dae8376ecf..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Expectations.cs +++ /dev/null @@ -1,336 +0,0 @@ -//------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//------------------------------------------------------------
-using System;
-using System.Linq;
-using System.UnitTesting;
-using System.Collections.Generic;
-using Microsoft.Internal.Collections;
-using System.Reflection;
-using System.Globalization;
-using System.Collections.ObjectModel;
-using System.Collections;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.AttributedModel;
-using System.ComponentModel.Composition.ReflectionModel;
-using System.Reflection.Emit;
-
-namespace System.ComponentModel.Composition
-{
- internal static class Expectations
- {
- public static IEnumerable<CultureInfo> GetCulturesForFormatting()
- {
- yield return new CultureInfo("en-US"); // English (US)
- yield return new CultureInfo("en-AU"); // English (Australian)
- yield return new CultureInfo("en-CA"); // English (Canada)
- yield return new CultureInfo("en-NZ"); // English (Great Britain)
- yield return new CultureInfo("en-JM"); // English (Jamaica)
- yield return new CultureInfo("pt-BR"); // Portuguese (Brazil)
- yield return new CultureInfo("es-AR"); // Spanish (Argentina)
- yield return new CultureInfo("ja-JP"); // Japanese (Japan)
- yield return new CultureInfo("fr-FR"); // French (France)
- yield return new CultureInfo("it-IT"); // Italian (Italy)
- yield return new CultureInfo("de-DE"); // German (Germany)
- yield return new CultureInfo("es-ES"); // Spanish (Spain)
- yield return new CultureInfo("ko-KR"); // Korean (Korea)
- yield return new CultureInfo("zh-TW"); // Chinese (Taiwan)
- yield return new CultureInfo("zh-CN"); // Chinese (People's Republic of China)
- }
-
- public static IEnumerable<Assembly> GetAssemblies()
- {
- yield return Assembly.GetExecutingAssembly();
- yield return Assembly.Load("mscorlib");
- }
-
- public static IEnumerable<string> GetDisplayNames()
- {
- yield return "";
- yield return " ";
- yield return " ";
- yield return "DisplayName";
- yield return "displayname";
- yield return "This is the display name.";
- }
-
- public static IEnumerable<ICompositionElement> GetCompositionElements()
- {
- yield return ElementFactory.CreateChain(1);
- yield return ElementFactory.CreateChain(2);
- yield return ElementFactory.CreateChain(3);
- yield return ElementFactory.CreateChain(5);
- yield return ElementFactory.CreateChain(10);
- }
-
- public static IEnumerable<ICompositionElement> GetCompositionElementsWithNull()
- {
- foreach (var element in GetCompositionElements())
- {
- yield return element;
- }
-
- yield return null;
- }
-
- public static IEnumerable<ComposablePartCatalog> GetCatalogs()
- {
- yield return CatalogFactory.Create();
- yield return CatalogFactory.CreateDefaultAttributed();
- }
-
- public static IEnumerable<IEnumerable<CompositionError>> GetCompositionErrors()
- {
- foreach (var value in GetEmptyCollections<CompositionError>())
- {
- yield return value;
- }
-
- yield return new CompositionError[] { new CompositionError("") };
- yield return new CompositionError[] { new CompositionError(""), new CompositionError("Description") };
- yield return new CompositionError[] { new CompositionError(""), new CompositionError("Description"), ErrorFactory.Create(CompositionErrorId.InvalidExportMetadata, "Description", (Exception)null), ErrorFactory.Create(CompositionErrorId.Unknown, "Description", new Exception()) };
- }
-
- public static IEnumerable<string> GetContractNames()
- {
- yield return " ";
- yield return " ";
- yield return "ContractName";
- yield return "contractName";
- yield return "{ContractName}";
- yield return "{ContractName}Name";
- yield return "System.Windows.Forms.Control";
- yield return "{System.Windows.Forms}Control";
- yield return "{9}Control";
- }
-
- public static IEnumerable<string> GetContractNamesWithEmpty()
- {
- foreach (string contractName in GetContractNames())
- {
- yield return contractName;
- }
-
- yield return string.Empty;
- }
-
- public static IEnumerable<object> GetObjectsReferenceTypes()
- {
- yield return "Value";
- yield return new Collection<string>();
- yield return new IEnumerable[0];
- }
-
- public static IEnumerable<ValueType> GetObjectsValueTypes()
- {
- yield return 10;
- yield return 10.0;
- yield return DayOfWeek.Wednesday;
- }
-
- public static IEnumerable<string> GetMetadataNames()
- {
- return GetContractNamesWithEmpty();
- }
-
- public static IEnumerable<object> GetMetadataValues()
- {
- yield return null;
- yield return string.Empty;
- yield return "";
- yield return " ";
- yield return " ";
- yield return (Int32)1;
- yield return (Byte)1;
- yield return (Single)1.1;
- yield return (Double)1.1;
- yield return DayOfWeek.Wednesday;
- }
-
- public static IEnumerable<Dictionary<string, Type>> GetRequiredMetadata()
- {
- yield return new Dictionary<string, Type> { { "", typeof(object) } };
- yield return new Dictionary<string, Type> { { " ", typeof(object) } };
- yield return new Dictionary<string, Type> { { " ", typeof(object) } };
- yield return new Dictionary<string, Type> { { " ", typeof(object) } };
- yield return new Dictionary<string, Type> { { "A", typeof(object) } };
- yield return new Dictionary<string, Type> { { "A", typeof(object) }, { "B", typeof(object) } };
- yield return new Dictionary<string, Type> { { "A", typeof(object) }, { "B", typeof(object) }, { "C", typeof(object) } };
- yield return new Dictionary<string, Type> { { "a", typeof(object) } };
- yield return new Dictionary<string, Type> { { "a", typeof(object) }, { "b", typeof(object) } };
- yield return new Dictionary<string, Type> { { "a", typeof(object) }, { "b", typeof(object) }, { "c", typeof(object) } };
- yield return new Dictionary<string, Type> { { "Metadata1", typeof(object) }, { "Metadata2", typeof(object) }, { "Metadata3", typeof(object) } };
- }
-
- public static IEnumerable<Dictionary<string, Type>> GetRequiredMetadataWithEmpty()
- {
- foreach (var requiredMetadata in GetRequiredMetadata())
- {
- yield return requiredMetadata;
- }
-
- yield return new Dictionary<string, Type>();
- }
-
- public static IEnumerable<IDictionary<string, object>> GetMetadata()
- {
- yield return new ReadOnlyDictionary<string, object>(null);
- yield return new Dictionary<string, object>();
-
-#if !SILVERLIGHT
-
- yield return new SortedDictionary<string, object>();
- yield return new SortedList<string, object>();
-
-#endif
- var metadata = new Dictionary<string, object>();
- metadata.Add("One", "Value");
- metadata.Add("Two", true);
- metadata.Add("Three", 10);
- metadata.Add("Four", 1.0);
- metadata.Add("Five", null);
-
- yield return metadata;
- }
-
- public static IEnumerable<string> GetExceptionMessages()
- {
- yield return "";
- yield return " ";
- yield return " ";
- yield return "message";
- yield return "This is an error message.";
- yield return "Line One." + Environment.NewLine + "Line Two.";
- }
-
- public static IEnumerable<Exception> GetInnerExceptions()
- {
- yield return new Exception();
- yield return new ArgumentException();
- yield return new SystemException();
-#if CLR40
- yield return new CompositionException();
- yield return new ImportCardinalityMismatchException();
-#endif
- }
-
- public static IEnumerable<Exception> GetInnerExceptionsWithNull()
- {
- foreach (var exception in GetInnerExceptions())
- {
- yield return exception;
- }
-
- yield return null;
- }
-
- public static IEnumerable<bool> GetBooleans()
- {
- yield return false;
- yield return true;
- yield return false;
- yield return true;
- }
-
- public static IEnumerable<ReflectionComposablePartDefinition> GetAttributedDefinitions()
- {
- foreach (var type in GetAttributedTypes())
- {
- yield return PartDefinitionFactory.CreateAttributed(type);
- }
- }
-
- public static IEnumerable<Type> GetTypes()
- {
- yield return typeof(void);
- yield return typeof(Type);
- yield return typeof(double);
- yield return typeof(string);
- yield return typeof(int);
- yield return typeof(CompositionServices);
- yield return typeof(ICompositionService);
- }
-
- public static IEnumerable<Type> GetAttributedTypes()
- {
- foreach (Type type in typeof(Expectations).Assembly.GetTypes())
- {
- var definition = AttributedModelDiscovery.CreatePartDefinitionIfDiscoverable(type, (ICompositionElement)null);
- if (definition != null)
- {
- yield return type;
- }
-
- }
- }
-
- public static IEnumerable<MemberInfo> GetMembers()
- {
- yield return typeof(String).GetSingleMember("Length");
- yield return typeof(Int32).GetSingleMember("MaxValue");
- }
-
- public static IEnumerable<TEnum> GetEnumValues<TEnum>() where TEnum : struct
- {
- var values = TestServices.GetEnumValues<TEnum>();
-
- foreach (TEnum value in values)
- {
- yield return value;
- }
- }
-
- public static IEnumerable<TEnum> GetInvalidEnumValues<TEnum>() where TEnum : struct
- {
- var bounds = GetEnumBounds<TEnum>();
-
- yield return AddEnum(bounds.Item1, -3);
- yield return AddEnum(bounds.Item1, -2);
- yield return AddEnum(bounds.Item1, -1);
- yield return AddEnum(bounds.Item2, 1);
- yield return AddEnum(bounds.Item2, 2);
- yield return AddEnum(bounds.Item2, 3);
- yield return (TEnum)(object)(int.MinValue + 1);
- yield return (TEnum)(object)int.MinValue;
- yield return (TEnum)(object)int.MaxValue;
- yield return (TEnum)(object)(int.MaxValue - 1);
- }
-
- public static IEnumerable<object[]> GetObjectArraysWithNull()
- {
- yield return null;
- yield return new object[0];
- yield return new object[] { null };
- yield return new string[] { null };
- yield return new object[] { 1, "2", 3.0 };
- yield return new string[] { "1" };
- yield return new string[] { "1", "2" };
- yield return new string[] { "1", "2", "3" };
- }
-
- private static TEnum AddEnum<TEnum>(TEnum left, int right) where TEnum : struct
- {
- int intRight = (int)(object)left;
-
- return (TEnum)(object)(intRight + right);
- }
-
- private static Tuple<TEnum, TEnum> GetEnumBounds<TEnum>() where TEnum : struct
- {
- var values = TestServices.GetEnumValues<TEnum>();
-
- return new Tuple<TEnum, TEnum>(values.First(), values.Last());
- }
-
- private static IEnumerable<IEnumerable<T>> GetEmptyCollections<T>()
- {
- yield return new T[0];
- yield return Enumerable.Empty<T>();
- yield return new List<T>();
- yield return new Collection<T>();
- yield return new Dictionary<T, object>().Keys;
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ExportAttributeTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ExportAttributeTests.cs deleted file mode 100644 index 922fd66ef88..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ExportAttributeTests.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.UnitTesting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class ExportAttributeTests
- {
- [TestMethod]
- public void Constructor1_ShouldSetContractNamePropertyToEmptyString()
- {
- var attribute = new ExportAttribute();
-
- Assert.IsNull(attribute.ContractName);
- Assert.IsNull(attribute.ContractType);
- }
-
- [TestMethod]
- public void Constructor2_NullAsContractNameArgument_ShouldSetContractNamePropertyToEmptyString()
- {
- var attribute = new ExportAttribute((string)null);
-
- Assert.IsNull(attribute.ContractName);
- Assert.IsNull(attribute.ContractType);
- }
-
- [TestMethod]
- public void Constructor3_NullAsContractTypeArgument_ShouldSetContractNamePropertyToEmptyString()
- {
- var attribute = new ExportAttribute((Type)null);
-
- Assert.IsNull(attribute.ContractName);
- Assert.IsNull(attribute.ContractType);
- }
-
- [TestMethod]
- public void Constructor4_NullAsContractTypeArgument_ShouldSetContractNamePropertyToEmptyString()
- {
- var attribute = new ExportAttribute((string)null, (Type)null);
-
- Assert.IsNull(attribute.ContractName);
- Assert.IsNull(attribute.ContractType);
- }
-
- [TestMethod]
- public void Constructor2_ValueAsContractNameArgument_ShouldSetContractNameProperty()
- {
- var expectations = Expectations.GetContractNamesWithEmpty();
-
- foreach (var e in expectations)
- {
- var attribute = new ExportAttribute(e);
-
- Assert.AreEqual(e, attribute.ContractName);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ExportCollectionTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ExportCollectionTests.cs deleted file mode 100644 index 40d8fbcdfea..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ExportCollectionTests.cs +++ /dev/null @@ -1,208 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Linq;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.UnitTesting;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class ExportCollectionTests
- {
- public interface ICustomMetadata
- {
- bool PropertyName { get; }
- }
-
- public class Importer
- {
- [ImportMany("Value")]
- public Collection<Lazy<object>> CollectionPlain { get; set; }
-
- [ImportMany("Value")]
- public Collection<Lazy<object, IDictionary<string, object>>> CollectionPlainRawMetadata { get; set; }
-
- [ImportMany("EmptyValue")]
- public Collection<Lazy<object>> CollectionPlainEmpty { get; set; }
-
- [ImportMany("EmptyValue")]
- public Collection<Lazy<object, IDictionary<string, object>>> CollectionPlainEmptyRawMetadata { get; set; }
-
- [ImportMany("Value")]
- public Collection<Lazy<int>> CollectionTyped { get; set; }
-
- [ImportMany("Value")]
- public Collection<Lazy<int, IDictionary<string, object>>> CollectionTypedRawMetadata { get; set; }
-
- [ImportMany("EmptyValue")]
- public Collection<Lazy<int>> CollectionTypedEmpty { get; set; }
-
- [ImportMany("Value")]
- public Collection<Lazy<int, ICustomMetadata>> CollectionTypedMetadata { get; set; }
-
- [ImportMany("EmptyValue")]
- public Collection<Lazy<int, ICustomMetadata>> CollectionTypedMetadataEmpty { get; set; }
-
- [ImportMany("Value")]
- public IEnumerable<int> ReadWriteEnumerable { get; set; }
-
- [ImportMany("EmptyValue")]
- public IEnumerable<int> ReadWriteEnumerableEmpty { get; set; }
-
- [ImportMany("Value")]
- public IEnumerable<Lazy<object>> MetadataUntypedEnumerable { get; set; }
-
- [ImportMany("Value")]
- public IEnumerable<Lazy<object, IDictionary<string, object>>> MetadataUntypedEnumerableRawMetadata { get; set; }
-
- [ImportMany("EmptyValue")]
- public IEnumerable<Lazy<object>> MetadataUntypedEnumerableEmpty { get; set; }
-
- [ImportMany("EmptyValue")]
- public IEnumerable<Lazy<object, IDictionary<string, object>>> MetadataUntypedEnumerableEmptyRawMetadata { get; set; }
-
- [ImportMany("Value")]
- public IEnumerable<Lazy<int>> MetadataTypedEnumerable { get; set; }
-
- [ImportMany("Value")]
- public IEnumerable<Lazy<int, IDictionary<string, object>>> MetadataTypedEnumerableRawMetadata { get; set; }
-
- [ImportMany("EmptyValue")]
- public IEnumerable<Lazy<int>> MetadataTypedEnumerableEmpty { get; set; }
-
- [ImportMany("Value")]
- public IEnumerable<Lazy<int, ICustomMetadata>> MetadataFullyTypedEnumerable { get; set; }
-
- [ImportMany("EmptyValue")]
- public IEnumerable<Lazy<int, ICustomMetadata>> MetadataFullyTypedEnumerableEmpty { get; set; }
-
- public void VerifyImport(params int[] expectedValues)
- {
- object[] untypedExpectedValues = expectedValues.Cast<object>().ToArray();
-
- ExportsAssert.AreEqual(CollectionPlain, untypedExpectedValues);
- ExportsAssert.AreEqual(CollectionPlainRawMetadata, untypedExpectedValues);
- EnumerableAssert.IsTrueForAll(CollectionPlainRawMetadata, i => true.Equals(i.Metadata["PropertyName"]));
- EnumerableAssert.IsEmpty(CollectionPlainEmpty);
- EnumerableAssert.IsEmpty(CollectionPlainEmptyRawMetadata);
-
- // Add a new Export to this collection to ensure that it doesn't
- // modifiy the other collections because they should each have there
- // own collection instance
- CollectionPlain.Add(ExportFactory.Create<object>("Value"));
-
- ExportsAssert.AreEqual(CollectionTyped, expectedValues);
- ExportsAssert.AreEqual(CollectionTypedRawMetadata, expectedValues);
- EnumerableAssert.IsTrueForAll(CollectionTypedRawMetadata, i => true.Equals(i.Metadata["PropertyName"]));
- EnumerableAssert.IsEmpty(CollectionTypedEmpty);
-
- ExportsAssert.AreEqual(CollectionTypedMetadata, expectedValues);
-#if !SILVERLIGHT // Silverlight doesn't support strongly typed metadata
- EnumerableAssert.IsTrueForAll(CollectionTypedMetadata, i => true == i.Metadata.PropertyName);
-#endif //!SILVERLIGHT
- EnumerableAssert.IsEmpty(CollectionTypedMetadataEmpty);
-
- EnumerableAssert.AreEqual(ReadWriteEnumerable, expectedValues);
- EnumerableAssert.IsEmpty(ReadWriteEnumerableEmpty);
-
- ExportsAssert.AreEqual(MetadataUntypedEnumerable, untypedExpectedValues);
- ExportsAssert.AreEqual(MetadataUntypedEnumerableRawMetadata, untypedExpectedValues);
- EnumerableAssert.IsTrueForAll(MetadataUntypedEnumerableRawMetadata, i => true.Equals(i.Metadata["PropertyName"]));
- EnumerableAssert.IsEmpty(MetadataUntypedEnumerableEmpty);
- EnumerableAssert.IsEmpty(MetadataUntypedEnumerableEmptyRawMetadata);
-
- ExportsAssert.AreEqual(MetadataTypedEnumerable, expectedValues);
- ExportsAssert.AreEqual(MetadataTypedEnumerableRawMetadata, expectedValues);
- EnumerableAssert.IsTrueForAll(MetadataTypedEnumerableRawMetadata, i => true.Equals(i.Metadata["PropertyName"]));
- EnumerableAssert.IsEmpty(MetadataTypedEnumerableEmpty);
-
- ExportsAssert.AreEqual(MetadataFullyTypedEnumerable, expectedValues);
-#if !SILVERLIGHT // Silverlight doesn't support strongly typed metadata
- EnumerableAssert.IsTrueForAll(MetadataFullyTypedEnumerable, i => true == i.Metadata.PropertyName);
-#endif //!SILVERLIGHT
- EnumerableAssert.IsEmpty(MetadataFullyTypedEnumerableEmpty);
- }
- }
-
- public class ExporterDefault21
- {
- public ExporterDefault21() { Value = 21; }
- public ExporterDefault21(int v) { Value = v; }
-
- [Export("Value")]
- [ExportMetadata("PropertyName", true)]
- public int Value { get; set; }
- }
-
- public class ExporterDefault42
- {
- public ExporterDefault42() { Value = 42; }
- public ExporterDefault42(int v) { Value = v; }
-
- [Export("Value")]
- [ExportMetadata("PropertyName", true)]
- public int Value { get; set; }
- }
-
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void ImportCollectionsFromContainerOnly()
- {
- var container = ContainerFactory.Create();
- Importer importer = new Importer();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddParts(importer
- , new ExporterDefault21()
- , new ExporterDefault21(22)
- , new ExporterDefault42()
- , new ExporterDefault42(43));
-
- container.Compose(batch);
-
- importer.VerifyImport(21, 22, 42, 43);
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void ImportCollectionsFromCatalogOnly()
- {
- var cat = CatalogFactory.CreateDefaultAttributed();
- var container = new CompositionContainer(cat);
- Importer importer = new Importer();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddParts(importer);
- container.Compose(batch);
-
- importer.VerifyImport(21, 42);
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void ImportCollectionsFormContainerAndCatalog()
- {
- var cat = CatalogFactory.CreateDefaultAttributed();
- var container = new CompositionContainer(cat);
- Importer importer = new Importer();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddParts(importer
- , new ExporterDefault21(22)
- , new ExporterDefault42(43));
-
- container.Compose(batch);
-
- importer.VerifyImport(22, 43, 21, 42);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ExportDefinitionTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ExportDefinitionTests.cs deleted file mode 100644 index cb89ebf2945..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ExportDefinitionTests.cs +++ /dev/null @@ -1,186 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.UnitTesting;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class ExportDefinitionTests
- {
- [TestMethod]
- public void Constructor1_ShouldSetMetadataPropertyToEmptyDictionary()
- {
- var definition = new DerivedExportDefinition();
-
- EnumerableAssert.IsEmpty(definition.Metadata);
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetMetadataPropertyToReadOnlyDictionary()
- {
- var definition = new DerivedExportDefinition();
-
- ExceptionAssert.Throws<NotSupportedException>(() =>
- {
- definition.Metadata["Value"] = "Value";
- });
- }
-
- [TestMethod]
- public void Constructor2_NullAsContractNameArgument_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("contractName", () =>
- {
- new ExportDefinition((string)null, new Dictionary<string, object>());
- });
- }
-
- [TestMethod]
- public void Constructor2_EmptyStringAsContractNameArgument_ShouldThrowArgument()
- {
- ExceptionAssert.ThrowsArgument<ArgumentException>("contractName", () =>
- {
- new ExportDefinition(string.Empty, new Dictionary<string, object>());
- });
- }
-
- [TestMethod]
- public void Constructor2_ValueAsContractNameArgument_ShouldSetContractNameProperty()
- {
- var expectations = Expectations.GetContractNames();
-
- foreach (var e in expectations)
- {
- var definition = new ExportDefinition(e, new Dictionary<string, object>());
-
- Assert.AreEqual(e, definition.ContractName);
- }
- }
-
- [TestMethod]
- public void Constructor2_NullAsMetadataArgument_ShouldSetMetadataPropertyToEmptyDictionary()
- {
- var definition = new ExportDefinition("Contract", (IDictionary<string, object>)null); ;
-
- EnumerableAssert.IsEmpty(definition.Metadata);
- }
-
- [TestMethod]
- public void Constructor2_NullAsMetadataArgument_ShouldSetMetadataPropertyToReadOnlyDictionary()
- {
- var definition = new ExportDefinition("Contract", (IDictionary<string, object>)null);
-
- ExceptionAssert.Throws<NotSupportedException>(() =>
- {
- definition.Metadata["Value"] = "Value";
- });
- }
-
- [TestMethod]
- public void Constructor2_WritableDictionaryAsMetadataArgument_ShouldSetMetadataPropertyToReadOnlyDictionary()
- {
- var definition = new ExportDefinition("Contract", new Dictionary<string, object>());
-
- ExceptionAssert.Throws<NotSupportedException>(() =>
- {
- definition.Metadata["Value"] = "Value";
- });
- }
-
- [TestMethod]
- public void Constructor2_DictionaryAsMetadataArgument_ShouldSetMetadataProperty()
- {
- var expectations = Expectations.GetMetadata();
-
- foreach (var e in expectations)
- {
- var definition = new ExportDefinition("Contract", e);
-
- EnumerableAssert.AreEqual(e, definition.Metadata);
- }
- }
-
- [TestMethod]
- public void ContractName_WhenNotOverridden_ShouldThrowNotImplemented()
- {
- var definition = new DerivedExportDefinition();
-
- ExceptionAssert.Throws<NotImplementedException>(() =>
- {
- var contractName = definition.ContractName;
- });
- }
-
- [TestMethod]
- public void ToString_WhenContractNameNotOverridden_ShouldThrowNotImplemented()
- {
- var definition = new DerivedExportDefinition();
-
- ExceptionAssert.Throws<NotImplementedException>(() =>
- {
- definition.ToString();
- });
- }
-
- [TestMethod]
- public void ToString_ShouldReturnContractNameProperty()
- {
- var expectations = Expectations.GetContractNames();
-
- foreach (var e in expectations)
- {
- var definition = new ExportDefinition(e, new Dictionary<string, object>());
-
- Assert.AreEqual(e, definition.ToString());
- }
- }
-
- [TestMethod]
- public void ToString_ShouldReturnOverriddenContractNameProperty()
- {
- var expectations = Expectations.GetContractNamesWithEmpty();
-
- foreach (var e in expectations)
- {
- var definition = new DerivedExportDefinition(() => e);
-
- Assert.AreEqual(e, definition.ToString());
- }
- }
-
- private class DerivedExportDefinition : ExportDefinition
- {
- private readonly Func<string> _contractNameGetter;
-
- public DerivedExportDefinition()
- {
- }
-
- public DerivedExportDefinition(Func<string> contractNameGetter)
- {
- _contractNameGetter = contractNameGetter;
- }
-
- public override string ContractName
- {
- get
- {
- if (_contractNameGetter != null)
- {
- return _contractNameGetter();
- }
-
- return base.ContractName;
- }
- }
- }
- }
-}
-
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ExportMetadataAttributeTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ExportMetadataAttributeTests.cs deleted file mode 100644 index 96ff3292d8f..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ExportMetadataAttributeTests.cs +++ /dev/null @@ -1,70 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.UnitTesting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class ExportMetadataAttributeTests
- {
- [TestMethod]
- public void Constructor_NullAsNameArgument_ShouldSetNamePropertyToEmptyString()
- {
- var attribute = new ExportMetadataAttribute((string)null, "Value");
-
- Assert.AreEqual(string.Empty, attribute.Name);
- }
-
- [TestMethod]
- public void Constructor_ShouldSetIsMultiplePropertyToFalse()
- {
- var attribute = new ExportMetadataAttribute("Name", "Value");
-
- Assert.IsFalse(attribute.IsMultiple);
- }
-
- [TestMethod]
- public void Constructor_ValueAsNameArgument_ShouldSetNameProperty()
- {
- var expectations = Expectations.GetMetadataNames();
-
- foreach (var e in expectations)
- {
- var attribute = new ExportMetadataAttribute(e, "Value");
-
- Assert.AreEqual(e, attribute.Name);
- }
- }
-
- [TestMethod]
- public void Constructor_ValueAsValueArgument_ShouldSetValueProperty()
- {
- var expectations = Expectations.GetMetadataValues();
-
- foreach (var e in expectations)
- {
- var attribute = new ExportMetadataAttribute("Name", e);
-
- Assert.AreEqual(e, attribute.Value);
- }
- }
-
- [TestMethod]
- public void IsMultiple_ValueAsValueArgument_ShouldSetPropert()
- {
- var expectations = Expectations.GetBooleans();
-
- var attribute = new ExportMetadataAttribute("Name", "Value");
-
- foreach (var e in expectations)
- {
- attribute.IsMultiple = e;
- Assert.AreEqual(e, attribute.IsMultiple);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ExportProviderTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ExportProviderTests.cs deleted file mode 100644 index 56f03ec673c..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ExportProviderTests.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Factories;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class ExportProviderTests
- {
- [TestMethod]
- public void GetExports2_NullAsDefinitionArgument_ShouldThrowArgumentNull()
- {
- var provider = ExportProviderFactory.Create();
-
- ExceptionAssert.Throws<ArgumentNullException>(() =>
- {
- provider.GetExports((ImportDefinition)null);
- });
- }
-
- [TestMethod]
- public void TryGetExports_NullAsDefinitionArgument_ShouldThrowArgumentNull()
- {
- var provider = ExportProviderFactory.Create();
-
- ExceptionAssert.Throws<ArgumentNullException>(() =>
- {
- IEnumerable<Export> exports;
- provider.TryGetExports((ImportDefinition)null, null, out exports);
- });
- }
-
- [TestMethod]
- public void TryGetExports_NullAsDefinitionArgument_ShouldNotSetExportsArgument()
- {
- var provider = ExportProviderFactory.Create();
-
- IEnumerable<Export> exports = new Export[0];
- IEnumerable<Export> results = exports;
-
- ExceptionAssert.Throws<ArgumentNullException>(() =>
- {
- provider.TryGetExports((ImportDefinition)null, null, out results);
- });
-
- Assert.AreSame(exports, results);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ExportTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ExportTests.cs deleted file mode 100644 index 44f43b83310..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ExportTests.cs +++ /dev/null @@ -1,439 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Factories;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class ExportTests
- {
- [TestMethod]
- public void Constructor1_ShouldNotThrow()
- {
- new NoOverridesExport();
- }
-
- [TestMethod]
- public void Constructor2_NullAsExportedValueGetterArgument_ShouldThrowArgumentNull()
- {
- var definition = ExportDefinitionFactory.Create();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("exportedValueGetter", () =>
- {
- new Export(definition, (Func<object>)null);
- });
- }
-
- [TestMethod]
- public void Constructor3_NullAsExportedValueGetterArgument_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("exportedValueGetter", () =>
- {
- new Export("ContractName", (Func<object>)null);
- });
- }
-
- [TestMethod]
- public void Constructor4_NullAsExportedValueGetterArgument_ShouldThrowArgumentNull()
- {
- var metadata = new Dictionary<string, object>();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("exportedValueGetter", () =>
- {
- new Export("ContractName", metadata, (Func<object>)null);
- });
- }
-
- [TestMethod]
- public void Constructor2_NullAsDefinitionArgument_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("definition", () =>
- {
- new Export((ExportDefinition)null, () => null);
- });
- }
-
- [TestMethod]
- public void Constructor2_DefinitionAsDefinitionArgument_ShouldSetDefinitionProperty()
- {
- var definition = ExportDefinitionFactory.Create();
-
- var export = new Export(definition, () => null);
-
- Assert.AreSame(definition, export.Definition);
- }
-
- [TestMethod]
- public void Constructor3_NullAsContractNameArgument_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("contractName", () =>
- {
- new Export((string)null, () => null);
- });
- }
-
- [TestMethod]
- public void Constructor4_NullAsContractNameArgument_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("contractName", () =>
- {
- new Export((string)null, new Dictionary<string, object>(), () => null);
- });
- }
-
- [TestMethod]
- public void Constructor3_EmptyStringAsContractNameArgument_ShouldThrowArgument()
- {
- ExceptionAssert.ThrowsArgument<ArgumentException>("contractName", () =>
- {
- new Export(string.Empty, () => null);
- });
- }
-
- [TestMethod]
- public void Constructor4_EmptyStringAsContractNameArgument_ShouldThrowArgument()
- {
- ExceptionAssert.ThrowsArgument<ArgumentException>("contractName", () =>
- {
- new Export(string.Empty, new Dictionary<string, object>(), () => null);
- });
- }
-
- [TestMethod]
- public void Constructor3_ValueAsContractNameArgument_ShouldSetDefinitionContractNameProperty()
- {
- var expectations = Expectations.GetContractNames();
-
- foreach (var e in expectations)
- {
- var export = new Export(e, () => null);
-
- Assert.AreEqual(e, export.Definition.ContractName);
- }
- }
-
-
- [TestMethod]
- public void Constructor4_ValueAsContractNameArgument_ShouldSetDefinitionContractNameProperty()
- {
- var expectations = Expectations.GetContractNames();
-
- foreach (var e in expectations)
- {
- var export = new Export(e, new Dictionary<string, object>(), () => null);
-
- Assert.AreEqual(e, export.Definition.ContractName);
- }
- }
-
- [TestMethod]
- public void Constructor3_ShouldSetMetadataPropertyToEmptyDictionary()
- {
- var export = new Export("ContractName", () => null); ;
-
- EnumerableAssert.IsEmpty(export.Metadata);
- }
-
- [TestMethod]
- public void Constructor4_NullAsMetadataArgument_ShouldSetMetadataPropertyToEmptyDictionary()
- {
- var export = new Export("ContractName", (IDictionary<string, object>)null, () => null); ;
-
- EnumerableAssert.IsEmpty(export.Metadata);
- }
-
- [TestMethod]
- public void Constructor3_NullAsMetadataArgument_ShouldSetMetadataPropertyToReadOnlyDictionary()
- {
- var export = new Export("ContractName", () => null);
-
- ExceptionAssert.Throws<NotSupportedException>(() =>
- {
- export.Metadata["Value"] = "Value";
- });
- }
-
- [TestMethod]
- public void Constructor4_NullAsMetadataArgument_ShouldSetMetadataPropertyToReadOnlyDictionary()
- {
- var export = new Export("ContractName", (IDictionary<string, object>)null, () => null);
-
- ExceptionAssert.Throws<NotSupportedException>(() =>
- {
- export.Metadata["Value"] = "Value";
- });
- }
-
- [TestMethod]
- public void Constructor4_WritableDictionaryAsMetadataArgument_ShouldSetMetadataPropertyToReadOnlyDictionary()
- {
- var export = new Export("ContractName", new Dictionary<string, object>(), () => null);
-
- ExceptionAssert.Throws<NotSupportedException>(() =>
- {
- export.Metadata["Value"] = "Value";
- });
- }
-
- [TestMethod]
- public void Constructor4_DictionaryAsMetadataArgument_ShouldSetMetadataProperty()
- {
- var expectations = Expectations.GetMetadata();
-
- foreach (var e in expectations)
- {
- var export = new Export("ContractName", e, () => null);
-
- EnumerableAssert.AreEqual(e, export.Metadata);
- }
- }
-
- [TestMethod]
- public void Constructor3_ShouldSetDefinitionMetadataPropertyToEmptyDictionary()
- {
- var export = new Export("ContractName", () => null); ;
-
- EnumerableAssert.IsEmpty(export.Definition.Metadata);
- }
-
- [TestMethod]
- public void Constructor4_NullAsMetadataArgument_ShouldSetDefinitionMetadataPropertyToEmptyDictionary()
- {
- var export = new Export("ContractName", (IDictionary<string, object>)null, () => null); ;
-
- EnumerableAssert.IsEmpty(export.Definition.Metadata);
- }
-
- [TestMethod]
- public void Constructor3_ShouldSetDefinitionMetadataPropertyToReadOnlyDictionary()
- {
- var export = new Export("ContractName", () => null);
-
- ExceptionAssert.Throws<NotSupportedException>(() =>
- {
- export.Definition.Metadata["Value"] = "Value";
- });
- }
-
- [TestMethod]
- public void Constructor4_NullAsMetadataArgument_ShouldSetDefinitionMetadataPropertyToReadOnlyDictionary()
- {
- var export = new Export("ContractName", (IDictionary<string, object>)null, () => null);
-
- ExceptionAssert.Throws<NotSupportedException>(() =>
- {
- export.Definition.Metadata["Value"] = "Value";
- });
- }
-
- [TestMethod]
- public void Constructor4_WritableDictionaryAsMetadataArgument_ShouldSetDefinitionMetadataPropertyToReadOnlyDictionary()
- {
- var export = new Export("ContractName", new Dictionary<string, object>(), () => null);
-
- ExceptionAssert.Throws<NotSupportedException>(() =>
- {
- export.Definition.Metadata["Value"] = "Value";
- });
- }
-
- [TestMethod]
- public void Constructor4_DictionaryAsMetadataArgument_ShouldSetDefinitionMetadataProperty()
- {
- var expectations = Expectations.GetMetadata();
-
- foreach (var e in expectations)
- {
- var export = new Export("ContractName", e, () => null);
-
- EnumerableAssert.AreEqual(e, export.Definition.Metadata);
- }
- }
-
- [TestMethod]
- public void Constructor2_FuncReturningAStringAsExportedValueGetter_ShouldBeReturnedByGetExportedValue()
- {
- var definition = ExportDefinitionFactory.Create();
-
- var export = new Export(definition, () => "Value");
-
- Assert.AreEqual("Value", export.Value);
- }
-
- [TestMethod]
- public void Constructor3_FuncReturningAStringAsExportedValueGetter_ShouldBeReturnedByGetExportedValue()
- {
- var export = new Export("ContractName", () => "Value");
-
- Assert.AreEqual("Value", export.Value);
- }
-
- [TestMethod]
- public void Constructor4_FuncReturningAStringAsExportedValueGetter_ShouldBeReturnedByGetExportedValue()
- {
- var export = new Export("ContractName", new Dictionary<string, object>(), () => "Value");
-
- Assert.AreEqual("Value", export.Value);
- }
-
- [TestMethod]
- public void Constructor2_FuncReturningNullAsExportedValueGetter_ShouldBeReturnedByGetExportedValue()
- {
- var definition = ExportDefinitionFactory.Create();
-
- var export = new Export(definition, () => null);
-
- Assert.IsNull(export.Value);
- }
-
- [TestMethod]
- public void Constructor3_FuncReturningNullAsExportedValueGetter_ShouldBeReturnedByGetExportedValue()
- {
- var export = new Export("ContractName", () => null);
-
- Assert.IsNull(export.Value);
- }
-
- [TestMethod]
- public void Constructor4_FuncReturningNullAsExportedValueGetter_ShouldBeReturnedByGetExportedValue()
- {
- var export = new Export("ContractName", new Dictionary<string, object>(), () => null);
-
- Assert.IsNull(export.Value);
- }
-
- [TestMethod]
- public void Metadata_DerivedExportDefinition_ShouldReturnDefinitionMetadata()
- {
- var expectations = Expectations.GetMetadata();
-
- foreach (var e in expectations)
- {
- var definition = ExportDefinitionFactory.Create("ContractName", e);
-
- var export = new DerivedExport(definition);
-
- EnumerableAssert.AreEqual(e, export.Metadata);
- }
- }
-
- [TestMethod]
- public void Definition_WhenNotOverridden_ShouldThrowNotImplemented()
- {
- var export = new NoOverridesExport();
-
- ExceptionAssert.Throws<NotImplementedException>(() =>
- {
- var definition = export.Definition;
- });
- }
-
- [TestMethod]
- public void Metadata_WhenDefinitionNotOverridden_ShouldThrowNotImplemented()
- {
- var export = new NoOverridesExport();
-
- ExceptionAssert.Throws<NotImplementedException>(() =>
- {
- var definition = export.Metadata;
- });
- }
-
- [TestMethod]
- public void GetExportedValue_WhenGetExportedValueCoreNotOverridden_ShouldThrowNotImplemented()
- {
- var export = new NoOverridesExport();
-
- ExceptionAssert.Throws<NotImplementedException>(() =>
- {
- var value = export.Value;
- });
- }
-
- [TestMethod]
- public void GetExportedValue_ShouldCacheExportedValueGetter()
- {
- int count = 0;
-
- var export = new Export("ContractName", () =>
- {
- count++;
- return count;
- });
-
- Assert.AreEqual(1, export.Value);
- Assert.AreEqual(1, export.Value);
- Assert.AreEqual(1, export.Value);
- }
-
-
- [TestMethod]
- public void GetExportedValue_ShouldCacheOverrideGetExportedValueCore()
- {
- int count = 0;
-
- var export = new DerivedExport(() =>
- {
- count++;
- return count;
- });
-
- Assert.AreEqual(1, export.Value);
- Assert.AreEqual(1, export.Value);
- Assert.AreEqual(1, export.Value);
- }
-
- [TestMethod]
- public void GetExportedValue_ThrowingFuncAsObjectGetterArgument_ShouldThrow()
- {
- var exceptionToThrow = new Exception();
-
- var export = new Export("ContractName", new Dictionary<string, object>(), () =>
- {
- throw exceptionToThrow;
- });
-
- ExceptionAssert.Throws(exceptionToThrow, RetryMode.Retry, () =>
- {
- var value = export.Value;
- });
- }
-
-
- private class NoOverridesExport : Export
- {
- }
-
- private class DerivedExport : Export
- {
- private readonly Func<object> _exportedValueGetter;
- private readonly ExportDefinition _definition;
-
- public DerivedExport(ExportDefinition definition)
- {
- _definition = definition;
- }
-
- public DerivedExport(Func<object> exportedValueGetter)
- {
- _exportedValueGetter = exportedValueGetter;
- }
-
- public override ExportDefinition Definition
- {
- get { return _definition; }
- }
-
- protected override object GetExportedValueCore()
- {
- return _exportedValueGetter();
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ExportableAttributeTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ExportableAttributeTests.cs deleted file mode 100644 index 51b23d42a5f..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ExportableAttributeTests.cs +++ /dev/null @@ -1,224 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.Linq;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.Reflection;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class MetadataAttributeTests
- {
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void UntypedStructureTest()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(AttributedModelServices.CreatePart(new BasicTestComponent()));
- container.Compose(batch);
- var export = container.GetExport<BasicTestComponent, IDictionary<string, object>>();
-
-
- Assert.IsNotNull(export.Metadata, "It should have metadata");
- Assert.AreEqual("One", export.Metadata["String1"], "Property attribute should copy straight across");
- Assert.AreEqual("Two", export.Metadata["String2"], "Property attribute should copy straight across");
- var e = export.Metadata["Numbers"] as IList<int>;
- Assert.IsNotNull(e, "Should get a collection of numbers");
- Assert.IsTrue(e.Contains(1), "Should have 1 in the list");
- Assert.IsTrue(e.Contains(2), "Should have 2 in the list");
- Assert.IsTrue(e.Contains(3), "Should have 3 in the list");
- Assert.AreEqual(3, e.Count, "Should be three numbers total");
- }
-
-#if !SILVERLIGHT
- // Silverlight doesn't support strongly typed metadata
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void StronglyTypedStructureTest()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(AttributedModelServices.CreatePart(new BasicTestComponent()));
- container.Compose(batch);
-
- var export = container.GetExport<BasicTestComponent, IStronglyTypedStructure>();
-
- Assert.IsNotNull(export.Metadata, "It should have metadata");
- Assert.AreEqual("One", export.Metadata.String1, "Property should copy straight across");
- Assert.AreEqual("Two", export.Metadata.String2, "Property should copy straight across");
- Assert.IsTrue(export.Metadata.Numbers.Contains(1), "Should have 1 in the list");
- Assert.IsTrue(export.Metadata.Numbers.Contains(2), "Should have 2 in the list");
- Assert.IsTrue(export.Metadata.Numbers.Contains(3), "Should have 3 in the list");
- Assert.AreEqual(3, export.Metadata.Numbers.Length, "Should be three numbers total");
- }
-#endif //!SILVERLIGHT
-
- [Export]
- // Should cause a conflict with the multiple nature of Name.Bar because
- // it isn't marked with IsMultiple=true
- [ExportMetadata("Bar", "Blah")]
- [Name("MEF")]
- [Name("MEF2")]
- [PartNotDiscoverable]
- public class BasicTestComponentWithInvalidMetadata
- {
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void InvalidMetadataAttributeTest()
- {
- ComposablePart part = AttributedModelServices.CreatePart(new BasicTestComponentWithInvalidMetadata());
- ExportDefinition export = part.ExportDefinitions.First();
-
- var ex = ExceptionAssert.Throws<InvalidOperationException>(RetryMode.DoNotRetry, () =>
- {
- var metadata = export.Metadata;
- });
-
- Assert.IsTrue(ex.Message.Contains("Bar"));
- }
-
- [AttributeUsage(AttributeTargets.All)]
- [MetadataAttribute]
- public class MetadataWithInvalidCustomAttributeType : Attribute
- {
- public PersonClass Person { get { return new PersonClass(); } }
-
- public class PersonClass
- {
- public string First { get { return "George"; } }
- public string Last { get { return "Washington"; } }
- }
- }
-
- [Export]
- [MetadataWithInvalidCustomAttributeType]
- [PartNotDiscoverable]
- public class ClassWithInvalidCustomAttributeType
- {
-
- }
-
- [TestMethod]
- public void InvalidAttributType_CustomType_ShouldThrow()
- {
- ComposablePart part = AttributedModelServices.CreatePart(new ClassWithInvalidCustomAttributeType());
- ExportDefinition export = part.ExportDefinitions.First();
-
- // Should throw InvalidOperationException during discovery because
- // the person class is an invalid metadata type
- ExceptionAssert.Throws<InvalidOperationException>(RetryMode.DoNotRetry, () =>
- {
- var metadata = export.Metadata;
- });
- }
-
- [AttributeUsage(AttributeTargets.All)]
- [MetadataAttribute]
- public class MetadataWithInvalidVersionPropertyAttributeType : Attribute
- {
- public MetadataWithInvalidVersionPropertyAttributeType()
- {
- this.Version = new Version(1, 1);
- }
- public Version Version { get; set; }
- }
-
- [Export]
- [MetadataWithInvalidVersionPropertyAttributeType]
- [PartNotDiscoverable]
- public class ClassWithInvalidVersionPropertyAttributeType
- {
-
- }
-
- [TestMethod]
- public void InvalidAttributType_VersionPropertyType_ShouldThrow()
- {
- ComposablePart part = AttributedModelServices.CreatePart(new ClassWithInvalidVersionPropertyAttributeType());
- ExportDefinition export = part.ExportDefinitions.First();
-
- // Should throw InvalidOperationException during discovery because
- // the person class is an invalid metadata type
- ExceptionAssert.Throws<InvalidOperationException>(RetryMode.DoNotRetry, () =>
- {
- var metadata = export.Metadata;
- });
- }
-
- [MetadataAttribute]
- public class BaseMetadataAttribute : Attribute
- {
- public string BaseKey { get { return "BaseValue"; } }
- }
-
- public class DerivedMetadataAttribute : BaseMetadataAttribute
- {
- public string DerivedKey { get { return "DerivedValue"; } }
- }
-
- [Export]
- [DerivedMetadata]
- public class ExportWithDerivedMetadataAttribute { }
-
- [TestMethod]
- public void DerivedMetadataAttributeAttribute_ShouldSupplyMetadata()
- {
- ComposablePart part = AttributedModelServices.CreatePart(new ExportWithDerivedMetadataAttribute());
- ExportDefinition export = part.ExportDefinitions.Single();
-
- Assert.AreEqual("BaseValue", export.Metadata["BaseKey"]);
- Assert.AreEqual("DerivedValue", export.Metadata["DerivedKey"]);
- }
- }
-
- [AttributeUsage(AttributeTargets.All)]
- [MetadataAttribute]
- public class BasicMetadataAttribute : Attribute
- {
- public string String1 { get { return "One"; } }
-
- public string String2 { get { return "Two"; } }
-
- public int[] Numbers { get { return new int[] { 1, 2, 3 }; } }
-
- public CreationPolicy Policy { get { return CreationPolicy.NonShared; } }
-
- public Type Type { get { return typeof(BasicMetadataAttribute); } }
- }
-
- public interface IStronglyTypedStructure
- {
- string String1 { get; }
- string String2 { get; }
- int[] Numbers { get; }
- CreationPolicy Policy { get; }
- Type Type { get; }
- }
-
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true)]
- [MetadataAttribute]
- public class Name : Attribute
- {
- public Name(string name) { Bar = name; }
-
- public string Bar { set; get; }
- }
-
- [PartNotDiscoverable]
- [Export]
- [BasicMetadata]
- public class BasicTestComponent
- {
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Extensibility/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Extensibility/.gitattributes deleted file mode 100644 index 68b098c1438..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Extensibility/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -/CustomImportAttribute.cs -crlf -/CustomImportManyAttribute.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Extensibility/CustomImportAttribute.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Extensibility/CustomImportAttribute.cs deleted file mode 100644 index 0894a2061a9..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Extensibility/CustomImportAttribute.cs +++ /dev/null @@ -1,20 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-
-namespace System.ComponentModel.Composition.Extensibility
-{
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = true)]
- public class CustomImportAttribute : ImportAttribute
- {
- public CustomImportAttribute()
- {
- }
-
- public CustomImportAttribute(Type type)
- : base(type)
- {
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Extensibility/CustomImportManyAttribute.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Extensibility/CustomImportManyAttribute.cs deleted file mode 100644 index b119e79b05e..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Extensibility/CustomImportManyAttribute.cs +++ /dev/null @@ -1,20 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-
-namespace System.ComponentModel.Composition.Extensibility
-{
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = true)]
- public class CustomImportManyAttribute : ImportManyAttribute
- {
- public CustomImportManyAttribute()
- {
- }
-
- public CustomImportManyAttribute(Type type)
- : base(type)
- {
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/.gitattributes deleted file mode 100644 index 6f6eeedaedf..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/.gitattributes +++ /dev/null @@ -1,31 +0,0 @@ -/CatalogFactory.DerivedComposablePartCatalog.cs -crlf -/CatalogFactory.DisposableComposablePartCatalog.cs -crlf -/CatalogFactory.FilteredComposablePartCatalog.cs -crlf -/CatalogFactory.MutableComposablePartCatalog.cs -crlf -/CatalogFactory.NoOverridesComposablePartCatalog.cs -crlf -/CatalogFactory.NonFilteringTypeCatalog.cs -crlf -/CatalogFactory.cs -crlf -/ConstraintFactory.cs -crlf -/ContainerFactory.DisposableCompositionContainer.cs -crlf -/ContainerFactory.NoOverridesCompositionContainer.cs -crlf -/ContainerFactory.cs -crlf -/ElementFactory.CompositionElement.cs -crlf -/ElementFactory.cs -crlf -/ErrorFactory.cs -crlf -/ExportDefinitionFactory.DerivedExportDefinition.cs -crlf -/ExportDefinitionFactory.cs -crlf -/ExportFactory.cs -crlf -/ExportProviderFactory.NoOverridesExportProvider.cs -crlf -/ExportProviderFactory.RecomposableExportProvider.cs -crlf -/ExportProviderFactory.cs -crlf -/ImportDefinitionFactory.DerivedContractBasedImportDefinition.cs -crlf -/ImportDefinitionFactory.DerivedImportDefinition.cs -crlf -/ImportDefinitionFactory.cs -crlf -/PartDefinitionFactory.DerivedComposablePartDefinition.cs -crlf -/PartDefinitionFactory.NoOverridesComposablePartDefinition.cs -crlf -/PartDefinitionFactory.cs -crlf -/PartFactory.DisposableComposablePart.cs -crlf -/PartFactory.NoOverridesComposablePart.cs -crlf -/PartFactory.cs -crlf -/ReflectionFactory.MockParameterInfo.cs -crlf -/ReflectionFactory.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/CatalogFactory.DerivedComposablePartCatalog.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/CatalogFactory.DerivedComposablePartCatalog.cs deleted file mode 100644 index e5a46572fcc..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/CatalogFactory.DerivedComposablePartCatalog.cs +++ /dev/null @@ -1,28 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Primitives;
-using System.Linq;
-using System.Collections.Generic;
-
-namespace System.ComponentModel.Composition.Factories
-{
- partial class CatalogFactory
- {
- private class DerivedComposablePartCatalog : ComposablePartCatalog
- {
- private readonly IEnumerable<ComposablePartDefinition> _definitions;
-
- public DerivedComposablePartCatalog(IEnumerable<ComposablePartDefinition> definitions)
- {
- _definitions = definitions;
- }
-
- public override IQueryable<ComposablePartDefinition> Parts
- {
- get { return _definitions.AsQueryable(); }
- }
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/CatalogFactory.DisposableComposablePartCatalog.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/CatalogFactory.DisposableComposablePartCatalog.cs deleted file mode 100644 index 9adf55c7236..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/CatalogFactory.DisposableComposablePartCatalog.cs +++ /dev/null @@ -1,45 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-using System.Linq;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition.Factories
-{
- partial class CatalogFactory
- {
- // NOTE: Do not add any more behavior to this class, as ComposablePartCatalogTests.cs
- // uses this to verify default behavior of the base class.
- private class DisposableComposablePartCatalog : ComposablePartCatalog
- {
- private readonly Action<bool> _disposeCallback;
-
- public DisposableComposablePartCatalog(Action<bool> disposeCallback)
- {
- Assert.IsNotNull(disposeCallback);
-
- _disposeCallback = disposeCallback;
- }
-
- ~DisposableComposablePartCatalog()
- {
- Dispose(false);
- }
-
- public override IQueryable<ComposablePartDefinition> Parts
- {
- get { throw new NotImplementedException(); }
- }
-
- protected override void Dispose(bool disposing)
- {
- _disposeCallback(disposing);
-
- base.Dispose(disposing);
- }
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/CatalogFactory.FilteredComposablePartCatalog.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/CatalogFactory.FilteredComposablePartCatalog.cs deleted file mode 100644 index c891c964180..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/CatalogFactory.FilteredComposablePartCatalog.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.Hosting;
-using System.Linq;
-using System.Linq.Expressions;
-
-namespace System.ComponentModel.Composition.Factories
-{
- partial class CatalogFactory
- {
- public class FilteredCatalog : ComposablePartCatalog, INotifyComposablePartCatalogChanged
- {
- private readonly ComposablePartCatalog _inner;
- private readonly INotifyComposablePartCatalogChanged _innerNotifyChange;
- private readonly IQueryable<ComposablePartDefinition> _partsQuery;
-
- public FilteredCatalog(ComposablePartCatalog inner,
- Func<ComposablePartDefinition, bool> filter)
- {
- _inner = inner;
- _innerNotifyChange = inner as INotifyComposablePartCatalogChanged;
- _partsQuery = inner.Parts.Where(filter).AsQueryable();
- }
-
- public override IQueryable<ComposablePartDefinition> Parts
- {
- get
- {
- return _partsQuery;
- }
- }
-
- public event EventHandler<ComposablePartCatalogChangeEventArgs> Changed
- {
- add
- {
- if (_innerNotifyChange != null)
- _innerNotifyChange.Changed += value;
- }
- remove
- {
- if (_innerNotifyChange != null)
- _innerNotifyChange.Changed -= value;
- }
- }
-
- public event EventHandler<ComposablePartCatalogChangeEventArgs> Changing
- {
- add
- {
- if (_innerNotifyChange != null)
- _innerNotifyChange.Changing += value;
- }
- remove
- {
- if (_innerNotifyChange != null)
- _innerNotifyChange.Changing -= value;
- }
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/CatalogFactory.MutableComposablePartCatalog.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/CatalogFactory.MutableComposablePartCatalog.cs deleted file mode 100644 index 0cc4862d485..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/CatalogFactory.MutableComposablePartCatalog.cs +++ /dev/null @@ -1,67 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Primitives;
-using System.Linq;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.ComponentModel.Composition.Hosting;
-
-namespace System.ComponentModel.Composition.Factories
-{
- partial class CatalogFactory
- {
- public class MutableComposablePartCatalog : ComposablePartCatalog, INotifyComposablePartCatalogChanged
- {
- private readonly HashSet<ComposablePartDefinition> _definitions;
-
- public MutableComposablePartCatalog(IEnumerable<ComposablePartDefinition> definitions)
- {
- _definitions = new HashSet<ComposablePartDefinition>(definitions);
- }
-
- public void AddDefinition(ComposablePartDefinition definition)
- {
- OnDefinitionsChanged(definition, true);
- }
-
- public void RemoveDefinition(ComposablePartDefinition definition)
- {
- OnDefinitionsChanged(definition, false);
- }
-
- public override IQueryable<ComposablePartDefinition> Parts
- {
- get { return _definitions.AsQueryable(); }
- }
-
- private void OnDefinitionsChanged(ComposablePartDefinition definition, bool added)
- {
- ComposablePartDefinition[] addedDefinitions = added ? new ComposablePartDefinition[] { definition } : new ComposablePartDefinition[0];
- ComposablePartDefinition[] removeDefinitions = added ? new ComposablePartDefinition[0] : new ComposablePartDefinition[] { definition };
-
- var e = new ComposablePartCatalogChangeEventArgs(addedDefinitions, removeDefinitions, null);
- Changing(this, e);
-
- if (added)
- {
- _definitions.Add(definition);
- }
- else
- {
- _definitions.Remove(definition);
- }
-
- if (Changed != null)
- {
- Changed(this, e);
- }
- }
-
- public event EventHandler<ComposablePartCatalogChangeEventArgs> Changed;
-
- public event EventHandler<ComposablePartCatalogChangeEventArgs> Changing;
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/CatalogFactory.NoOverridesComposablePartCatalog.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/CatalogFactory.NoOverridesComposablePartCatalog.cs deleted file mode 100644 index d0b615eeaa9..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/CatalogFactory.NoOverridesComposablePartCatalog.cs +++ /dev/null @@ -1,26 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Primitives;
-using System.Linq;
-
-namespace System.ComponentModel.Composition.Factories
-{
- partial class CatalogFactory
- {
- // NOTE: Do not add any more behavior to this class, as ComposablePartCatalogTests.cs
- // uses this to verify default behavior of the base class.
- private class NoOverridesComposablePartCatalog : ComposablePartCatalog
- {
- public NoOverridesComposablePartCatalog()
- {
- }
-
- public override IQueryable<ComposablePartDefinition> Parts
- {
- get { return Enumerable.Empty<ComposablePartDefinition>().AsQueryable(); }
- }
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/CatalogFactory.NonFilteringTypeCatalog.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/CatalogFactory.NonFilteringTypeCatalog.cs deleted file mode 100644 index 784c54d695a..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/CatalogFactory.NonFilteringTypeCatalog.cs +++ /dev/null @@ -1,32 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Primitives;
-using System.Linq;
-using System.Collections.Generic;
-
-namespace System.ComponentModel.Composition.Factories
-{
- partial class CatalogFactory
- {
- private class NonFilteringTypeCatalog : ComposablePartCatalog
- {
- private readonly List<ComposablePartDefinition> _definitions;
-
- public NonFilteringTypeCatalog(params Type[] types)
- {
- this._definitions = new List<ComposablePartDefinition>();
- foreach (Type type in types)
- {
- this._definitions.Add(AttributedModelServices.CreatePartDefinition(type, null));
- }
- }
-
- public override IQueryable<ComposablePartDefinition> Parts
- {
- get { return this._definitions.AsQueryable(); }
- }
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/CatalogFactory.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/CatalogFactory.cs deleted file mode 100644 index cb957a2d303..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/CatalogFactory.cs +++ /dev/null @@ -1,77 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Reflection;
-
-namespace System.ComponentModel.Composition.Factories
-{
- public static partial class CatalogFactory
- {
- public static AggregateCatalog CreateAggregateCatalog()
- {
- return new AggregateCatalog();
- }
-
- public static AggregateCatalog CreateAggregateCatalog(params ComposablePartCatalog[] catalogs)
- {
- return new AggregateCatalog(catalogs);
- }
-
- public static ComposablePartCatalog Create()
- {
- return new NoOverridesComposablePartCatalog();
- }
-
- public static ComposablePartCatalog Create(params ComposablePart[] parts)
- {
- var definitions = parts.Select(part => PartDefinitionFactory.Create(part));
-
- return Create(definitions.ToArray());
- }
-
- public static ComposablePartCatalog Create(params ComposablePartDefinition[] definitions)
- {
- return new DerivedComposablePartCatalog(definitions);
- }
-
- public static ComposablePartCatalog CreateDefaultAttributed()
- {
- return CreateAttributed(typeof(CatalogFactory).Assembly);
- }
-
- public static ComposablePartCatalog CreateDisposable(Action<bool> disposeCallback)
- {
- return new DisposableComposablePartCatalog(disposeCallback);
- }
-
- public static ComposablePartCatalog CreateAttributed(Assembly assembly)
- {
- return new AssemblyCatalog(assembly);
- }
-
- public static ComposablePartCatalog CreateAttributed(params Type[] types)
- {
- return new TypeCatalog(types);
- }
-
- public static ComposablePartCatalog CreateNonFilteredAttributed(params Type[] types)
- {
- return new NonFilteringTypeCatalog(types);
- }
-
- public static MutableComposablePartCatalog CreateMutable(params ComposablePartDefinition[] definitions)
- {
- return new MutableComposablePartCatalog(definitions);
- }
-
- public static ComposablePartCatalog CreateFiltered(ComposablePartCatalog catalog, Func<ComposablePartDefinition, bool> filter)
- {
- return new FilteredCatalog(catalog, filter);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ConstraintFactory.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ConstraintFactory.cs deleted file mode 100644 index da087350756..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ConstraintFactory.cs +++ /dev/null @@ -1,18 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition;
-using System.Linq.Expressions;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.Factories
-{
- internal static class ConstraintFactory
- {
- public static Expression<Func<ExportDefinition, bool>> Create(string contractName)
- {
- return definition => definition.ContractName.Equals(contractName);
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ContainerFactory.DisposableCompositionContainer.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ContainerFactory.DisposableCompositionContainer.cs deleted file mode 100644 index 57710ec61e4..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ContainerFactory.DisposableCompositionContainer.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.Linq;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition.Factories
-{
- partial class ContainerFactory
- {
- // NOTE: Do not add any more behavior to this class, as CompositionContainerTests.cs
- // uses this to verify default behavior of the base class.
- private class DisposableCompositionContainer : CompositionContainer
- {
- private readonly Action<bool> _disposeCallback;
-
- public DisposableCompositionContainer(Action<bool> disposeCallback)
- {
- Assert.IsNotNull(disposeCallback);
-
- _disposeCallback = disposeCallback;
- }
-
- ~DisposableCompositionContainer()
- {
- Dispose(false);
- }
-
- protected override void Dispose(bool disposing)
- {
- _disposeCallback(disposing);
-
- base.Dispose(disposing);
- }
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ContainerFactory.NoOverridesCompositionContainer.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ContainerFactory.NoOverridesCompositionContainer.cs deleted file mode 100644 index ddfd16f4c7c..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ContainerFactory.NoOverridesCompositionContainer.cs +++ /dev/null @@ -1,23 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.Linq;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition.Factories
-{
- partial class ContainerFactory
- {
- // NOTE: Do not add any more behavior to this class, as CompositionContainerTests.cs
- // uses this to verify default behavior of the base class.
- private class NoOverridesCompositionContainer : CompositionContainer
- {
- public NoOverridesCompositionContainer()
- {
- }
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ContainerFactory.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ContainerFactory.cs deleted file mode 100644 index 059e665de79..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ContainerFactory.cs +++ /dev/null @@ -1,106 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.AttributedModel;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Linq;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-
-namespace System.ComponentModel.Composition.Factories
-{
- internal static partial class ContainerFactory
- {
- public static CompositionContainer Create()
- {
- return Create((ComposablePart[])null);
- }
-
- public static CompositionContainer Create(ComposablePartCatalog catalog)
- {
- return new CompositionContainer(catalog);
- }
-
- public static CompositionContainer Create(CompositionContainer parent)
- {
- return new CompositionContainer(parent);
- }
-
- public static CompositionContainer Create(params ComposablePart[] parts)
- {
- return Create((CompositionContainer)null, parts);
- }
-
- public static CompositionContainer CreateWithDefaultAttributedCatalog()
- {
- var catalog = CatalogFactory.CreateDefaultAttributed();
-
- return Create(catalog);
- }
-
- public static CompositionContainer CreateWithAttributedCatalog(params Type[] types)
- {
- var catalog = CatalogFactory.CreateAttributed(types);
-
- return Create(catalog);
- }
-
- public static CompositionContainer CreateAttributed(params object[] parts)
- {
- var container = new CompositionContainer();
- var partsArray = new ComposablePart[parts.Length];
-
- for (int i = 0; i < parts.Length; i++)
- {
- Assert.IsNotInstanceOfType(parts[i], typeof(Type), "You should be using CreateWithAttributedCatalog not CreateAttributed");
- partsArray[i] = PartFactory.CreateAttributed(parts[i]);
- }
-
- return Create(partsArray);
- }
-
- public static CompositionContainer Create(CompositionContainer parent, params ComposablePart[] parts)
- {
- CompositionContainer container;
- if (parent == null)
- {
- container = new CompositionContainer();
- }
- else
- {
- container = new CompositionContainer(parent);
- }
-
- if (parts != null)
- {
- CompositionBatch batch = new CompositionBatch(parts, Enumerable.Empty<ComposablePart>());
- container.Compose(batch);
- }
-
- return container;
- }
-
- public static CompositionContainer Create(params MicroExport[] exports)
- {
- var part = PartFactory.CreateExporter(exports);
-
- return Create(part);
- }
-
- public static CompositionContainer Create(CompositionContainer parent, params MicroExport[] exports)
- {
- var part = PartFactory.CreateExporter(exports);
-
- return Create(parent, part);
- }
-
-
- public static CompositionContainer CreateDisposable(Action<bool> disposeCallback)
- {
- return new DisposableCompositionContainer(disposeCallback);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ElementFactory.CompositionElement.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ElementFactory.CompositionElement.cs deleted file mode 100644 index 71f89073361..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ElementFactory.CompositionElement.cs +++ /dev/null @@ -1,35 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.Factories
-{
- partial class ElementFactory
- {
- private class CompositionElement : ICompositionElement
- {
- private readonly string _displayName;
- private readonly ICompositionElement _origin;
-
- public CompositionElement(string displayName, ICompositionElement origin)
- {
- _displayName = displayName;
- _origin = origin;
- }
-
- public string DisplayName
- {
- get { return _displayName; }
- }
-
- public ICompositionElement Origin
- {
- get { return _origin; }
- }
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ElementFactory.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ElementFactory.cs deleted file mode 100644 index 34d15343d3a..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ElementFactory.cs +++ /dev/null @@ -1,45 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.Factories
-{
- internal static partial class ElementFactory
- {
- public static ICompositionElement Create()
- {
- return Create((string)null, (ICompositionElement)null);
- }
-
- public static ICompositionElement Create(string displayName)
- {
- return Create(displayName, (ICompositionElement)null);
- }
-
- public static ICompositionElement Create(ICompositionElement origin)
- {
- return Create((string)null, origin);
- }
-
- public static ICompositionElement Create(string displayName, ICompositionElement origin)
- {
- return new CompositionElement(displayName, origin);
- }
-
- public static ICompositionElement CreateChain(int count)
- {
- ICompositionElement previousElement = null;
-
- for (int i = 0; i < count; i++)
- {
- previousElement = Create((count - i).ToString(), previousElement);
- }
-
- return previousElement;
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ErrorFactory.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ErrorFactory.cs deleted file mode 100644 index 2424739283f..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ErrorFactory.cs +++ /dev/null @@ -1,182 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.IO;
-using System.Text;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition.Factories
-{
- internal static partial class ErrorFactory
- {
- public static CompositionError Create(ICompositionElement element)
- {
- return Create(CompositionErrorId.Unknown, (string)null, element, (Exception)null);
- }
-
- public static CompositionError Create(Exception exception)
- {
- return Create(CompositionErrorId.Unknown, (string)null, (ICompositionElement)null, exception);
- }
-
- public static CompositionError Create(string message)
- {
- return Create(CompositionErrorId.Unknown, message, (ICompositionElement)null, (Exception)null);
- }
-
- public static CompositionError Create(string message, Exception exception)
- {
- return Create(CompositionErrorId.Unknown, message, (ICompositionElement)null, exception);
- }
-
- public static CompositionError Create(CompositionErrorId errorId)
- {
- return Create(errorId, errorId.ToString(), (ICompositionElement)null, (Exception)null);
- }
-
- public static CompositionError Create(CompositionErrorId errorId, string message, Exception exception)
- {
- return new CompositionError(errorId, message, (ICompositionElement)null, exception);
- }
-
- public static CompositionError Create(CompositionErrorId errorId, string message, ICompositionElement element, Exception exception)
- {
- return new CompositionError(errorId, message, element, exception);
- }
-
- public static IEnumerable<CompositionError> CreateFromDsl(string format)
- {
- CompositionException exception = (CompositionException)CreateFromDslCore(format);
-
- return exception.Errors;
- }
-
- private static Exception CreateFromDslCore(string format)
- {
- List<Tuple<string, string>> identifiers = new List<Tuple<string,string>>();
-
- StringBuilder token = new StringBuilder();
- StringReader reader = new StringReader(format);
-
- while (reader.Peek() != -1)
- {
- char c = (char)reader.Read();
- if (c == '|')
- {
- AddIdentifier(identifiers, token);
- continue;
- }
-
- if (c == '(')
- {
- string dsl = ReadToNextMatchingParenthesis(reader);
-
- AddIdentifier(identifiers, token, dsl);
- continue;
- }
-
- token.Append(c);
- }
-
- AddIdentifier(identifiers, token);
-
- return CreateFromList(identifiers);
- }
-
- private static Exception CreateFromList(List<Tuple<string, string>> identifiers)
- {
- List<CompositionError> errors = new List<CompositionError>();
- Exception exception = null;
- foreach (var identifier in identifiers)
- {
- Exception innerException = null;
- if (identifier.Item2 != null)
- {
- innerException = CreateFromDslCore(identifier.Item2);
- }
-
- if (identifier.Item1 == "Exception")
- {
- Assert.IsNull(exception);
- exception = new Exception(identifier.Item1, innerException);
- }
- else
- {
- Assert.AreEqual("Error", identifier.Item1);
-
- errors.Add(Create(identifier.Item1, innerException));
- }
- }
-
- if (errors.Count == 0)
- {
- return exception;
- }
-
- return new CompositionException("", exception, errors);
- }
-
- private static void AddIdentifier(List<Tuple<string, string>> identifiers, StringBuilder identifier)
- {
- AddIdentifier(identifiers, identifier, (string)null);
- }
-
- private static void AddIdentifier(List<Tuple<string, string>> identifiers, StringBuilder identifier, string dsl)
- {
- if (identifier.Length == 0)
- return;
-
- identifiers.Add(new Tuple<string, string>(identifier.ToString(), dsl));
-
- identifier.Length = 0;
- }
-
- private static IEnumerable<CompositionError> CreateFromList(List<string> errors)
- {
- foreach (string value in errors)
- {
- yield return Create(value);
- }
- }
-
- private static string ReadToNextMatchingParenthesis(StringReader reader)
- {
- Stack<char> parenthesis = new Stack<char>();
- parenthesis.Push('(');
-
- StringBuilder builder = new StringBuilder();
- while (reader.Peek() != -1)
- {
- char c = (char)reader.Read();
- if (c == '(')
- {
- parenthesis.Push(c);
-
- if (parenthesis.Count == 1)
- {
- continue;
- }
- }
-
- if (c == ')')
- {
- char pop = parenthesis.Pop();
- Assert.AreEqual('(', pop);
-
- if (parenthesis.Count == 0)
- {
- break;
- }
- }
-
- builder.Append(c);
- }
-
- return builder.ToString();
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ExportDefinitionFactory.DerivedExportDefinition.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ExportDefinitionFactory.DerivedExportDefinition.cs deleted file mode 100644 index 41916d32d84..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ExportDefinitionFactory.DerivedExportDefinition.cs +++ /dev/null @@ -1,46 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.Factories
-{
- partial class ExportDefinitionFactory
- {
- private class DerivedExportDefinition : ExportDefinition, ICompositionElement
- {
- private readonly string _contractName;
- private readonly IDictionary<string, object> _metadata;
-
- public DerivedExportDefinition(string contractName, IDictionary<string, object> metadata)
- {
- _contractName = contractName;
- _metadata = metadata ?? new Dictionary<string, object>();
- }
-
- public override string ContractName
- {
- get { return _contractName; }
- }
-
- public override IDictionary<string, object> Metadata
- {
- get { return _metadata; }
- }
-
- public string DisplayName
- {
- get { return base.ToString(); }
- }
-
- public ICompositionElement Origin
- {
- get { return null; }
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ExportDefinitionFactory.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ExportDefinitionFactory.cs deleted file mode 100644 index d8b84fd5599..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ExportDefinitionFactory.cs +++ /dev/null @@ -1,30 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.Factories
-{
- // This class deliberately does not create instances of ExportDefinition,
- // so as to test other derived classes from ImportDefinition.
- internal static partial class ExportDefinitionFactory
- {
- public static ExportDefinition Create()
- {
- return Create((string)null, (IDictionary<string, object>)null);
- }
-
- public static ExportDefinition Create(string contractName)
- {
- return Create(contractName, (IDictionary<string, object>)null);
- }
-
- public static ExportDefinition Create(string contractName, IDictionary<string, object> metadata)
- {
- return new DerivedExportDefinition(contractName, metadata);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ExportFactory.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ExportFactory.cs deleted file mode 100644 index 7813fee2b6f..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ExportFactory.cs +++ /dev/null @@ -1,67 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.Factories
-{
- // This class deliberately does not create instances of Lazy<T, TMetadataView>,
- // so as to test other derived classes from Lazy<T, TMetadataView>.
- internal static partial class ExportFactory
- {
- public static IEnumerable<Export> Create(string contractName, int count)
- {
- Export[] exports = new Export[count];
-
- for (int i = 0; i < count; i++)
- {
- exports[i] = Create(contractName, (object)null);
- }
-
- return exports;
- }
-
- public static Lazy<T> Create<T>(T value)
- {
- return new Lazy<T>(() => value, false);
- }
-
- public static Lazy<T, IDictionary<string, object>> Create<T>(T value, IDictionary<string, object> metadata)
- {
- return Create<T, IDictionary<string, object>>(() => value, metadata);
- }
-
- public static Export Create(string contractName, Func<object> exportedValueGetter)
- {
- return Create(contractName,(IDictionary<string, object>)null, exportedValueGetter);
- }
-
- public static Export Create(string contractName)
- {
- return Create(contractName, null, (IDictionary<string, object>)null);
- }
-
- public static Export Create(string contractName, object value)
- {
- return Create(contractName, value, (IDictionary<string, object>)null);
- }
-
- public static Export Create(string contractName, object value, IDictionary<string, object> metadata)
- {
- return Create(contractName, metadata, () => value);
- }
-
- public static Export Create(string contractName, IDictionary<string, object> metadata, Func<object> exportedValueGetter)
- {
- return new Export(ExportDefinitionFactory.Create(contractName, metadata), exportedValueGetter);
- }
-
- private static Lazy<T, TMetadataView> Create<T, TMetadataView>(Func<T> exportedValueGetter, IDictionary<string, object> metadata)
- {
- return new Lazy<T, TMetadataView>(exportedValueGetter, AttributedModelServices.GetMetadataView<TMetadataView>(metadata), false);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ExportProviderFactory.NoOverridesExportProvider.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ExportProviderFactory.NoOverridesExportProvider.cs deleted file mode 100644 index 708ebc269ee..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ExportProviderFactory.NoOverridesExportProvider.cs +++ /dev/null @@ -1,30 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition;
-using System.Collections.Generic;
-using System.Linq.Expressions;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.Factories
-{
- partial class ExportProviderFactory
- {
- // NOTE: Do not add any more behavior to this class, as ExportProviderTests.cs
- // uses this to verify default behavior of the base class.
- private class NoOverridesExportProvider : ExportProvider
- {
- public NoOverridesExportProvider()
- {
- }
-
- protected override IEnumerable<Export> GetExportsCore(ImportDefinition definition, AtomicComposition context)
- {
- throw new NotImplementedException();
- }
- }
- }
-
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ExportProviderFactory.RecomposableExportProvider.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ExportProviderFactory.RecomposableExportProvider.cs deleted file mode 100644 index c3137c14da4..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ExportProviderFactory.RecomposableExportProvider.cs +++ /dev/null @@ -1,114 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Linq;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Collections.Generic;
-using System.Linq.Expressions;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition.Factories
-{
- partial class ExportProviderFactory
- {
- public class RecomposableExportProvider : ExportProvider
- {
- public static Dictionary<string, object> EmptyMetadataDictionary = new Dictionary<string, object>();
- public List<Export> _exports = new List<Export>();
-
- public void AddExport(string contractName, object value)
- {
- Export export = CreateExport(contractName, value);
- var exports = this._exports.ToList();
-
- exports.Add(export);
- ChangeExports(exports);
- }
-
- public void RemoveExport(string contractName)
- {
- int index = FindExport(contractName);
- Assert.IsTrue(index >= 0);
-
- var exports = this._exports.ToList();
-
- exports.RemoveAt(index);
-
- ChangeExports(exports);
- }
-
- public void ReplaceExportValue(string contractName, object newValue)
- {
- int index = FindExport(contractName);
- Assert.IsTrue(index >= 0);
-
- var exports = this._exports.ToList();
-
- exports.RemoveAt(index);
- exports.Add(CreateExport(contractName, newValue));
-
- ChangeExports(exports);
- }
-
- private void ChangeExports(List<Export> newExports)
- {
- using (var atomicComposition = new AtomicComposition())
- {
- atomicComposition.AddCompleteAction(() => this._exports = newExports);
- atomicComposition.SetValue(this, newExports);
-
- var addedExports = newExports.Except(this._exports).Select(export => export.Definition);
- var removedExports = this._exports.Except(newExports).Select(export => export.Definition);
-
- this.OnExportsChanging(new ExportsChangeEventArgs(addedExports, removedExports, atomicComposition));
-
- atomicComposition.AddCompleteAction(() => this.OnExportsChanged(
- new ExportsChangeEventArgs(addedExports, removedExports, null)));
-
- atomicComposition.Complete();
- }
- }
-
- private int FindExport(string contractName)
- {
- for (int i = 0; i < _exports.Count; i++)
- {
- if (_exports[i].Definition.ContractName == contractName)
- {
- return i;
- }
- }
- return -1;
- }
-
- private Export CreateExport(string contractName, object value)
- {
- return new Export(new ExportDefinition(contractName, EmptyMetadataDictionary), () => value);
- }
-
- protected override IEnumerable<Export> GetExportsCore(ImportDefinition importDefinition, AtomicComposition context)
- {
- IEnumerable<Export> contextExports;
-
- if (context == null || !context.TryGetValue(this, out contextExports))
- {
- contextExports = this._exports;
- }
-
- List<Export> exports = new List<Export>();
- var func = importDefinition.Constraint.Compile();
- foreach (Export export in contextExports)
- {
- if (func(export.Definition))
- {
- exports.Add(export);
- }
- }
- return exports;
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ExportProviderFactory.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ExportProviderFactory.cs deleted file mode 100644 index bce30e9ef76..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ExportProviderFactory.cs +++ /dev/null @@ -1,25 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.AttributedModel;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Hosting;
-
-namespace System.ComponentModel.Composition.Factories
-{
- internal partial class ExportProviderFactory
- {
- public static ExportProvider Create()
- {
- return new NoOverridesExportProvider();
- }
-
- public static RecomposableExportProvider CreateRecomposable()
- {
- return new RecomposableExportProvider();
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ImportDefinitionFactory.DerivedContractBasedImportDefinition.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ImportDefinitionFactory.DerivedContractBasedImportDefinition.cs deleted file mode 100644 index 422c40d8af0..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ImportDefinitionFactory.DerivedContractBasedImportDefinition.cs +++ /dev/null @@ -1,57 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition;
-using System.Collections.Generic;
-using System.Linq.Expressions;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.Factories
-{
- partial class ImportDefinitionFactory
- {
- private class DerivedContractBasedImportDefinition : ContractBasedImportDefinition
- {
- private readonly string _contractName;
- private readonly ImportCardinality _cardinality;
- private readonly bool _isRecomposable;
- private readonly bool _isPrerequisite;
- private readonly IEnumerable<KeyValuePair<string, Type>> _requiredMetadata;
-
- public DerivedContractBasedImportDefinition(string contractName, IEnumerable<KeyValuePair<string, Type>> requiredMetadata, ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite)
- {
- _contractName = contractName;
- _cardinality = cardinality;
- _isRecomposable = isRecomposable;
- _isPrerequisite = isPrerequisite;
- _requiredMetadata = requiredMetadata;
- }
-
- public override IEnumerable<KeyValuePair<string, Type>> RequiredMetadata
- {
- get { return _requiredMetadata ?? base.RequiredMetadata; }
- }
-
- public override ImportCardinality Cardinality
- {
- get { return _cardinality; }
- }
-
- public override bool IsPrerequisite
- {
- get { return _isPrerequisite; }
- }
-
- public override bool IsRecomposable
- {
- get { return _isRecomposable; }
- }
-
- public override string ContractName
- {
- get { return _contractName; }
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ImportDefinitionFactory.DerivedImportDefinition.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ImportDefinitionFactory.DerivedImportDefinition.cs deleted file mode 100644 index dbe2fb2a619..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ImportDefinitionFactory.DerivedImportDefinition.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition;
-using System.Collections.Generic;
-using System.Linq.Expressions;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.Factories
-{
- partial class ImportDefinitionFactory
- {
- private class DerivedImportDefinition : ImportDefinition
- {
- private readonly Expression<Func<ExportDefinition, bool>> _constraint;
- private readonly ImportCardinality _cardinality;
- private readonly bool _isRecomposable;
- private readonly bool _isPrerequisite;
-
- public DerivedImportDefinition(Expression<Func<ExportDefinition, bool>> constraint, ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite)
- {
- _constraint = constraint ?? (export => false);
- _cardinality = cardinality;
- _isRecomposable = isRecomposable;
- _isPrerequisite = isPrerequisite;
- }
-
- public override ImportCardinality Cardinality
- {
- get { return _cardinality; }
- }
-
- public override bool IsPrerequisite
- {
- get { return _isPrerequisite; }
- }
-
- public override bool IsRecomposable
- {
- get { return _isRecomposable; }
- }
-
- public override Expression<Func<ExportDefinition, bool>> Constraint
- {
- get { return _constraint; }
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ImportDefinitionFactory.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ImportDefinitionFactory.cs deleted file mode 100644 index 9709a852d1a..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ImportDefinitionFactory.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System;
-using System.ComponentModel.Composition;
-using System.Collections.Generic;
-using System.Linq.Expressions;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.Factories
-{
- // This class deliberately does not create instances of ImportDefinition,
- // so as to test other derived classes from ImportDefinition.
- internal static partial class ImportDefinitionFactory
- {
- public static ImportDefinition Create(string contractName)
- {
- return Create(contractName, (IEnumerable<KeyValuePair<string, Type>>)null, ImportCardinality.ExactlyOne, true, false);
- }
-
- public static ImportDefinition Create(string contractName, IEnumerable<KeyValuePair<string, Type>> requiredMetadata)
- {
- return Create(contractName, requiredMetadata, ImportCardinality.ExactlyOne, true, false);
- }
-
- public static ImportDefinition Create(string contractName, ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite)
- {
- return Create(contractName, (IEnumerable<KeyValuePair<string, Type>>)null, cardinality, isRecomposable, isPrerequisite);
- }
-
- public static ImportDefinition Create(string contractName, ImportCardinality cardinality)
- {
- return Create(contractName, (IEnumerable<KeyValuePair<string, Type>>)null, cardinality, false, false);
- }
-
- public static ImportDefinition Create(string contractName, bool isRecomposable)
- {
- return Create(contractName, (IEnumerable<KeyValuePair<string, Type>>)null, ImportCardinality.ExactlyOne, isRecomposable, false);
- }
-
- public static ImportDefinition Create(string contractName, bool isRecomposable, bool isPrerequisite)
- {
- return Create(contractName, (IEnumerable<KeyValuePair<string, Type>>)null, ImportCardinality.ExactlyOne, isRecomposable, isPrerequisite);
- }
-
- public static ImportDefinition Create(string contractName, IEnumerable<KeyValuePair<string, Type>> requiredMetadata, ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite)
- {
- return new DerivedContractBasedImportDefinition(contractName, requiredMetadata, cardinality, isRecomposable, isPrerequisite);
- }
-
- public static ImportDefinition Create()
- {
- return Create((Expression<Func<ExportDefinition, bool>>)null);
- }
-
- public static ImportDefinition Create(Expression<Func<ExportDefinition, bool>> constraint)
- {
- return Create(constraint, ImportCardinality.ExactlyOne, true, false);
- }
-
- public static ImportDefinition Create(Expression<Func<ExportDefinition, bool>> constraint, ImportCardinality cardinality)
- {
- return Create(constraint, cardinality, true, false);
- }
-
- public static ImportDefinition Create(Expression<Func<ExportDefinition, bool>> constraint, ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite)
- {
- return new DerivedImportDefinition(constraint, cardinality, isRecomposable, isPrerequisite);
- }
-
- public static ImportDefinition CreateDefault(string contractName, ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite)
- {
- return new ContractBasedImportDefinition(contractName, (string)null, (IEnumerable<KeyValuePair<string, Type>>)null, cardinality, isRecomposable, isPrerequisite, CreationPolicy.Any);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/PartDefinitionFactory.DerivedComposablePartDefinition.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/PartDefinitionFactory.DerivedComposablePartDefinition.cs deleted file mode 100644 index 09fdd205ba6..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/PartDefinitionFactory.DerivedComposablePartDefinition.cs +++ /dev/null @@ -1,71 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.Factories
-{
- partial class PartDefinitionFactory
- {
- private class DerivedComposablePartDefinition : ComposablePartDefinition
- {
- private readonly Func<ComposablePart> _partCreator;
- private readonly IDictionary<string, object> _metadata;
- private IEnumerable<ImportDefinition> _importDefinitions;
- private IEnumerable<ExportDefinition> _exportDefinitions;
- private readonly Func<IEnumerable<ImportDefinition>> _importsCreator;
- private readonly Func<IEnumerable<ExportDefinition>> _exportsCreator;
-
-
- public DerivedComposablePartDefinition(
- IDictionary<string, object> metadata,
- Func<ComposablePart> partCreator,
- Func<IEnumerable<ImportDefinition>> importsCreator,
- Func<IEnumerable<ExportDefinition>> exportsCreator)
- {
- this._metadata = metadata.AsReadOnly();
- this._partCreator = partCreator;
- this._importsCreator = importsCreator;
- this._exportsCreator = exportsCreator;
- }
-
- public override IDictionary<string, object> Metadata
- {
- get { return this._metadata; }
- }
-
- public override IEnumerable<ExportDefinition> ExportDefinitions
- {
- get
- {
- if (this._exportDefinitions == null)
- {
- this._exportDefinitions = this._exportsCreator.Invoke() ?? Enumerable.Empty<ExportDefinition>();
- }
- return this._exportDefinitions;
- }
- }
-
- public override IEnumerable<ImportDefinition> ImportDefinitions
- {
- get
- {
- if (this._importDefinitions == null)
- {
- this._importDefinitions = this._importsCreator.Invoke() ?? Enumerable.Empty<ImportDefinition>();
- }
- return this._importDefinitions;
- }
- }
-
- public override ComposablePart CreatePart()
- {
- return this._partCreator();
- }
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/PartDefinitionFactory.NoOverridesComposablePartDefinition.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/PartDefinitionFactory.NoOverridesComposablePartDefinition.cs deleted file mode 100644 index 94dbb61dea4..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/PartDefinitionFactory.NoOverridesComposablePartDefinition.cs +++ /dev/null @@ -1,35 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.Factories
-{
- partial class PartDefinitionFactory
- {
- // NOTE: Do not add any more behavior to this class, as ComposablePartDefinitionTests.cs
- // uses this to verify default behavior of the base class.
- private class NoOverridesComposablePartDefinition : ComposablePartDefinition
- {
- public override IEnumerable<ExportDefinition> ExportDefinitions
- {
- get { return Enumerable.Empty<ExportDefinition>(); }
- }
-
- public override IEnumerable<ImportDefinition> ImportDefinitions
- {
- get { return Enumerable.Empty<ImportDefinition>(); }
- }
-
- public override ComposablePart CreatePart()
- {
- Assert.Fail();
- return null;
- }
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/PartDefinitionFactory.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/PartDefinitionFactory.cs deleted file mode 100644 index bbff18c4467..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/PartDefinitionFactory.cs +++ /dev/null @@ -1,51 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.AttributedModel;
-using System.ComponentModel.Composition.ReflectionModel;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.Factories
-{
- internal static partial class PartDefinitionFactory
- {
- public static ReflectionComposablePartDefinition CreateAttributed()
- {
- return CreateAttributed(typeof(ComposablePart));
- }
-
- public static ReflectionComposablePartDefinition CreateAttributed(Type type)
- {
- return AttributedModelDiscovery.CreatePartDefinition(type, null, false, (ICompositionElement)null);
- }
-
- public static ComposablePartDefinition Create()
- {
- return new NoOverridesComposablePartDefinition();
- }
-
- public static ComposablePartDefinition Create(ComposablePart part)
- {
- return Create(part.Metadata, () => part, part.ImportDefinitions, part.ExportDefinitions);
- }
-
- public static ComposablePartDefinition Create(IDictionary<string, object> metadata,
- Func<ComposablePart> partCreator,
- IEnumerable<ImportDefinition> imports,
- IEnumerable<ExportDefinition> exports)
- {
- return Create(metadata, partCreator, () => imports, () => exports);
- }
-
- public static ComposablePartDefinition Create(IDictionary<string, object> metadata,
- Func<ComposablePart> partCreator,
- Func<IEnumerable<ImportDefinition>> importsCreator,
- Func<IEnumerable<ExportDefinition>> exportsCreator)
- {
- return new DerivedComposablePartDefinition(metadata, partCreator, importsCreator, exportsCreator);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/PartFactory.DisposableComposablePart.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/PartFactory.DisposableComposablePart.cs deleted file mode 100644 index 638a46972ba..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/PartFactory.DisposableComposablePart.cs +++ /dev/null @@ -1,69 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.Factories
-{
- partial class PartFactory
- {
- // NOTE: Do not add any more behavior to this class, as ComposablePartTests.cs
- // uses this to verify default behavior of the base class.
- private class DisposableComposablePart : ComposablePart, IDisposable
- {
- private readonly Action<bool> _disposeCallback;
-
- public DisposableComposablePart(Action<bool> disposeCallback)
- {
- Assert.IsNotNull(disposeCallback);
-
- _disposeCallback = disposeCallback;
- }
-
- public void Dispose()
- {
- this.Dispose(true);
- }
-
- ~DisposableComposablePart()
- {
- Dispose(false);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- _disposeCallback(disposing);
- }
-
- public override IEnumerable<ImportDefinition> ImportDefinitions
- {
- get { return Enumerable.Empty<ImportDefinition>(); }
- }
-
- public override IEnumerable<ExportDefinition> ExportDefinitions
- {
- get { return Enumerable.Empty<ExportDefinition>(); }
- }
-
- public override object GetExportedValue(ExportDefinition definition)
- {
- Assert.Fail();
- return null;
- }
-
- public override void SetImport(ImportDefinition definition, IEnumerable<Export> exports)
- {
- Assert.Fail();
- }
-
- public override IDictionary<string, object> Metadata
- {
- get { return new Dictionary<string, object>(); }
- }
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/PartFactory.NoOverridesComposablePart.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/PartFactory.NoOverridesComposablePart.cs deleted file mode 100644 index 27f9a3da2e1..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/PartFactory.NoOverridesComposablePart.cs +++ /dev/null @@ -1,44 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.Factories
-{
- partial class PartFactory
- {
- // NOTE: Do not add any more behavior to this class, as ComposablePartTests.cs
- // uses this to verify default behavior of the base class.
- private class NoOverridesComposablePart : ComposablePart
- {
- public NoOverridesComposablePart()
- {
- }
-
- public override IEnumerable<ExportDefinition> ExportDefinitions
- {
- get { return Enumerable.Empty<ExportDefinition>(); }
- }
-
- public override IEnumerable<ImportDefinition> ImportDefinitions
- {
- get { return Enumerable.Empty<ImportDefinition>(); }
- }
-
- public override object GetExportedValue(ExportDefinition definition)
- {
- Assert.Fail();
- return null;
- }
-
- public override void SetImport(ImportDefinition definition, IEnumerable<Export> exports)
- {
- Assert.Fail();
- }
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/PartFactory.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/PartFactory.cs deleted file mode 100644 index 44650c0ce0b..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/PartFactory.cs +++ /dev/null @@ -1,112 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.AttributedModel;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.Factories
-{
- internal static partial class PartFactory
- {
- public static Type GetAttributedExporterType()
- {
- return typeof(ExportValueTypeFactory);
- }
-
- public static ComposablePart CreateAttributed(Type type)
- {
- var definition = PartDefinitionFactory.CreateAttributed(type);
-
- return definition.CreatePart();
- }
-
- public static ComposablePart CreateAttributed(object instance)
- {
- return AttributedModelServices.CreatePart(instance);
- }
-
- public static ComposablePart Create()
- {
- return new NoOverridesComposablePart();
- }
-
- public static ComposablePart CreateExporter(string contractName, object value)
- {
- return CreateExporter(new MicroExport(contractName, value));
- }
-
- public static ComposablePart CreateExporter(params MicroExport[] exports)
- {
- ConcreteComposablePart part = new ConcreteComposablePart();
-
- if (exports != null)
- {
- foreach (var export in exports)
- {
- foreach (object exportedValue in export.ExportedValues)
- {
- part.AddExport(ExportFactory.Create(export.ContractName, exportedValue, export.Metadata));
- }
- }
- }
-
- return part;
- }
-
- public static ImportingComposablePart CreateImporter<T>()
- {
- string contractName = AttributedModelServices.GetContractName(typeof(T));
-
- return CreateImporter(contractName);
- }
-
- public static ImportingComposablePart CreateImporterExporter(string exportContractName, string importContractName)
- {
- return new ImportingComposablePart(exportContractName, ImportCardinality.ExactlyOne, false, importContractName);
- }
-
- public static ImportingComposablePart CreateImporter(params string[] contractNames)
- {
- return new ImportingComposablePart(ImportCardinality.ZeroOrMore, false, contractNames);
- }
-
- public static ImportingComposablePart CreateImporter(bool isRecomposable, params string[] contractNames)
- {
- return new ImportingComposablePart(ImportCardinality.ZeroOrMore, isRecomposable, contractNames);
- }
-
- public static ImportingComposablePart CreateImporter(string contractName)
- {
- return CreateImporter(contractName, ImportCardinality.ZeroOrMore);
- }
-
- public static ImportingComposablePart CreateImporter(string contractName, bool isRecomposable)
- {
- return CreateImporter(contractName, ImportCardinality.ZeroOrMore, isRecomposable);
- }
-
- public static ImportingComposablePart CreateImporter(string contractName, ImportCardinality cardinality)
- {
- return CreateImporter(contractName, cardinality, false);
- }
-
- public static ImportingComposablePart CreateImporter(string contractName, ImportCardinality cardinality, bool isRecomposable)
- {
- return new ImportingComposablePart(cardinality, isRecomposable, contractName);
- }
-
- public static ImportingComposablePart CreateImporter(params ImportDefinition[] importDefinitions)
- {
- return new ImportingComposablePart(importDefinitions);
- }
-
- public static ComposablePart CreateDisposable(Action<bool> disposeCallback)
- {
- return new DisposableComposablePart(disposeCallback);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ReflectionFactory.MockParameterInfo.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ReflectionFactory.MockParameterInfo.cs deleted file mode 100644 index 76e80525442..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ReflectionFactory.MockParameterInfo.cs +++ /dev/null @@ -1,51 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.AttributedModel;
-using System.Reflection;
-using System.Linq;
-
-namespace System.ComponentModel.Composition.Factories
-{
- partial class ReflectionFactory
- {
- private class MockParameterInfo : ParameterInfo
- {
- private readonly string _name;
- private readonly Type _parameterType = typeof(string);
-
- public MockParameterInfo(Type parameterType)
- {
- _parameterType = parameterType;
- }
-
- public MockParameterInfo(string name)
- {
- _name = name;
- }
-
- public override string Name
- {
- get { return _name; }
- }
-
- public override Type ParameterType
- {
- get { return _parameterType; }
- }
-
- public override MemberInfo Member
- {
- get { return typeof(object).GetConstructors().First(); }
- }
-
- public override object[] GetCustomAttributes(Type attributeType, bool inherit)
- {
- return (object[])Array.CreateInstance(attributeType, 0);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ReflectionFactory.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ReflectionFactory.cs deleted file mode 100644 index 76d13ee019d..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Factories/ReflectionFactory.cs +++ /dev/null @@ -1,29 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.AttributedModel;
-using System.Reflection;
-
-namespace System.ComponentModel.Composition.Factories
-{
- internal static partial class ReflectionFactory
- {
- public static ParameterInfo CreateParameter()
- {
- return CreateParameter((string)null);
- }
-
- public static ParameterInfo CreateParameter(Type parameterType)
- {
- return new MockParameterInfo(parameterType);
- }
-
- public static ParameterInfo CreateParameter(string name)
- {
- return new MockParameterInfo(name);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/GenerationServicesTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/GenerationServicesTests.cs deleted file mode 100644 index b1bfe9251e3..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/GenerationServicesTests.cs +++ /dev/null @@ -1,175 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Reflection.Emit;
-using System.Reflection;
-using System.ComponentModel.Composition;
-using System.UnitTesting;
-using Microsoft.Internal;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.UnitTesting;
-
-namespace Microsoft.Internal
-{
- [TestClass]
- public class GenerationServicesTests
- {
- // Has to be public, otherwise the dynamic method doesn't see it
- public enum TestEnum
- {
- First = 1,
- Second = 2
- }
-
- public static class DelegateTestClass
- {
- public static int Method(int i)
- {
- return i;
- }
- }
-
- private Func<T> CreateValueGenerator<T>(T value)
- {
- DynamicMethod methodBuilder = new DynamicMethod(TestServices.GenerateRandomString(), typeof(T), Type.EmptyTypes);
- // Generate the method body that simply returns the dictionary
- ILGenerator ilGenerator = methodBuilder.GetILGenerator();
- GenerationServices.LoadValue(ilGenerator, value);
- ilGenerator.Emit(OpCodes.Ret);
- return (Func<T>)methodBuilder.CreateDelegate(typeof(Func<T>));
- }
-
- private void TestSuccessfulValueGeneration<T>(T value)
- {
- Func<T> result = this.CreateValueGenerator<T>(value);
- T generatedValue = result.Invoke();
- Assert.AreEqual(value, generatedValue);
- }
-
- private void TestSuccessfulDictionaryGeneration(IDictionary<string, object> dictionary)
- {
- Func<IDictionary<string, object>> result = this.CreateValueGenerator<IDictionary<string, object>>(dictionary);
- IDictionary<string, object> generatedDictionary = result.Invoke();
- EnumerableAssert.AreEqual(dictionary, generatedDictionary);
- }
-
- private void TestSuccessfulEnumerableGeneration<T>(IEnumerable enumerable)
- {
- Func<IEnumerable> result = this.CreateValueGenerator<IEnumerable>(enumerable);
- IEnumerable generatedEnumerable = result.Invoke();
- Assert.IsTrue(generatedEnumerable.Cast<T>().SequenceEqual(enumerable.Cast<T>()));
- }
-
- [TestMethod]
- public void PrimitiveTypes()
- {
- this.TestSuccessfulValueGeneration(Char.MinValue);
- this.TestSuccessfulValueGeneration(Char.MaxValue);
- this.TestSuccessfulValueGeneration((Char)42);
-
- this.TestSuccessfulValueGeneration(true);
- this.TestSuccessfulValueGeneration(false);
-
- this.TestSuccessfulValueGeneration(Byte.MinValue);
- this.TestSuccessfulValueGeneration(Byte.MaxValue);
- this.TestSuccessfulValueGeneration((Byte)42);
-
- this.TestSuccessfulValueGeneration(SByte.MinValue);
- this.TestSuccessfulValueGeneration(SByte.MaxValue);
- this.TestSuccessfulValueGeneration((SByte)42);
-
- this.TestSuccessfulValueGeneration(Int16.MinValue);
- this.TestSuccessfulValueGeneration(Int16.MaxValue);
- this.TestSuccessfulValueGeneration((Int16)42);
-
- this.TestSuccessfulValueGeneration(UInt16.MinValue);
- this.TestSuccessfulValueGeneration(UInt16.MaxValue);
- this.TestSuccessfulValueGeneration((UInt16)42);
-
- this.TestSuccessfulValueGeneration(Int32.MinValue);
- this.TestSuccessfulValueGeneration(Int32.MaxValue);
- this.TestSuccessfulValueGeneration((Int32)42);
-
- this.TestSuccessfulValueGeneration(UInt32.MinValue);
- this.TestSuccessfulValueGeneration(UInt32.MaxValue);
- this.TestSuccessfulValueGeneration((UInt32)42);
-
- this.TestSuccessfulValueGeneration(Int64.MinValue);
- this.TestSuccessfulValueGeneration(Int64.MaxValue);
- this.TestSuccessfulValueGeneration((Int64)42);
-
- this.TestSuccessfulValueGeneration(UInt64.MinValue);
- this.TestSuccessfulValueGeneration(UInt64.MaxValue);
- this.TestSuccessfulValueGeneration((UInt64)42);
-
- this.TestSuccessfulValueGeneration(Single.MinValue);
- this.TestSuccessfulValueGeneration(Single.MaxValue);
- this.TestSuccessfulValueGeneration((Single)42.42);
-
- this.TestSuccessfulValueGeneration(Double.MinValue);
- this.TestSuccessfulValueGeneration(Double.MaxValue);
- this.TestSuccessfulValueGeneration((Double)42.42);
- }
-
- [TestMethod]
- public void StringType()
- {
- this.TestSuccessfulValueGeneration("42");
- }
-
- [TestMethod]
- public void EnumType()
- {
- this.TestSuccessfulValueGeneration(TestEnum.Second);
- }
-
-
- [TestMethod]
- public void TypeType()
- {
- this.TestSuccessfulValueGeneration(typeof(TestEnum));
- }
-
- [TestMethod]
- public void PrimitiveTypeEnumerable()
- {
- int[] enumerable = new int[] { 1, 2, 3, 4, 5 };
- this.TestSuccessfulEnumerableGeneration<int>(enumerable);
- }
-
- [TestMethod]
- public void StringTypeEnumerable()
- {
- string[] enumerable = new string[] { "1", "2", "3", "4", "5" };
- this.TestSuccessfulEnumerableGeneration<string>(enumerable);
- }
-
- [TestMethod]
- [Ignore]
- [WorkItem(507696)]
- public void EnumTypeEnumerable()
- {
- TestEnum[] enumerable = new TestEnum[] { TestEnum.First, TestEnum.Second };
- this.TestSuccessfulEnumerableGeneration<string>(enumerable);
- }
-
-
- [TestMethod]
- public void MixedEnumerable()
- {
- List<object> list = new List<object>();
- list.Add(42);
- list.Add("42");
- list.Add(typeof(TestEnum));
- list.Add(TestEnum.Second);
- list.Add(null);
-
- this.TestSuccessfulEnumerableGeneration<object>(list);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/.gitattributes deleted file mode 100644 index 03c19e8d87a..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/.gitattributes +++ /dev/null @@ -1,10 +0,0 @@ -/AggregateCatalogTest.cs -crlf -/AssemblyCatalogDebuggerProxyTests.cs -crlf -/AssemblyCatalogTests.cs -crlf -/CatalogExportProviderTests.cs -crlf -/CompositionBatchTests.cs -crlf -/CompositionTransactionTests.cs -crlf -/DirectoryCatalogDebuggerProxyTests.cs -crlf -/DirectoryCatalogTests.cs -crlf -/ImportEngineTests.cs -crlf -/TypeCatalogTests.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/AggregateCatalogTest.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/AggregateCatalogTest.cs deleted file mode 100644 index 4e2d5cacaa3..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/AggregateCatalogTest.cs +++ /dev/null @@ -1,980 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.IO;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Threading;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- [TestClass]
- public class AggregateCatalogTest
- {
- [TestMethod]
- public void Constructor1_ShouldNotThrow()
- {
- new AggregateCatalog();
- }
-
-
- [TestMethod]
- public void Constructor1_ShouldSetCatalogsPropertyToEmpty()
- {
- var catalog = new AggregateCatalog();
-
- EnumerableAssert.IsEmpty(catalog.Catalogs);
- }
-
- [TestMethod]
- [Ignore]
- [WorkItem(812029)]
- public void Constructor1_ShouldSetPartsPropertyToEmpty()
- {
- var catalog = new AggregateCatalog();
-
- EnumerableAssert.IsEmpty(catalog.Parts);
- }
-
- [TestMethod]
- public void Constructor3_NullAsCatalogsArgument_ShouldSetCatalogsPropertyToEmpty()
- {
- var catalog = new AggregateCatalog((IEnumerable<ComposablePartCatalog>)null);
-
- EnumerableAssert.IsEmpty(catalog.Catalogs);
- }
-
- [TestMethod]
- public void Constructor3_EmptyIEnumerableAsCatalogsArgument_ShouldSetCatalogsPropertyToEmpty()
- {
- var catalog = new AggregateCatalog(Enumerable.Empty<ComposablePartCatalog>());
-
- EnumerableAssert.IsEmpty(catalog.Catalogs);
- }
-
- [TestMethod]
- [Ignore]
- [WorkItem(812029)]
- public void Constructor3_NullAsCatalogsArgument_ShouldSetPartsPropertyToEmpty()
- {
- var catalog = new AggregateCatalog((IEnumerable<ComposablePartCatalog>)null);
-
- EnumerableAssert.IsEmpty(catalog.Parts);
- }
-
- [TestMethod]
- [Ignore]
- [WorkItem(812029)]
- public void Constructor3_EmptyIEnumerableAsCatalogsArgument_ShouldSetPartsPropertyToEmpty()
- {
- var catalog = new AggregateCatalog(Enumerable.Empty<ComposablePartCatalog>());
-
- EnumerableAssert.IsEmpty(catalog.Parts);
- }
-
- [TestMethod]
- public void Constructor3_ArrayWithNullAsCatalogsArgument_ShouldThrowArgument()
- {
- var catalogs = new ComposablePartCatalog[] { null };
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("catalogs", () =>
- {
- new AggregateCatalog(catalogs);
- });
- }
-
- [TestMethod]
- public void Catalogs_WhenCatalogDisposed_ShouldThrowObjectDisposed()
- {
- var catalog = CreateAggregateCatalog();
- catalog.Dispose();
-
- ExceptionAssert.ThrowsDisposed(catalog, () =>
- {
- var catalogs = catalog.Catalogs;
- });
- }
-
- [TestMethod]
- public void Parts_WhenCatalogDisposed_ShouldThrowObjectDisposed()
- {
- var catalog = CreateAggregateCatalog();
- catalog.Dispose();
-
- ExceptionAssert.ThrowsDisposed(catalog, () =>
- {
- var parts = catalog.Parts;
- });
- }
-
- [TestMethod]
- public void GetExports_WhenCatalogDisposed_ShouldThrowObjectDisposed()
- {
- var catalog = CreateAggregateCatalog();
- catalog.Dispose();
- var definition = ImportDefinitionFactory.Create();
-
- ExceptionAssert.ThrowsDisposed(catalog, () =>
- {
- catalog.GetExports(definition);
- });
- }
-
- [TestMethod]
- public void GetExports_NullAsConstraintArgument_ShouldThrowArgumentNull()
- {
- var catalog = CreateAggregateCatalog();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("definition", () =>
- {
- catalog.GetExports((ImportDefinition)null);
- });
- }
-
- [TestMethod]
- public void Dispose_ShouldNotThrow()
- {
- using (var catalog = CreateAggregateCatalog())
- {
- }
- }
-
- [TestMethod]
- public void Dispose_CanBeCalledMultipleTimes()
- {
- var catalog = CreateAggregateCatalog();
- catalog.Dispose();
- catalog.Dispose();
- catalog.Dispose();
- }
-
-
- [TestMethod]
- public void MutableCatalogNotifications()
- {
- int step = 0;
- int changedStep = 0;
- var catalog = new AggregateCatalog();
-
- var typePartCatalog = new TypeCatalog(typeof(SharedPartStuff));
- var typePartCatalog1 = new TypeCatalog(typeof(SharedPartStuff));
- var typePartCatalog2 = new TypeCatalog(typeof(SharedPartStuff));
- var typePartCatalog3 = new TypeCatalog(typeof(SharedPartStuff));
- var typePartCatalog4 = new TypeCatalog(typeof(SharedPartStuff));
- var typePartCatalog5 = new TypeCatalog(typeof(SharedPartStuff));
-
- // Smoke test on inner collection
- catalog.Catalogs.Add(typePartCatalog);
- catalog.Catalogs.Remove(typePartCatalog);
- catalog.Catalogs.Clear();
- Assert.IsTrue(catalog.Catalogs.Count == 0, "Add/Remove/Clear -- PartsAsCollection.Count is now 0");
-
- // Add notifications
- catalog.Changed += delegate(object source, ComposablePartCatalogChangeEventArgs args)
- {
- // Local code
- ++step; ++step;
- changedStep = step;
- };
-
- //Add something then verify counters
- catalog.Catalogs.Add(typePartCatalog);
- Assert.IsTrue(catalog.Catalogs.Count == 1, "Add -- Catalogs.Count is now 1");
- Assert.IsTrue(changedStep == 2, "Add -- Changed must be fired after");
-
- // Reset counters
- step = changedStep = 0;
-
- // Remove something then verify counters
- catalog.Catalogs.Remove(typePartCatalog);
- Assert.IsTrue(catalog.Catalogs.Count == 0, "Add -- Catalogs.Count is now 0");
- Assert.IsTrue(changedStep == 2, "Remove -- Changed must be fired after");
-
-
- //Now Add it back
- catalog.Catalogs.Add(typePartCatalog);
- Assert.IsTrue(catalog.Catalogs.Count == 1, "Add -- Catalogs.Count is now 1");
-
- step = changedStep = 0;
- // Now clear the collection and verify counters
- catalog.Catalogs.Clear();
- Assert.IsTrue(catalog.Catalogs.Count == 0, "Add -- Catalogs.Count is now 0");
- Assert.IsTrue(changedStep == 2, "Remove -- Changed must be fired after");
-
- // Now remove a non existent item and verify counters
- step = changedStep = 0;
- bool removed = catalog.Catalogs.Remove(typePartCatalog);
- Assert.IsTrue(removed == false, "Remove -- correctly returned false");
- Assert.IsTrue(changedStep == 0, "Remove -- Changed should not fire if nothing changed");
-
- // Add a bunch
- step = changedStep = 0;
- catalog.Catalogs.Add(typePartCatalog);
- Assert.IsTrue(catalog.Catalogs.Count == 1, "Add -- Catalogs.Count is now 1");
- Assert.IsTrue(changedStep == 2, "Add -- Changed must be fired after");
-
- catalog.Catalogs.Add(typePartCatalog1);
- Assert.IsTrue(catalog.Catalogs.Count == 2, "Add -- Catalogs.Count is now 1");
- Assert.IsTrue(changedStep == 4, "Add -- Changing must be fired after");
-
- catalog.Catalogs.Add(typePartCatalog2);
- catalog.Catalogs.Add(typePartCatalog3);
- catalog.Catalogs.Add(typePartCatalog4);
- catalog.Catalogs.Add(typePartCatalog5);
- Assert.IsTrue(catalog.Catalogs.Count == 6, "Add -- Catalogs.Count is now 1");
- Assert.IsTrue(changedStep == 12, "Add -- Changing must be fired after");
-
- removed = catalog.Catalogs.Remove(typePartCatalog3);
- Assert.IsTrue(catalog.Catalogs.Count == 5, "Add -- Catalogs.Count is now 5");
- Assert.IsTrue(removed == true, "Remove should have succeeded");
- Assert.IsTrue(changedStep == 14, "Remove -- Changed must be fired after");
- removed = catalog.Catalogs.Remove(typePartCatalog2);
- removed = catalog.Catalogs.Remove(typePartCatalog1);
- removed = catalog.Catalogs.Remove(typePartCatalog4);
- removed = catalog.Catalogs.Remove(typePartCatalog);
- removed = catalog.Catalogs.Remove(typePartCatalog5);
- Assert.IsTrue(catalog.Catalogs.Count == 0, "Add -- Catalogs.Count is now 0");
- Assert.IsTrue(removed == true, "Remove should have succeeded");
- Assert.IsTrue(changedStep == 24, "Remove -- Changing must be fired after");
-
- // Add and then clear a lot
- step = changedStep = 0;
- catalog.Catalogs.Add(typePartCatalog);
- catalog.Catalogs.Add(typePartCatalog1);
- catalog.Catalogs.Add(typePartCatalog2);
- catalog.Catalogs.Add(typePartCatalog3);
- catalog.Catalogs.Add(typePartCatalog4);
- catalog.Catalogs.Add(typePartCatalog5);
- Assert.IsTrue(catalog.Catalogs.Count == 6, "Add -- Catalogs.Count should be 6");
- Assert.IsTrue(changedStep == 12, "Add -- Changing must be fired after");
-
- catalog.Catalogs.Clear();
- Assert.IsTrue(catalog.Catalogs.Count == 0, "Add -- Catalogs.Count should be 0");
-
- step = changedStep = 0;
- int step2 = 100;
- int changedStep2 = 0;
-
- catalog.Changed += delegate(object source, ComposablePartCatalogChangeEventArgs args)
- {
- // Local code
- --step2; --step2;
- changedStep2 = step2;
- };
-
- catalog.Catalogs.Add(typePartCatalog);
- Assert.IsTrue(catalog.Catalogs.Count == 1, "Add -- Catalogs.Count is now 1");
- Assert.IsTrue(changedStep == 2, "Add handler 1 -- Changed must be fired after");
- Assert.IsTrue(changedStep2 == 98, "Add handler 2 -- Changed must be fired after");
-
- catalog.Catalogs.Add(typePartCatalog1);
- Assert.IsTrue(catalog.Catalogs.Count == 2, "Add -- Catalogs.Count is now 1");
- Assert.IsTrue(changedStep == 4, "Add handler 1 -- Changed must be fired after");
- Assert.IsTrue(changedStep2 == 96, "Add handler 2 -- Changed must be firedafter");
-
- catalog.Catalogs.Remove(typePartCatalog);
- Assert.IsTrue(catalog.Catalogs.Count == 1, "Add -- PartsAsCollection.Count is now 1");
- Assert.IsTrue(changedStep == 6, "Add handler 1 -- Changed must be fired and fired after");
- Assert.IsTrue(changedStep2 == 94, "Add handler 2 -- Changed must be fired and fired after");
-
- catalog.Catalogs.Clear();
- Assert.IsTrue(catalog.Catalogs.Count == 0, "Add -- PartsAsCollection.Count is now 0");
- Assert.IsTrue(changedStep == 8, "Add handler 1 -- Changed must be fired after");
- Assert.IsTrue(changedStep2 == 92, "Add handler 2 -- Changed must be fired after");
-
- }
-
- [TestMethod]
- public void DisposeAggregatingCatalog()
- {
- int changedNotification = 0;
-
- var typePartCatalog1 = new TypeCatalog(typeof(SharedPartStuff));
- var typePartCatalog2 = new TypeCatalog(typeof(SharedPartStuff));
- var typePartCatalog3 = new TypeCatalog(typeof(SharedPartStuff));
-
- var assemblyPartCatalog1 = new AssemblyCatalog(typeof(SharedPartStuff).Assembly);
- var assemblyPartCatalog2 = new AssemblyCatalog(typeof(SharedPartStuff).Assembly);
- var assemblyPartCatalog3 = new AssemblyCatalog(typeof(SharedPartStuff).Assembly);
-
-#if !SILVERLIGHT
- var dirPartCatalog1 = new DirectoryCatalog(FileIO.GetRootTemporaryDirectory());
- var dirPartCatalog2 = new DirectoryCatalog(FileIO.GetRootTemporaryDirectory());
- var dirPartCatalog3 = new DirectoryCatalog(FileIO.GetRootTemporaryDirectory());
-#endif
- using (var catalog = new AggregateCatalog())
- {
- catalog.Catalogs.Add(typePartCatalog1);
- catalog.Catalogs.Add(typePartCatalog2);
- catalog.Catalogs.Add(typePartCatalog3);
-
- catalog.Catalogs.Add(assemblyPartCatalog1);
- catalog.Catalogs.Add(assemblyPartCatalog2);
- catalog.Catalogs.Add(assemblyPartCatalog3);
-
-#if !SILVERLIGHT
- catalog.Catalogs.Add(dirPartCatalog1);
- catalog.Catalogs.Add(dirPartCatalog2);
- catalog.Catalogs.Add(dirPartCatalog3);
-#endif
-
- // Add notifications
- catalog.Changed += delegate(object source, ComposablePartCatalogChangeEventArgs args)
- {
- // Local code
- ++changedNotification;
- };
-
- }
-
- Assert.IsTrue(changedNotification == 0, "No changed notifications");
-
- //Ensure that the other catalogs are
- ExceptionAssert.ThrowsDisposed(typePartCatalog1, () =>
- {
- var iEnum = typePartCatalog1.Parts.GetEnumerator();
- });
-
- ExceptionAssert.ThrowsDisposed(typePartCatalog2, () =>
- {
- var iEnum = typePartCatalog2.Parts.GetEnumerator();
- });
-
- ExceptionAssert.ThrowsDisposed(typePartCatalog3, () =>
- {
- var iEnum = typePartCatalog3.Parts.GetEnumerator();
- });
-
- //Ensure that the other catalogs are
- ExceptionAssert.ThrowsDisposed(assemblyPartCatalog1, () =>
- {
- var iEnum = assemblyPartCatalog1.Parts.GetEnumerator();
- });
-
- ExceptionAssert.ThrowsDisposed(assemblyPartCatalog2, () =>
- {
- var iEnum = assemblyPartCatalog2.Parts.GetEnumerator();
- });
-
- ExceptionAssert.ThrowsDisposed(assemblyPartCatalog3, () =>
- {
- var iEnum = assemblyPartCatalog3.Parts.GetEnumerator();
- });
-
-#if !SILVERLIGHT
- //Ensure that the other catalogs are
- ExceptionAssert.ThrowsDisposed(dirPartCatalog1, () =>
- {
- var iEnum = dirPartCatalog1.Parts.GetEnumerator();
- });
-
- ExceptionAssert.ThrowsDisposed(dirPartCatalog2, () =>
- {
- var iEnum = dirPartCatalog2.Parts.GetEnumerator();
- });
-
- ExceptionAssert.ThrowsDisposed(dirPartCatalog3, () =>
- {
- var iEnum = dirPartCatalog3.Parts.GetEnumerator();
- });
-#endif
- }
-
- [TestMethod]
- [Ignore]
- [WorkItem(514749)]
- public void MutableMultithreadedEnumerations()
- {
- var catalog = new AggregateCatalog();
-
- ThreadStart func = delegate()
- {
- var typePart = new TypeCatalog(typeof(SharedPartStuff));
- var typePart1 = new TypeCatalog(typeof(SharedPartStuff));
- var typePart2 = new TypeCatalog(typeof(SharedPartStuff));
- var typePart3 = new TypeCatalog(typeof(SharedPartStuff));
- var typePart4 = new TypeCatalog(typeof(SharedPartStuff));
- var typePart5 = new TypeCatalog(typeof(SharedPartStuff));
-
- for (int i = 0; i < 100; i++)
- {
- catalog.Catalogs.Add(typePart);
- catalog.Catalogs.Add(typePart1);
- catalog.Catalogs.Add(typePart2);
- catalog.Catalogs.Add(typePart3);
- catalog.Catalogs.Add(typePart4);
- catalog.Catalogs.Add(typePart5);
-
- Assert.IsTrue(catalog.Catalogs.Count >= 6, "Catalogs Collection must be at least 6 big");
-
- for (int k = 0; k < 5; k++)
- {
- int j;
- // Ensure that iterating the returned queryable is okay even though there are many threads mutationg it
- // We are really just looking to ensure that ollection changed exceptions are not thrown
- j = 0;
- var iq = catalog.Parts.GetEnumerator();
- while (iq.MoveNext())
- {
- ++j;
- }
-
- Assert.IsTrue(j >= 6, "Catalogs Collection must be at least 6 big");
-
- // Ensure that iterating the returned enumerator is okay even though there are many threads mutationg it
- // We are really just looking to ensure that collection changed exceptions are not thrown
- j = 0;
- var ie = catalog.Catalogs.GetEnumerator();
- while (ie.MoveNext())
- {
- ++j;
- }
- Assert.IsTrue(j >= 6, "Catalogs Collection must be at least 6 big");
- }
-
-
- catalog.Catalogs.Remove(typePart);
- catalog.Catalogs.Remove(typePart1);
- catalog.Catalogs.Remove(typePart2);
- catalog.Catalogs.Remove(typePart3);
- catalog.Catalogs.Remove(typePart4);
- catalog.Catalogs.Remove(typePart5);
- }
- };
-
- Thread[] threads = new Thread[100];
- for (int i = 0; i < threads.Length; i++)
- {
- threads[i] = new Thread(func);
- }
-
- for (int i = 0; i < threads.Length; i++)
- {
- threads[i].Start();
- }
- for (int i = 0; i < threads.Length; i++)
- {
- threads[i].Join();
- }
-
- Assert.IsTrue(catalog.Catalogs.Count == 0, "Collection must be empty");
- }
-
-
- public void CreateMainAndOtherChildren(
- out AggregateCatalog[] mainChildren,
- out AggregateCatalog[] otherChildren,
- out TypeCatalog[] componentCatalogs)
- {
- componentCatalogs = new TypeCatalog[]
- {
- new TypeCatalog(typeof(SharedPartStuff)),
- new TypeCatalog(typeof(SharedPartStuff)),
- new TypeCatalog(typeof(SharedPartStuff))
- };
-
- // Create our child catalogs
- mainChildren = new AggregateCatalog[5];
- for (int i = 0; i < mainChildren.Length; i++)
- {
- mainChildren[i] = new AggregateCatalog(componentCatalogs);
- }
-
- otherChildren = new AggregateCatalog[5];
- for (int i = 0; i < otherChildren.Length; i++)
- {
- otherChildren[i] = new AggregateCatalog(componentCatalogs);
- }
- }
-
- [TestMethod]
- [Ignore]
- [WorkItem(812029)]
- public void AggregatingCatalogAddAndRemoveChildren()
- {
- int changedCount = 0;
- int typesChanged = 0;
- EventHandler<ComposablePartCatalogChangeEventArgs> onChanged = delegate(object sender, ComposablePartCatalogChangeEventArgs e)
- {
- ++changedCount;
- typesChanged += e.AddedDefinitions.Concat(e.RemovedDefinitions).Count();
- };
-
- // Create our child catalogs
- AggregateCatalog[] mainChildren;
- AggregateCatalog[] otherChildren;
- TypeCatalog[] componentCatalogs;
-
- CreateMainAndOtherChildren(out mainChildren, out otherChildren, out componentCatalogs);
-
- var parent = new AggregateCatalog(mainChildren);
- parent.Changed += onChanged;
-
- for (int i = 0; i < otherChildren.Length; i++)
- {
- parent.Catalogs.Add(otherChildren[i]);
- }
-
- Assert.AreEqual(otherChildren.Length, changedCount);
- Assert.AreEqual(otherChildren.Length * 3, typesChanged);
-
- changedCount = 0;
- typesChanged = 0;
-
- parent.Catalogs.Remove(otherChildren[0]);
- parent.Catalogs.Remove(otherChildren[1]);
-
- Assert.AreEqual(2, changedCount);
- Assert.AreEqual(2 * 3, typesChanged);
-
- changedCount = 0;
- typesChanged = 0;
-
- parent.Catalogs.Add(otherChildren[0]);
- parent.Catalogs.Add(otherChildren[1]);
-
- Assert.AreEqual(2, changedCount);
- Assert.AreEqual(2 * 3, typesChanged);
-
- changedCount = 0;
- typesChanged = 0;
-
- parent.Catalogs.Clear();
- Assert.AreEqual(1, changedCount);
- Assert.AreEqual((mainChildren.Length + otherChildren.Length) * 3, typesChanged);
-
- changedCount = 0;
- typesChanged = 0;
-
- // These have already been removed and so I should be able remove components from them without recieving notifications
- otherChildren[0].Catalogs.Remove(componentCatalogs[0]);
- otherChildren[1].Catalogs.Remove(componentCatalogs[1]);
- Assert.AreEqual(0, changedCount);
- Assert.AreEqual(0, typesChanged);
-
- // These have already been Cleared and so I should be able remove components from them without recieving notifications
- otherChildren[3].Catalogs.Remove(componentCatalogs[0]);
- otherChildren[4].Catalogs.Remove(componentCatalogs[1]);
- Assert.AreEqual(0, changedCount);
- }
-
- [TestMethod]
- [Ignore]
- [WorkItem(812029)]
- public void AggregatingCatalogAddAndRemoveNestedChildren()
- {
- int changedCount = 0;
- int typesChanged = 0;
-
- EventHandler<ComposablePartCatalogChangeEventArgs> onChanged = delegate(object sender, ComposablePartCatalogChangeEventArgs e)
- {
- ++changedCount;
- typesChanged += e.AddedDefinitions.Concat(e.RemovedDefinitions).Count();
- };
-
- // Create our child catalogs
- AggregateCatalog[] mainChildren;
- AggregateCatalog[] otherChildren;
- TypeCatalog[] componentCatalogs;
- CreateMainAndOtherChildren(out mainChildren, out otherChildren, out componentCatalogs);
-
-
- var parent = new AggregateCatalog(mainChildren);
- parent.Changed += onChanged;
-
- for (int i = 0; i < otherChildren.Length; i++)
- {
- parent.Catalogs.Add(otherChildren[i]);
- }
-
- Assert.AreEqual(otherChildren.Length, changedCount);
- Assert.AreEqual(otherChildren.Length * 3, typesChanged);
-
- changedCount = 0;
- typesChanged = 0;
-
- otherChildren[0].Catalogs.Remove(componentCatalogs[0]);
- otherChildren[1].Catalogs.Remove(componentCatalogs[1]);
-
- Assert.AreEqual(2, changedCount);
- Assert.AreEqual(2, typesChanged);
-
- changedCount = 0;
- typesChanged = 0;
-
- otherChildren[0].Catalogs.Add(componentCatalogs[0]);
- otherChildren[1].Catalogs.Add(componentCatalogs[1]);
-
- Assert.AreEqual(2, changedCount);
- Assert.AreEqual(2, typesChanged);
-
- changedCount = 0;
- typesChanged = 0;
- otherChildren[1].Catalogs.Clear();
- Assert.AreEqual(1, changedCount);
- Assert.AreEqual(componentCatalogs.Length, typesChanged);
- }
-
- [TestMethod]
- [Ignore]
- [WorkItem(812029)]
- public void AggregatingDisposedAndNotifications()
- {
- int changedCount = 0;
- int typesChanged = 0;
-
- EventHandler<ComposablePartCatalogChangeEventArgs> onChanged = delegate(object sender, ComposablePartCatalogChangeEventArgs e)
- {
- ++changedCount;
- typesChanged += e.AddedDefinitions.Concat(e.RemovedDefinitions).Count();
- };
-
- // Create our child catalogs
- AggregateCatalog[] mainChildren;
- AggregateCatalog[] otherChildren;
- TypeCatalog[] componentCatalogs;
- CreateMainAndOtherChildren(out mainChildren, out otherChildren, out componentCatalogs);
-
-
- var parent = new AggregateCatalog(mainChildren);
- parent.Changed += onChanged;
-
- for (int i = 0; i < otherChildren.Length; i++)
- {
- parent.Catalogs.Add(otherChildren[i]);
- }
-
- Assert.AreEqual(otherChildren.Length, changedCount);
- Assert.AreEqual(otherChildren.Length * 3, typesChanged);
-
- changedCount = 0;
- typesChanged = 0;
-
- parent.Dispose();
-
- Assert.AreEqual(0, changedCount);
- Assert.AreEqual(0, typesChanged);
-
- //Ensure that the children are also disposed
- ExceptionAssert.ThrowsDisposed(otherChildren[0], () =>
- {
- otherChildren[0].Catalogs.Remove(componentCatalogs[0]);
- });
-
- //Ensure that the children are also disposed
- ExceptionAssert.ThrowsDisposed(otherChildren[4], () =>
- {
- otherChildren[4].Catalogs.Remove(componentCatalogs[0]);
- });
-
- Assert.AreEqual(0, changedCount);
- Assert.AreEqual(0, typesChanged);
- }
-
- [TestMethod]
- public void AggregatingCatalogParmsConstructorAggregateAggregateCatalogs()
- {
- var aggCatalog1 = new AggregateCatalog();
- var aggCatalog2 = new AggregateCatalog();
- var aggCatalog3 = new AggregateCatalog();
-
- // Construct with one catalog parameter
- var catalog = new AggregateCatalog(aggCatalog1);
- Assert.IsTrue(catalog.Catalogs.Count == 1);
-
- // Construct with two catalog parameters
- catalog = new AggregateCatalog(aggCatalog1, aggCatalog2);
- Assert.IsTrue(catalog.Catalogs.Count == 2);
-
- // Construct with three catalog parameters
- catalog = new AggregateCatalog(aggCatalog1, aggCatalog2, aggCatalog3);
- Assert.IsTrue(catalog.Catalogs.Count == 3);
- }
-
-
- [TestMethod]
- public void AggregatingCatalogParmsConstructorAggregateAssemblyCatalogs()
- {
- var assemblyCatalog1 = new AssemblyCatalog(typeof(SharedPartStuff).Assembly);
- var assemblyCatalog2 = new AssemblyCatalog(typeof(SharedPartStuff).Assembly);
- var assemblyCatalog3 = new AssemblyCatalog(typeof(SharedPartStuff).Assembly);
-
- // Construct with one catalog parameter
- var catalog = new AggregateCatalog(assemblyCatalog1);
- Assert.IsTrue(catalog.Catalogs.Count == 1);
-
- // Construct with two catalog parameters
- catalog = new AggregateCatalog(assemblyCatalog1, assemblyCatalog2);
- Assert.IsTrue(catalog.Catalogs.Count == 2);
-
- // Construct with three catalog parameters
- catalog = new AggregateCatalog(assemblyCatalog1, assemblyCatalog2, assemblyCatalog3);
- Assert.IsTrue(catalog.Catalogs.Count == 3);
- }
-
- [TestMethod]
- public void AggregatingCatalogParmsConstructorMixedCatalogs()
- {
- var typePartCatalog1 = new TypeCatalog(typeof(SharedPartStuff));
- var assemblyCatalog2 = new AssemblyCatalog(typeof(SharedPartStuff).Assembly);
- var typePartCatalog3 = new TypeCatalog(typeof(SharedPartStuff));
-
- // Construct with three catalog parameters
- var catalog = new AggregateCatalog(typePartCatalog1, assemblyCatalog2, typePartCatalog3);
- Assert.IsTrue(catalog.Catalogs.Count == 3);
- }
-
- [TestMethod]
- public void AggregatingCatalogRaisesChangesForCatalogsPassedToConstructor()
- {
- var subCatalog = CreateAggregateCatalog();
- var testCatalog = new AggregateCatalog(subCatalog);
-
- bool changedCalled = false;
- testCatalog.Changed += delegate
- {
- changedCalled = true;
- };
-
- subCatalog.Catalogs.Add(new TypeCatalog(typeof(SharedPartStuff)));
-
- Assert.IsTrue(changedCalled);
- }
-
- private AggregateCatalog CreateAggregateCatalog()
- {
- return new AggregateCatalog();
- }
-
- [TestMethod]
- [Ignore]
- [WorkItem(812029)]
- public void CatalogEvents_AggregateAddRemove()
- {
- var catalog = new AggregateCatalog();
- AggregateTests(catalog, catalog);
- }
-
- [TestMethod]
- [Ignore]
- [WorkItem(812029)]
- public void CatalogEvents_DeepAggregateAddRemove()
- {
- var deepCatalog = new AggregateCatalog();
- var midCatalog = new AggregateCatalog(new ComposablePartCatalog[] { deepCatalog });
- var topCatalog = new AggregateCatalog(new ComposablePartCatalog[] { midCatalog });
- AggregateTests(topCatalog, deepCatalog);
- }
-
- private void AggregateTests(AggregateCatalog watchedCatalog, AggregateCatalog modifiedCatalog)
- {
- var fooCatalog = new TypeCatalog(new Type[] { typeof(FooExporter) });
- var barCatalog = new TypeCatalog(new Type[] { typeof(BarExporter) });
- var bothCatalog = new TypeCatalog(new Type[] { typeof(FooExporter), typeof(BarExporter) });
-
- var catalogListener = new CatalogListener(watchedCatalog, modifiedCatalog);
-
- catalogListener.VerifyAdd(fooCatalog, typeof(FooExporter));
- catalogListener.VerifyAdd(barCatalog, typeof(BarExporter));
- catalogListener.VerifyRemove(fooCatalog, typeof(FooExporter));
- catalogListener.VerifyRemove(barCatalog, typeof(BarExporter));
-
- catalogListener.VerifyAdd(bothCatalog, typeof(FooExporter), typeof(BarExporter));
- catalogListener.VerifyClear(typeof(FooExporter), typeof(BarExporter));
-
- catalogListener.VerifyAdd(bothCatalog, typeof(FooExporter), typeof(BarExporter));
- catalogListener.VerifyRemove(bothCatalog, typeof(FooExporter), typeof(BarExporter));
- }
-
-
- public interface IFoo { }
- public interface IBar { }
-
- [Export(typeof(IFoo))]
- public class FooExporter : IFoo
- {
- }
-
- [Export(typeof(IBar))]
- public class BarExporter : IBar
- {
- }
-
- public class CatalogListener
- {
- private AggregateCatalog _watchedCatalog;
- private AggregateCatalog _modifiedCatalog;
- private string[] _expectedAdds;
- private string[] _expectedRemoves;
- private int _changedEventCount;
- private int _changingEventCount;
-
- public CatalogListener(AggregateCatalog watchCatalog, AggregateCatalog modifiedCatalog)
- {
- watchCatalog.Changing += OnChanging;
- watchCatalog.Changed += OnChanged;
- this._watchedCatalog = watchCatalog;
- this._modifiedCatalog = modifiedCatalog;
- }
-
- public void VerifyAdd(ComposablePartCatalog catalogToAdd, params Type[] expectedTypesAdded)
- {
- this._expectedAdds = GetDisplayNames(expectedTypesAdded);
-
- this._modifiedCatalog.Catalogs.Add(catalogToAdd);
-
- Assert.IsTrue(this._changingEventCount == 1, "Changing event should have been called");
- Assert.IsTrue(this._changedEventCount == 1, "Changed event should have been called");
-
- ResetState();
- }
-
- public void VerifyRemove(ComposablePartCatalog catalogToRemove, params Type[] expectedTypesRemoved)
- {
- this._expectedAdds = null;
- this._expectedRemoves = GetDisplayNames(expectedTypesRemoved);
-
- this._modifiedCatalog.Catalogs.Remove(catalogToRemove);
-
- Assert.IsTrue(this._changingEventCount == 1, "Changing event should have been called");
- Assert.IsTrue(this._changedEventCount == 1, "Changed event should have been called");
-
- ResetState();
- }
-
- public void VerifyClear(params Type[] expectedTypesRemoved)
- {
- this._expectedAdds = null;
- this._expectedRemoves = GetDisplayNames(expectedTypesRemoved);
-
- this._modifiedCatalog.Catalogs.Clear();
-
- Assert.IsTrue(this._changingEventCount == 1, "Changing event should have been called");
- Assert.IsTrue(this._changedEventCount == 1, "Changed event should have been called");
-
- ResetState();
- }
-
- public void OnChanging(object sender, ComposablePartCatalogChangeEventArgs args)
- {
- Assert.IsTrue(this._expectedAdds != null || this._expectedRemoves != null);
-
- if (this._expectedAdds == null)
- {
- EnumerableAssert.IsEmpty(args.AddedDefinitions);
- }
- else
- {
- EnumerableAssert.AreSequenceEqual(this._expectedAdds, GetDisplayNames(args.AddedDefinitions));
- }
-
- if (this._expectedRemoves == null)
- {
- EnumerableAssert.IsEmpty(args.RemovedDefinitions);
- }
- else
- {
- EnumerableAssert.AreSequenceEqual(this._expectedRemoves, GetDisplayNames(args.RemovedDefinitions));
- }
-
- Assert.IsFalse(ContainsChanges(), "The catalog should NOT contain the changes yet");
-
- this._changingEventCount++;
- }
-
- public void OnChanged(object sender, ComposablePartCatalogChangeEventArgs args)
- {
- Assert.IsTrue(this._expectedAdds != null || this._expectedRemoves != null);
-
- if (this._expectedAdds == null)
- {
- EnumerableAssert.IsEmpty(args.AddedDefinitions);
- }
- else
- {
- EnumerableAssert.AreSequenceEqual(this._expectedAdds, GetDisplayNames(args.AddedDefinitions));
- }
-
- if (this._expectedRemoves == null)
- {
- EnumerableAssert.IsEmpty(args.RemovedDefinitions);
- }
- else
- {
- EnumerableAssert.AreSequenceEqual(this._expectedRemoves, GetDisplayNames(args.RemovedDefinitions));
- }
-
- Assert.IsNull(args.AtomicComposition);
- Assert.IsTrue(ContainsChanges(), "The catalog should contain the changes");
-
- this._changedEventCount++;
- }
-
- private bool ContainsChanges()
- {
- var allParts = GetDisplayNames(this._watchedCatalog.Parts);
-
- if (this._expectedAdds != null)
- {
- foreach (var add in this._expectedAdds)
- {
- if (!allParts.Contains(add))
- {
- return false;
- }
- }
- }
-
- if (this._expectedRemoves != null)
- {
- foreach (var remove in this._expectedRemoves)
- {
- if (allParts.Contains(remove))
- {
- return false;
- }
- }
- }
-
- return true;
- }
-
- private void ResetState()
- {
- this._expectedAdds = null;
- this._expectedRemoves = null;
- this._changedEventCount = 0;
- this._changingEventCount = 0;
- }
-
- private static string[] GetDisplayNames(IEnumerable<ComposablePartDefinition> definitions)
- {
- return definitions.OfType<ICompositionElement>().Select(p => p.DisplayName).ToArray();
- }
-
- private static string[] GetDisplayNames(IEnumerable<Type> types)
- {
- return GetDisplayNames(types.Select(t => AttributedModelServices.CreatePartDefinition(t, null)));
- }
- }
-
- [Export]
- [PartCreationPolicy(CreationPolicy.Shared)]
- public class SharedPartStuff
- {
- Guid id = Guid.NewGuid();
-
- public override string ToString()
- {
- return id.ToString();
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/AssemblyCatalogDebuggerProxyTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/AssemblyCatalogDebuggerProxyTests.cs deleted file mode 100644 index 96f1e1ca626..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/AssemblyCatalogDebuggerProxyTests.cs +++ /dev/null @@ -1,66 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Factories;
-using System.Reflection;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- [TestClass]
- public class AssemblyCatalogDebuggerProxyTests
- {
- [TestMethod]
- public void Constructor_NullAsCatalogArgument_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("catalog", () =>
- {
- new AssemblyCatalogDebuggerProxy((AssemblyCatalog)null);
- });
- }
-
- [TestMethod]
- public void Constructor_ValueAsCatalogArgument_ShouldSetPartsProperty()
- {
- var expectations = Expectations.GetAssemblies();
-
- foreach (var e in expectations)
- {
- var catalog = CreateAssemblyCatalog(e);
-
- var proxy = new AssemblyCatalogDebuggerProxy(catalog);
-
- EnumerableAssert.AreSequenceEqual(catalog.Parts, proxy.Parts);
- }
- }
-
- [TestMethod]
- public void Constructor_ValueAsCatalogArgument_ShouldSetAssemblyProperty()
- {
- var expectations = Expectations.GetAssemblies();
-
- foreach (var e in expectations)
- {
- var catalog = CreateAssemblyCatalog(e);
-
- var proxy = new AssemblyCatalogDebuggerProxy(catalog);
-
- Assert.AreSame(catalog.Assembly, proxy.Assembly);
- }
- }
-
- private AssemblyCatalogDebuggerProxy CreateAssemblyDebuggerProxy(AssemblyCatalog catalog)
- {
- return new AssemblyCatalogDebuggerProxy(catalog);
- }
-
- private AssemblyCatalog CreateAssemblyCatalog(Assembly assembly)
- {
- return new AssemblyCatalog(assembly);
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/AssemblyCatalogTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/AssemblyCatalogTests.cs deleted file mode 100644 index 961da8baf85..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/AssemblyCatalogTests.cs +++ /dev/null @@ -1,510 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.UnitTesting;
-using System.IO;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Reflection;
-using System.Security;
-using System.Security.Permissions;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class AssemblyCatalogTests
- {
-#if !SILVERLIGHT
- [TestMethod]
- public void Constructor1_ValueAsAssemblyArgument_ShouldSetAssemblyProperty()
- {
- var expectations = Expectations.GetAssemblies();
-
- foreach (var e in expectations)
- {
- var catalog = new AssemblyCatalog(e.CodeBase);
-
- Assert.AreSame(e, catalog.Assembly);
- }
- }
-#endif
-
- [TestMethod]
- public void Constructor2_ValueAsAssemblyArgument_ShouldSetAssemblyProperty()
- {
- var expectations = Expectations.GetAssemblies();
-
- foreach (var e in expectations)
- {
- var catalog = new AssemblyCatalog(e);
-
- Assert.AreSame(e, catalog.Assembly);
- }
- }
-
-#if !SILVERLIGHT
-
- [TestMethod]
- public void Constructor1_LockedFileAsCodeBaseArgument_ShouldThrowFileLoad()
- {
- using (TemporaryFile file = new TemporaryFile())
- {
- using (FileStream stream = new FileStream(file.FileName, FileMode.Open, FileAccess.Read, FileShare.None))
- {
- ExceptionAssert.Throws<FileLoadException>(() =>
- {
- new AssemblyCatalog(file.FileName);
- });
- }
- }
- }
-
- [TestMethod]
- public void Constructor1_NullFileNameAsCodeBaseArgument_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("codeBase", () =>
- {
- new AssemblyCatalog((string)null);
- });
- }
-
- [TestMethod]
- public void Constructor1_EmptyFileNameAsCodeBaseArgument_ShouldThrowArgument()
- {
- ExceptionAssert.ThrowsArgument<ArgumentException>("codeBase", () =>
- {
- new AssemblyCatalog("");
- });
- }
-
- [TestMethod]
- public void Constructor1_InvalidFileNameAsCodeBaseArgument_ShouldThrowArgument()
- {
- ExceptionAssert.Throws<ArgumentException>(() =>
- {
- new AssemblyCatalog("??||>");
- });
- }
-
- [TestMethod]
- public void Constructor1_DirectoryAsCodeBaseArgument_ShouldThrowFileLoad()
- {
- string directory = Environment.GetFolderPath(Environment.SpecialFolder.System);
- Assert.IsTrue(Directory.Exists(directory));
-
- ExceptionAssert.Throws<FileLoadException>(() =>
- {
- new AssemblyCatalog(directory);
- });
- }
-
- [TestMethod]
- public void Constructor1_TooLongFileNameAsCodeBaseArgument_ShouldThrowPathTooLong()
- {
- ExceptionAssert.Throws<PathTooLongException>(() =>
- {
- new AssemblyCatalog(@"c:\This is a very long path\And Just to make sure\We will continue to make it very long\This is a very long path\And Just to make sure\We will continue to make it very long\This is a very long path\And Just to make sure\We will continue to make it very long\myassembly.dll");
- });
- }
-
- [TestMethod]
- public void Constructor1_NonAssemblyFileNameAsCodeBaseArgument_ShouldThrowBadImageFormat()
- {
- using (TemporaryFile temporaryFile = new TemporaryFile())
- {
- ExceptionAssert.Throws<BadImageFormatException>(() =>
- {
- new AssemblyCatalog(temporaryFile.FileName);
- });
- }
- }
-
- [TestMethod]
- public void Constructor1_NonExistentFileNameAsCodeBaseArgument_ShouldThrowFileNotFound()
- {
- ExceptionAssert.Throws<FileNotFoundException>(() =>
- {
- new AssemblyCatalog(@"FileThat should not ever exist");
- });
- }
-#endif
-
-#if !SILVERLIGHT
-
- [TestMethod]
- public void Constructor1_ShouldSetOriginToNull()
- {
- var catalog = (ICompositionElement)new AssemblyCatalog(GetAttributedAssemblyCodeBase());
-
- Assert.IsNull(catalog.Origin);
- }
-
-#endif
-
- [TestMethod]
- public void Constructor2_ShouldSetOriginToNull()
- {
- var catalog = (ICompositionElement)new AssemblyCatalog(GetAttributedAssembly());
-
- Assert.IsNull(catalog.Origin);
- }
-
- [TestMethod]
- public void Assembly_WhenCatalogDisposed_ShouldNotThrow()
- {
- var catalog = CreateAssemblyCatalog();
- catalog.Dispose();
-
- Assert.IsNotNull(catalog.Assembly);
- }
-
- [TestMethod]
- public void ICompositionElementDisplayName_WhenCatalogDisposed_ShouldNotThrow()
- {
- var catalog = CreateAssemblyCatalog();
- catalog.Dispose();
-
- var displayName = ((ICompositionElement)catalog).DisplayName;
- }
-
- [TestMethod]
- public void ICompositionElementOrigin_WhenCatalogDisposed_ShouldNotThrow()
- {
- var catalog = CreateAssemblyCatalog();
- catalog.Dispose();
-
- var origin = ((ICompositionElement)catalog).Origin;
- }
-
- [TestMethod]
- public void ToString_WhenCatalogDisposed_ShouldNotThrow()
- {
- var catalog = CreateAssemblyCatalog();
- catalog.Dispose();
-
- catalog.ToString();
- }
-
- [TestMethod]
- public void Parts_WhenCatalogDisposed_ShouldThrowObjectDisposed()
- {
- var catalog = CreateAssemblyCatalog();
- catalog.Dispose();
-
- ExceptionAssert.ThrowsDisposed(catalog, () =>
- {
- var parts = catalog.Parts;
- });
- }
-
- [TestMethod]
- public void GetExports_WhenCatalogDisposed_ShouldThrowObjectDisposed()
- {
- var catalog = CreateAssemblyCatalog();
- catalog.Dispose();
- var definition = ImportDefinitionFactory.Create();
-
- ExceptionAssert.ThrowsDisposed(catalog, () =>
- {
- catalog.GetExports(definition);
- });
- }
-
- [TestMethod]
- public void GetExports_NullAsConstraintArgument_ShouldThrowArgumentNull()
- {
- var catalog = CreateAssemblyCatalog();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("definition", () =>
- {
- catalog.GetExports((ImportDefinition)null);
- });
- }
-
-
- [TestMethod]
- public void Dispose_ShouldNotThrow()
- {
- using (var catalog = CreateAssemblyCatalog())
- {
- }
- }
-
- [TestMethod]
- public void Dispose_CanBeCalledMultipleTimes()
- {
- var catalog = CreateAssemblyCatalog();
- catalog.Dispose();
- catalog.Dispose();
- catalog.Dispose();
- }
-
- [TestMethod]
- public void Parts()
- {
- var catalog = new AssemblyCatalog(typeof(AssemblyCatalogTests).Assembly);
- Assert.IsNotNull(catalog.Parts);
- Assert.IsTrue(catalog.Parts.Count()>0);
- }
-
-
- [TestMethod]
- public void Parts_ShouldSetDefinitionOriginToCatalogItself()
- {
- var catalog = CreateAssemblyCatalog();
- Assert.IsTrue(catalog.Parts.Count() > 0);
-
- foreach (ICompositionElement definition in catalog.Parts)
- {
- Assert.AreSame(catalog, definition.Origin);
- }
- }
-
- [TestMethod]
- public void GetExports()
- {
- var catalog = new AssemblyCatalog(typeof(AssemblyCatalogTests).Assembly);
- Expression<Func<ExportDefinition, bool>> constraint = (ExportDefinition exportDefinition) => exportDefinition.ContractName == AttributedModelServices.GetContractName(typeof(MyExport));
- IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>> matchingExports = catalog.GetExports(constraint);
- Assert.IsNotNull(matchingExports);
- Assert.IsTrue(matchingExports.Count() >= 0);
-
- IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>> expectedMatchingExports = catalog.Parts
- .SelectMany(part => part.ExportDefinitions, (part, export) => new Tuple<ComposablePartDefinition, ExportDefinition>(part, export))
- .Where(partAndExport => partAndExport.Item2.ContractName == AttributedModelServices.GetContractName(typeof(MyExport)));
- Assert.IsTrue(matchingExports.SequenceEqual(expectedMatchingExports));
- }
-
-
-
-#if !SILVERLIGHT
- // Silverlight does not support loading assemblies via file path
- [TestMethod]
- public void AddAssemblyUsingFile()
- {
- var catalog = new AssemblyCatalog(typeof(AssemblyCatalogTests).Assembly.Location);
- var container = new CompositionContainer(catalog);
-
- Assert.IsNotNull(container.GetExportedValue<MyExport>());
- }
-#endif
-
- [TestMethod]
- public void TwoTypesWithSameSimpleName()
- {
- var catalog = new AssemblyCatalog(typeof(AssemblyCatalogTests).Assembly);
- var container = new CompositionContainer(catalog);
-
- NotSoUniqueName unique1 = container.GetExportedValue<NotSoUniqueName>();
- Assert.IsNotNull(unique1);
-
- Assert.AreEqual(23, unique1.MyIntProperty);
-
- NotSoUniqueName2.NotSoUniqueName nestedUnique = container.GetExportedValue<NotSoUniqueName2.NotSoUniqueName>();
-
- Assert.IsNotNull(nestedUnique);
- Assert.AreEqual("MyStringProperty", nestedUnique.MyStringProperty);
- }
-
- [TestMethod]
- public void GettingFunctionExports()
- {
- var catalog = new AssemblyCatalog(typeof(AssemblyCatalogTests).Assembly);
- var container = new CompositionContainer(catalog);
-
- ImportDefaultFunctions import = container.GetExportedValue<ImportDefaultFunctions>("ImportDefaultFunctions");
- import.VerifyIsBound();
- }
-
- [TestMethod]
- public void AnExportOfAnInstanceThatFailsToCompose()
- {
- var catalog = new AssemblyCatalog(typeof(AssemblyCatalogTests).Assembly);
- var container = new CompositionContainer(catalog);
-
- // Rejection causes the part in the catalog whose imports cannot be
- // satisfied to be ignored, resulting in a cardinality mismatch instead of a
- // composition exception
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- {
- container.GetExportedValue<string>("ExportMyString");
- });
- }
-
- [TestMethod]
- public void SharedPartCreation()
- {
- var catalog = new AssemblyCatalog(typeof(AssemblyCatalogTests).Assembly);
- var container = new CompositionContainer(catalog);
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(new Int32Exporter(41));
- container.Compose(batch);
-
- var sharedPart1 = container.GetExportedValue<MySharedPartExport>();
- Assert.AreEqual(41, sharedPart1.Value);
- var sharedPart2 = container.GetExportedValue<MySharedPartExport>();
- Assert.AreEqual(41, sharedPart2.Value);
-
- Assert.AreEqual(sharedPart1, sharedPart2, "These should be the same instances");
- }
-
- [TestMethod]
- public void NonSharedPartCreation()
- {
- var catalog = new AssemblyCatalog(typeof(AssemblyCatalogTests).Assembly);
- var container = new CompositionContainer(catalog);
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(new Int32Exporter(41));
- container.Compose(batch);
-
- var nonSharedPart1 = container.GetExportedValue<MyNonSharedPartExport>();
- Assert.AreEqual(41, nonSharedPart1.Value);
- var nonSharedPart2 = container.GetExportedValue<MyNonSharedPartExport>();
- Assert.AreEqual(41, nonSharedPart2.Value);
-
- Assert.AreNotSame(nonSharedPart1, nonSharedPart2, "These should be different instances");
- }
-
- [TestMethod]
- public void RecursiveNonSharedPartCreation()
- {
- var catalog = new AssemblyCatalog(typeof(AssemblyCatalogTests).Assembly);
- var container = new CompositionContainer(catalog);
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotGetExportedValue, () =>
- {
- container.GetExportedValue<DirectCycleNonSharedPart>();
- });
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotGetExportedValue, () =>
- {
- container.GetExportedValue<CycleNonSharedPart>();
- });
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotGetExportedValue, () =>
- {
- container.GetExportedValue<CycleNonSharedPart1>();
- });
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotGetExportedValue, () =>
- {
- container.GetExportedValue<CycleNonSharedPart2>();
- });
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotGetExportedValue, () =>
- {
- container.GetExportedValue<CycleWithSharedPartAndNonSharedPart>();
- });
-
- Assert.IsNotNull(container.GetExportedValue<CycleSharedPart>());
- Assert.IsNotNull(container.GetExportedValue<CycleSharedPart1>());
- Assert.IsNotNull(container.GetExportedValue<CycleSharedPart2>());
- Assert.IsNotNull(container.GetExportedValue<NoCycleNonSharedPart>());
- }
-
- [TestMethod]
- public void TryToDiscoverExportWithGenericParameter()
- {
- var catalog = new AssemblyCatalog(typeof(AssemblyCatalogTests).Assembly);
- var container = new CompositionContainer(catalog);
-
- // Open generic should fail because we should discover that type
- Assert.IsNull(container.GetExportedValueOrDefault<object>(AttributedModelServices.GetContractName(typeof(ExportWithGenericParameter<>))));
-
- // This specific generic was not exported any where so it should fail
- Assert.IsNull(container.GetExportedValueOrDefault<object>(AttributedModelServices.GetContractName(typeof(ExportWithGenericParameter<double>))));
-
- // This specific generic was exported so it should succeed
- Assert.IsNotNull(container.GetExportedValueOrDefault<object>(AttributedModelServices.GetContractName(typeof(ExportWithGenericParameter<int>))));
-
- // Shouldn't discovoer static type with open generic
- Assert.IsNull(container.GetExportedValueOrDefault<object>(AttributedModelServices.GetContractName(typeof(StaticExportWithGenericParameter<>))));
-
- // Should find a type that inherits from an export
- Assert.IsNotNull(container.GetExportedValueOrDefault<object>(AttributedModelServices.GetContractName(typeof(ExportWhichInheritsFromGeneric))));
-
- // This should be exported because it is inherited by ExportWhichInheritsFromGeneric
- Assert.IsNotNull(container.GetExportedValueOrDefault<object>(AttributedModelServices.GetContractName(typeof(ExportWithGenericParameter<string>))));
- }
-
- [TestMethod]
- public void ICompositionElementDisplayName_ShouldIncludeCatalogTypeNameAndAssemblyFullName()
- {
- var expectations = Expectations.GetAssemblies();
-
- foreach (var e in expectations)
- {
- var catalog = (ICompositionElement)CreateAssemblyCatalog(e);
-
- string expected = string.Format("AssemblyCatalog (Assembly=\"{0}\")", e.FullName);
-
- Assert.AreEqual(expected, catalog.DisplayName);
- }
- }
-
- [TestMethod]
- public void ICompositionElementDisplayName_ShouldIncludeDerivedCatalogTypeNameAndAssemblyFullName()
- {
- var expectations = Expectations.GetAssemblies();
-
- foreach (var e in expectations)
- {
- var catalog = (ICompositionElement)new DerivedAssemblyCatalog(e);
-
- string expected = string.Format("DerivedAssemblyCatalog (Assembly=\"{0}\")", e.FullName);
-
- Assert.AreEqual(expected, catalog.DisplayName);
- }
- }
-
- [TestMethod]
- public void ToString_ShouldReturnICompositionElementDisplayName()
- {
- var expectations = Expectations.GetAssemblies();
-
- foreach (var e in expectations)
- {
- var catalog = (ICompositionElement)CreateAssemblyCatalog(e);
-
- Assert.AreEqual(catalog.DisplayName, catalog.ToString());
- }
- }
-
-
-
- private string GetAttributedAssemblyCodeBase()
- {
- return Assembly.GetExecutingAssembly().CodeBase;
- }
-
- private Assembly GetAttributedAssembly()
- {
- return Assembly.GetExecutingAssembly();
- }
-
- private AssemblyCatalog CreateAssemblyCatalog()
- {
- return CreateAssemblyCatalog(GetAttributedAssembly());
- }
-
- private AssemblyCatalog CreateAssemblyCatalog(Assembly assembly)
- {
- return new AssemblyCatalog(assembly);
- }
-
- private class DerivedAssemblyCatalog : AssemblyCatalog
- {
- public DerivedAssemblyCatalog(Assembly assembly)
- : base(assembly)
- {
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/CatalogExportProviderTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/CatalogExportProviderTests.cs deleted file mode 100644 index 3e0eb928b81..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/CatalogExportProviderTests.cs +++ /dev/null @@ -1,599 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.ComponentModel.Composition.Diagnostics;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Linq;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class ComposablePartCatalogExportProviderTests
- {
- [TestMethod]
- public void Constructor_NullAsCatalogArgument_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("catalog", () =>
- {
- new CatalogExportProvider((ComposablePartCatalog)null);
- });
- }
-
- [TestMethod]
- public void Constructor_ValueAsCatalogArgument_ShouldSetCatalogPropertyToEmpty()
- {
- var expectations = Expectations.GetCatalogs();
-
- foreach (var e in expectations)
- {
- var provider = new CatalogExportProvider(e);
-
- Assert.AreSame(e, provider.Catalog);
- }
- }
-
- [TestMethod]
- public void Catalog_WhenDisposed_ShouldThrowObjectDisposed()
- {
- var provider = CreateCatalogExportProvider();
- provider.Dispose();
-
- ExceptionAssert.ThrowsDisposed(provider, () =>
- {
- var catalog = provider.Catalog;
- });
- }
-
- [TestMethod]
- public void SourceProvider_NullAsValueArgument_ShouldThrowArgumentNull()
- {
- var provider = CreateCatalogExportProvider();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("value", () =>
- {
- provider.SourceProvider = null;
- });
- }
-
- [TestMethod]
- public void GetExports_WhenRejectedDefinitionRequiredImportIsAdded_ShouldBeResurrected()
- {
- var part = PartFactory.CreateImporterExporter("Export", "Import");
-
- var provider = CreateCatalogExportProvider(part);
- var sourceProvider = ExportProviderFactory.CreateRecomposable();
- provider.SourceProvider = sourceProvider;
-
- var exports = provider.GetExports<object>("Export");
-
- EnumerableAssert.IsEmpty(exports, "definition should have been rejected.");
-
- // Resurrect the definition
- sourceProvider.AddExport("Import", new object());
-
- exports = provider.GetExports<object>("Export");
-
- Assert.AreEqual(1, exports.Count(), "definition should have been resurrected.");
- }
-
- [TestMethod]
- public void GetExports_WhenMultipleRejectedDefinitionsRequiredImportsAreAdded_ShouldBeResurrected()
- {
- var part1 = PartFactory.CreateImporterExporter("Export", "Import");
- var part2 = PartFactory.CreateImporterExporter("Export", "Import");
-
- var provider = CreateCatalogExportProvider(part1, part2);
- var sourceProvider = ExportProviderFactory.CreateRecomposable();
- provider.SourceProvider = sourceProvider;
-
- var exports = provider.GetExports<object>("Export");
-
- EnumerableAssert.IsEmpty(exports, "definition1 and definition2 should have been rejected.");
-
- // Resurrect both definitions
- sourceProvider.AddExport("Import", new object());
-
- exports = provider.GetExports<object>("Export");
-
- Assert.AreEqual(2, exports.Count(), "definition1 and definition2 should have been resurrected.");
- }
-
- [TestMethod]
- [WorkItem(743740)]
- public void GetExports_AfterResurrectedDefinitionHasBeenRemovedAndReaddedToCatalog_ShouldNotBeTreatedAsRejected()
- {
- var definition1 = PartDefinitionFactory.Create(PartFactory.CreateImporterExporter("Export", "Import"));
- var definition2 = PartDefinitionFactory.Create(PartFactory.CreateImporterExporter("Export", "Import"));
- var catalog = CatalogFactory.CreateMutable(definition1, definition2);
-
- var provider = CreateCatalogExportProvider(catalog);
- var sourceProvider = ExportProviderFactory.CreateRecomposable();
- provider.SourceProvider = sourceProvider;
-
- var exports = provider.GetExports<object>("Export");
-
- EnumerableAssert.IsEmpty(exports, "definition1 and definition2 should have been rejected.");
-
- // Resurrect both definitions
- sourceProvider.AddExport("Import", new object());
-
- exports = provider.GetExports<object>("Export");
-
- Assert.AreEqual(2, exports.Count(), "definition1 and definition2 should have been resurrected.");
-
- catalog.RemoveDefinition(definition1);
-
- exports = provider.GetExports<object>("Export");
- Assert.AreEqual(1, exports.Count(), "definition1 should have been removed.");
-
- catalog.AddDefinition(definition1);
-
- exports = provider.GetExports<object>("Export");
-
- Assert.AreEqual(2, exports.Count(), "definition1 and definition2 should be both present.");
- }
-
-#if !SILVERLIGHT
-
- [TestMethod]
- public void GetExports_WhenDefinitionIsRejected_ShouldTraceWarning()
- {
- using (TraceContext context = new TraceContext(SourceLevels.Warning))
- {
- var part = PartFactory.CreateImporterExporter("Export", "Import");
- var provider = CreateCatalogExportProvider(part);
- provider.SourceProvider = ExportProviderFactory.CreateRecomposable();
-
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- {
- provider.GetExport<object>("Export");
-
- });
-
- Assert.IsNotNull(context.LastTraceEvent);
- Assert.AreEqual(context.LastTraceEvent.EventType, TraceEventType.Warning);
- Assert.AreEqual(context.LastTraceEvent.Id, TraceId.Rejection_DefinitionRejected);
- }
- }
-
- [TestMethod]
- public void GetExports_WhenDefinitionIsResurrected_ShouldTraceInformation()
- {
- using (TraceContext context = new TraceContext(SourceLevels.Information))
- {
- var part = PartFactory.CreateImporterExporter("Export", "Import");
- var sourceProvider = ExportProviderFactory.CreateRecomposable();
- var provider = CreateCatalogExportProvider(part);
- provider.SourceProvider = sourceProvider;
-
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- {
- provider.GetExport<object>("Export");
- });
-
- // Add the required export to the source provider 'resurrect' the part
- sourceProvider.AddExport("Import", "Value");
-
- provider.GetExport<object>("Export");
-
- Assert.IsNotNull(context.LastTraceEvent);
- Assert.AreEqual(context.LastTraceEvent.EventType, TraceEventType.Information);
- Assert.AreEqual(context.LastTraceEvent.Id, TraceId.Rejection_DefinitionResurrected);
- }
- }
-
- [TestMethod]
- public void GetExports_WhenDefinitionsAreResurrected_ShouldTraceInformation()
- {
- using (TraceContext context = new TraceContext(SourceLevels.Information))
- {
- var part1 = PartFactory.CreateImporterExporter("Export", "Import");
- var part2 = PartFactory.CreateImporterExporter("Export", "Import");
-
- var sourceProvider = ExportProviderFactory.CreateRecomposable();
- var provider = CreateCatalogExportProvider(part1, part2);
- provider.SourceProvider = sourceProvider;
-
- EnumerableAssert.IsEmpty(provider.GetExports<object>("Export"));
-
- // Add the required export to the source provider 'resurrect' the part
- sourceProvider.AddExport("Import", "Value");
-
- provider.GetExports<object>("Export");
-
- Assert.AreEqual(4, context.TraceEvents.Count); // 2 for rejection, 2 for resurrection
- Assert.AreEqual(context.TraceEvents[2].EventType, TraceEventType.Information);
- Assert.AreEqual(context.TraceEvents[3].EventType, TraceEventType.Information);
- Assert.AreEqual(context.TraceEvents[2].Id, TraceId.Rejection_DefinitionResurrected);
- Assert.AreEqual(context.TraceEvents[3].Id, TraceId.Rejection_DefinitionResurrected);
- }
- }
-#endif
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void BasicTest()
- {
- var catalog = CatalogFactory.CreateDefaultAttributed();
- var catalogExportProvider = new CatalogExportProvider(catalog);
- catalogExportProvider.SourceProvider = catalogExportProvider;
- var testName = AttributedModelServices.GetContractName(typeof(CatalogComponentTest));
- var testNameNonComponent = AttributedModelServices.GetContractName(typeof(CatalogComponentTestNonComponentPart));
- var testInterfaceName = AttributedModelServices.GetContractName(typeof(ICatalogComponentTest));
-
- Assert.AreEqual(1, catalogExportProvider.GetExports(ImportFromContract(testName)).Count());
- Assert.AreEqual(0, catalogExportProvider.GetExports(ImportFromContract(testNameNonComponent)).Count());
-
- var exports = catalogExportProvider.GetExports(ImportFromContract(testInterfaceName));
- Assert.AreEqual(2, exports.Count(), "There should be 2 of them");
-
- foreach (var i in exports)
- Assert.IsNotNull(i.Value, "Should get a value");
-
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void BasicTestWithRequiredMetadata_NoTypeConstraint()
- {
- var catalog = CatalogFactory.CreateDefaultAttributed();
- var catalogExportProvider = new CatalogExportProvider(catalog);
- catalogExportProvider.SourceProvider = catalogExportProvider;
-
- Assert.AreEqual(0, catalogExportProvider.GetExports(ImportFromContractAndMetadata("MyExporterWithNoFoo", new string[] { "Foo" }, new Type[] {typeof(object)})).Count());
-
- Assert.AreEqual(1, catalogExportProvider.GetExports(ImportFromContractAndMetadata("MyExporterWithFoo", new string[] { "Foo" }, new Type[] { typeof(object) })).Count());
- Assert.AreEqual(0, catalogExportProvider.GetExports(ImportFromContractAndMetadata("MyExporterWithFoo", new string[] { "Foo", "Bar" }, new Type[] { typeof(object), typeof(object) })).Count());
-
- Assert.AreEqual(0, catalogExportProvider.GetExports(ImportFromContractAndMetadata("MyExporterWithNoFoo", new string[] { "Foo" }, new Type[] { typeof(object) })).Count());
- Assert.AreEqual(1, catalogExportProvider.GetExports(ImportFromContractAndMetadata("MyExporterWithFoo", new string[] { "Foo" }, new Type[] { typeof(object) })).Count());
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void BasicTestWithRequiredMetadata_TypeConstraint()
- {
- var catalog = CatalogFactory.CreateDefaultAttributed();
- var catalogExportProvider = new CatalogExportProvider(catalog);
- catalogExportProvider.SourceProvider = catalogExportProvider;
-
- Assert.AreEqual(0, catalogExportProvider.GetExports(ImportFromContractAndMetadata("MyExporterWithNoFoo", new string[] { "Foo" }, new Type[] { typeof(string) })).Count());
-
- Assert.AreEqual(1, catalogExportProvider.GetExports(ImportFromContractAndMetadata("MyExporterWithFoo", new string[] { "Foo" }, new Type[] { typeof(string) })).Count());
- Assert.AreEqual(0, catalogExportProvider.GetExports(ImportFromContractAndMetadata("MyExporterWithFoo", new string[] { "Foo", "Bar" }, new Type[] { typeof(string), typeof(string) })).Count());
-
- Assert.AreEqual(0, catalogExportProvider.GetExports(ImportFromContractAndMetadata("MyExporterWithNoFoo", new string[] { "Foo" }, new Type[] { typeof(string) })).Count());
- Assert.AreEqual(1, catalogExportProvider.GetExports(ImportFromContractAndMetadata("MyExporterWithFoo", new string[] { "Foo" }, new Type[] { typeof(string) })).Count());
- }
-
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void BasicTestWithRequiredMetadata_WrongTypeConstraint()
- {
- var catalog = CatalogFactory.CreateDefaultAttributed();
- var catalogExportProvider = new CatalogExportProvider(catalog);
- catalogExportProvider.SourceProvider = catalogExportProvider;
-
- Assert.AreEqual(0, catalogExportProvider.GetExports(ImportFromContractAndMetadata("MyExporterWithNoFoo", new string[] { "Foo" }, new Type[] { typeof(int) })).Count());
-
- Assert.AreEqual(0, catalogExportProvider.GetExports(ImportFromContractAndMetadata("MyExporterWithFoo", new string[] { "Foo" }, new Type[] { typeof(int) })).Count());
- Assert.AreEqual(0, catalogExportProvider.GetExports(ImportFromContractAndMetadata("MyExporterWithFoo", new string[] { "Foo", "Bar" }, new Type[] { typeof(int), typeof(int) })).Count());
-
- Assert.AreEqual(0, catalogExportProvider.GetExports(ImportFromContractAndMetadata("MyExporterWithNoFoo", new string[] { "Foo" }, new Type[] { typeof(int) })).Count());
- Assert.AreEqual(0, catalogExportProvider.GetExports(ImportFromContractAndMetadata("MyExporterWithFoo", new string[] { "Foo" }, new Type[] { typeof(int) })).Count());
- }
-
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void ComponentCatalogResolverGetStaticExport()
- {
- var catalog = CatalogFactory.CreateDefaultAttributed();
- var catalogExportProvider = new CatalogExportProvider(catalog);
- catalogExportProvider.SourceProvider = catalogExportProvider;
-
- var exports = catalogExportProvider.GetExports(ImportFromContract("StaticString"));
- Assert.AreEqual(1, exports.Count());
- Assert.AreEqual("StaticString", exports.First().Value);
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void ComponentCatalogResolverComponentCatalogExportReference()
- {
- var catalog = CatalogFactory.CreateDefaultAttributed();
- var catalogExportProvider = new CatalogExportProvider(catalog);
- catalogExportProvider.SourceProvider = catalogExportProvider;
-
- var exports = catalogExportProvider.GetExports(ImportFromContract(AttributedModelServices.GetContractName(typeof(MyExporterWithValidMetadata))));
-
- Assert.AreEqual(1, exports.Count());
-
- var export = exports.First();
- Assert.AreEqual("world", export.Metadata["hello"]);
-
- Assert.IsInstanceOfType(export.Value, typeof(MyExporterWithValidMetadata));
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- public void ValueTypeFromCatalog()
- {
- var catalog = CatalogFactory.CreateDefaultAttributed();
- var container = new CompositionContainer(catalog);
- int singletonResult = container.GetExportedValue<int>("{AssemblyCatalogResolver}SingletonValueType");
- Assert.AreEqual(17, singletonResult, "expecting value type resolved from catalog");
- int factoryResult = container.GetExportedValue<int>("{AssemblyCatalogResolver}FactoryValueType");
- Assert.AreEqual(18, factoryResult, "expecting value type resolved from catalog");
- }
-
- [Export]
- [PartCreationPolicy(CreationPolicy.Any)]
- public class CreationPolicyAny
- {
-
- }
-
- [TestMethod]
- public void CreationPolicyAny_MultipleCallsReturnSameInstance()
- {
- var catalog = CatalogFactory.CreateAttributed(typeof (CreationPolicyAny));
- var provider = new CatalogExportProvider(catalog);
- provider.SourceProvider = ContainerFactory.Create();
-
- var export = provider.GetExportedValue<CreationPolicyAny>();
-
- for (int i = 0; i < 5; i++) // 5 is arbitrarily chosen
- {
- var export1 = provider.GetExportedValue<CreationPolicyAny>();
-
- Assert.AreEqual(export, export1);
- }
- }
-
- [Export]
- [PartCreationPolicy(CreationPolicy.Shared)]
- public class CreationPolicyShared
- {
-
- }
-
- [TestMethod]
- public void CreationPolicyShared_MultipleCallsReturnSameInstance()
- {
- var catalog = CatalogFactory.CreateAttributed(typeof(CreationPolicyShared));
- var provider = new CatalogExportProvider(catalog);
- provider.SourceProvider = ContainerFactory.Create();
-
- var export = provider.GetExportedValue<CreationPolicyShared>();
-
- for (int i = 0; i < 5; i++) // 5 is arbitrarily chosen
- {
- var export1 = provider.GetExportedValue<CreationPolicyShared>();
-
- Assert.AreEqual(export, export1);
- }
- }
-
- [Export]
- [PartCreationPolicy(CreationPolicy.NonShared)]
- public class CreationPolicyNonShared
- {
-
- }
-
- [TestMethod]
- public void CreationPolicyNonShared_MultipleCallsReturnsDifferentInstances()
- {
- var catalog = CatalogFactory.CreateAttributed(typeof(CreationPolicyNonShared));
- var provider = new CatalogExportProvider(catalog);
- provider.SourceProvider = ContainerFactory.Create();
-
- List<CreationPolicyNonShared> list = new List<CreationPolicyNonShared>();
- var export = provider.GetExportedValue<CreationPolicyNonShared>();
- list.Add(export);
-
- for (int i = 0; i < 5; i++) // 5 is arbitrarily chosen
- {
- export = provider.GetExportedValue<CreationPolicyNonShared>();
-
- CollectionAssert.DoesNotContain(list, export);
- list.Add(export);
- }
- }
-
- [TestMethod]
- [WorkItem(684514)]
- public void GetExports_NoSourceProvider_ShouldThrowInvalidOperation()
- {
- var catalog = CatalogFactory.CreateAttributed();
- var provider = new CatalogExportProvider(catalog);
-
- ExceptionAssert.Throws<InvalidOperationException>(() =>
- provider.GetExports(ImportFromContract("Foo")));
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- [Ignore]
- [WorkItem(561310)]
- public void Recomposition_PartDefWithRecomposableImportIsRemoved_ExportsMatchingImportChanged_ShouldNotBeRecomposed()
- {
- string dependencyContractName = "dependency";
- var exportValue = new object();
-
- var exporterPart = PartFactory.CreateExporter(dependencyContractName, exportValue);
- var importerPart = PartFactory.CreateImporter(dependencyContractName, true);
-
- var exporterCatalog = CatalogFactory.Create(exporterPart);
- var importerCatalog = CatalogFactory.Create(importerPart);
-
- var aggregateCatalog = CatalogFactory.CreateAggregateCatalog(importerCatalog, exporterCatalog);
-
- var provider = new CatalogExportProvider(aggregateCatalog);
- provider.SourceProvider = provider;
-
- var exports = provider.GetExports(importerPart.ImportDefinitions.Single());
- Assert.AreEqual(exportValue, importerPart.Value, "Importer was not composed");
-
- aggregateCatalog.Catalogs.Remove(importerCatalog);
- aggregateCatalog.Catalogs.Remove(exporterCatalog);
-
- Assert.AreEqual(exportValue, importerPart.Value, "Importer was unexpectedly recomposed");
- }
-
- [TestMethod]
- [TestProperty("Type", "Integration")]
- [Ignore]
- [WorkItem(561310)]
- public void Recomposition_PartDefWithNonRecomposableImportIsRemoved_ExportsMatchingImportChanged_ShouldNotBeRejected()
- {
- string dependencyContractName = "dependency";
- var exportValue = new object();
-
- var exporterPart = PartFactory.CreateExporter(dependencyContractName, exportValue);
- var importerPart = PartFactory.CreateImporter(dependencyContractName, false);
-
- var exporterCatalog = CatalogFactory.Create(exporterPart);
- var importerCatalog = CatalogFactory.Create(importerPart);
-
- var aggregateCatalog = CatalogFactory.CreateAggregateCatalog(importerCatalog, exporterCatalog);
-
- var provider = new CatalogExportProvider(aggregateCatalog);
- provider.SourceProvider = provider;
-
- var exports = provider.GetExports(importerPart.ImportDefinitions.Single());
- Assert.AreEqual(exportValue, importerPart.Value, "Importer was not composed");
-
- aggregateCatalog.Catalogs.Remove(importerCatalog);
- aggregateCatalog.Catalogs.Remove(exporterCatalog);
-
- Assert.AreEqual(exportValue, importerPart.Value, "Importer was unexpectedly recomposed");
- }
-
- [TestMethod]
- public void CanBeCollectedAfterDispose()
- {
- AggregateExportProvider sourceExportProvider = new AggregateExportProvider();
- var catalog = new AggregateCatalog(CatalogFactory.CreateDefaultAttributed());
- var catalogExportProvider = new CatalogExportProvider(catalog);
- catalogExportProvider.SourceProvider = sourceExportProvider;
-
- WeakReference weakCatalogExportProvider = new WeakReference(catalogExportProvider);
- catalogExportProvider.Dispose();
- catalogExportProvider = null;
-
- GC.Collect();
- GC.WaitForPendingFinalizers();
-
- Assert.IsFalse(weakCatalogExportProvider.IsAlive);
-
- GC.KeepAlive(sourceExportProvider);
- GC.KeepAlive(catalog);
- }
-
- [TestMethod]
- public void RemovingAndReAddingMultipleDefinitionsFromCatalog()
- {
- var fixedParts = new TypeCatalog(typeof(RootMultipleImporter), typeof(ExportedService));
- var changingParts = new TypeCatalog(typeof(Exporter1), typeof(Exporter2));
- var catalog = new AggregateCatalog();
- catalog.Catalogs.Add(fixedParts);
- catalog.Catalogs.Add(changingParts);
- var catalogExportProvider = new CatalogExportProvider(catalog);
- catalogExportProvider.SourceProvider = catalogExportProvider;
-
- var root = catalogExportProvider.GetExport<RootMultipleImporter>().Value;
- Assert.AreEqual(2, root.Imports.Length);
-
- catalog.Catalogs.Remove(changingParts);
- Assert.AreEqual(0, root.Imports.Length);
-
- catalog.Catalogs.Add(changingParts);
- Assert.AreEqual(2, root.Imports.Length);
- }
-
- [Export]
- public class RootMultipleImporter
- {
- [ImportMany(AllowRecomposition = true)]
- public IExportedInterface[] Imports { get; set; }
- }
- public interface IExportedInterface
- {
- }
- [Export(typeof(IExportedInterface))]
- public class Exporter1 : IExportedInterface
- {
- [Import]
- public ExportedService Service { get; set; }
- }
- [Export(typeof(IExportedInterface))]
- public class Exporter2 : IExportedInterface
- {
- [Import]
- public ExportedService Service { get; set; }
- }
- [Export]
- public class ExportedService
- {
- }
-
-
-
- private static ImportDefinition ImportFromContract(string contractName)
- {
- return ImportDefinitionFactory.CreateDefault(contractName,
-
- ImportCardinality.ZeroOrMore,
- false,
- false);
- }
-
- private static ImportDefinition ImportFromContractAndMetadata(string contractName, string[] metadataKeys, Type[] metadataValues)
- {
- Assert.AreEqual(metadataKeys.Length, metadataValues.Length);
- Dictionary<string, Type> requiredMetadata = new Dictionary<string, Type>();
- for (int i = 0; i < metadataKeys.Length; i++)
- {
- requiredMetadata.Add(metadataKeys[i], metadataValues[i]);
- }
-
- return new ContractBasedImportDefinition(contractName,
- (string)null,
- requiredMetadata,
- ImportCardinality.ZeroOrMore,
- false,
- false,
- CreationPolicy.Any);
- }
-
- private static CatalogExportProvider CreateCatalogExportProvider()
- {
- return CreateCatalogExportProvider(CatalogFactory.Create());
- }
-
- private static CatalogExportProvider CreateCatalogExportProvider(params ComposablePartDefinition[] definitions)
- {
- return CreateCatalogExportProvider(CatalogFactory.Create(definitions));
- }
-
- private static CatalogExportProvider CreateCatalogExportProvider(params ComposablePart[] parts)
- {
- return CreateCatalogExportProvider(CatalogFactory.Create(parts));
- }
-
- private static CatalogExportProvider CreateCatalogExportProvider(ComposablePartCatalog catalog)
- {
- return new CatalogExportProvider(catalog);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/CompositionBatchTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/CompositionBatchTests.cs deleted file mode 100644 index f43f56ed1e5..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/CompositionBatchTests.cs +++ /dev/null @@ -1,872 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Factories;
-using System.IO;
-using System.Linq;
-using System.Linq.Expressions;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Primitives;
-using System.Collections.ObjectModel;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class CompositionBatchTests
- {
- [TestMethod]
- public void Constructor1_PropertiesShouldBeSetAndEmpty()
- {
- CompositionBatch batch = new CompositionBatch();
-
- Assert.IsNotNull(batch.PartsToAdd);
- EnumerableAssert.IsEmpty(batch.PartsToAdd);
-
- Assert.IsNotNull(batch.PartsToRemove);
- EnumerableAssert.IsEmpty(batch.PartsToRemove);
- }
-
- [TestMethod]
- public void Constructor2_PropertiesShouldBeSetAndMatchArguments()
- {
- ComposablePart[] partsToAdd = new ComposablePart[] { PartFactory.Create(), PartFactory.Create(), PartFactory.Create() };
- ComposablePart[] partsToRemove = new ComposablePart[] { PartFactory.Create(), PartFactory.Create(), PartFactory.Create() };
-
-
- CompositionBatch batch = new CompositionBatch(partsToAdd, partsToRemove);
-
- Assert.IsNotNull(batch.PartsToAdd);
- Assert.IsNotNull(batch.PartsToRemove);
-
- EnumerableAssert.AreSequenceEqual(batch.PartsToAdd, partsToAdd);
- EnumerableAssert.AreSequenceEqual(batch.PartsToRemove, partsToRemove);
- }
-
-
- [TestMethod]
- public void Constructor2_PartsToAddAsNull_PartsToAddShouldBeEmpty()
- {
- ComposablePart[] partsToRemove = new ComposablePart[] { PartFactory.Create(), PartFactory.Create(), PartFactory.Create() };
-
- var batch = new CompositionBatch(null, partsToRemove);
-
- Assert.AreEqual(0, batch.PartsToAdd.Count);
- Assert.AreEqual(partsToRemove.Length, batch.PartsToRemove.Count);
- }
-
- [TestMethod]
- public void Constructor2_PartsToRemoveAsNull_PartsToRemoveShouldBeEmpty()
- {
- ComposablePart[] partsToAdd = new ComposablePart[] { PartFactory.Create(), PartFactory.Create(), PartFactory.Create() };
-
- var batch = new CompositionBatch(partsToAdd, null);
-
- Assert.AreEqual(partsToAdd.Length, batch.PartsToAdd.Count);
- Assert.AreEqual(0, batch.PartsToRemove.Count);
- }
-
- [TestMethod]
- public void Constructor2_PartsToAddHasNull_ShouldThrowArgumentNullException()
- {
- ComposablePart[] partsToAdd = new ComposablePart[] { PartFactory.Create(), null, PartFactory.Create() };
- ComposablePart[] partsToRemove = new ComposablePart[] { PartFactory.Create(), PartFactory.Create(), PartFactory.Create() };
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("partsToAdd", () =>
- {
- new CompositionBatch(partsToAdd, partsToRemove);
- });
- }
-
- [TestMethod]
- public void Constructor2_PartsToRemoveHasNull_ShouldThrowArgumentNullException()
- {
- ComposablePart[] partsToAdd = new ComposablePart[] { PartFactory.Create(), PartFactory.Create(), PartFactory.Create() };
- ComposablePart[] partsToRemove = new ComposablePart[] { PartFactory.Create(), null, PartFactory.Create() };
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("partsToRemove", () =>
- {
- new CompositionBatch(partsToAdd, partsToRemove);
- });
- }
-
- [TestMethod]
- public void AddPart_PartIsInPartsToAdd()
- {
- CompositionBatch batch = new CompositionBatch();
- ComposablePart part = PartFactory.Create();
-
- batch.AddPart(part);
-
- Assert.AreEqual(1, batch.PartsToAdd.Count);
- Assert.AreSame(part, batch.PartsToAdd[0]);
-
- EnumerableAssert.IsEmpty(batch.PartsToRemove);
- }
-
- [TestMethod]
- public void AddPart_PartAsNull_ShouldThrowArgumentNullException()
- {
- CompositionBatch batch = new CompositionBatch();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("part", () =>
- {
- batch.AddPart(null);
- });
- }
-
- [TestMethod]
- public void RemovePart_PartIsInPartsToRemove()
- {
- CompositionBatch batch = new CompositionBatch();
- ComposablePart part = PartFactory.Create();
-
- batch.RemovePart(part);
-
- Assert.AreEqual(1, batch.PartsToRemove.Count);
- Assert.AreSame(part, batch.PartsToRemove[0]);
-
- EnumerableAssert.IsEmpty(batch.PartsToAdd);
- }
-
- [TestMethod]
- public void RemovePart_PartAsNull_ShouldThrowArgumentNullException()
- {
- CompositionBatch batch = new CompositionBatch();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("part", () =>
- {
- batch.RemovePart(null);
- });
- }
-
- [TestMethod]
- public void PartsToAdd_ShouldGetCopiedAfterAdd()
- {
- CompositionBatch batch = new CompositionBatch();
- ComposablePart part1 = PartFactory.Create();
- ComposablePart part2 = PartFactory.Create();
-
- batch.AddPart(part1);
- Assert.IsTrue(batch.PartsToAdd.Contains(part1));
-
- ReadOnlyCollection<ComposablePart> partsToAddBeforeCopy = batch.PartsToAdd;
- Assert.AreSame(partsToAddBeforeCopy, batch.PartsToAdd);
-
- Assert.AreEqual(1, partsToAddBeforeCopy.Count);
- Assert.IsTrue(partsToAddBeforeCopy.Contains(part1));
-
- batch.AddPart(part2);
-
- ReadOnlyCollection<ComposablePart> partsToAddAfterCopy = batch.PartsToAdd;
- Assert.AreSame(partsToAddAfterCopy, batch.PartsToAdd);
-
- Assert.AreEqual(2, partsToAddAfterCopy.Count);
- Assert.IsTrue(partsToAddAfterCopy.Contains(part1));
- Assert.IsTrue(partsToAddAfterCopy.Contains(part2));
- Assert.AreNotSame(partsToAddBeforeCopy, partsToAddAfterCopy);
- }
-
- [TestMethod]
- public void PartsToRemove_ShouldGetCopiedAfterRemove()
- {
- CompositionBatch batch = new CompositionBatch();
- ComposablePart part1 = PartFactory.Create();
- ComposablePart part2 = PartFactory.Create();
-
- batch.RemovePart(part1);
- Assert.IsTrue(batch.PartsToRemove.Contains(part1));
-
- ReadOnlyCollection<ComposablePart> partsToRemoveBeforeCopy = batch.PartsToRemove;
- Assert.AreSame(partsToRemoveBeforeCopy, batch.PartsToRemove);
-
- Assert.AreEqual(1, partsToRemoveBeforeCopy.Count);
- Assert.IsTrue(partsToRemoveBeforeCopy.Contains(part1));
-
- batch.RemovePart(part2);
-
- ReadOnlyCollection<ComposablePart> partsToRemoveAfterCopy = batch.PartsToRemove;
- Assert.AreSame(partsToRemoveAfterCopy, batch.PartsToRemove);
-
- Assert.AreEqual(2, partsToRemoveAfterCopy.Count);
- Assert.IsTrue(partsToRemoveAfterCopy.Contains(part1));
- Assert.IsTrue(partsToRemoveAfterCopy.Contains(part2));
- Assert.AreNotSame(partsToRemoveBeforeCopy, partsToRemoveAfterCopy);
- }
-
-
- [TestMethod]
- public void AddExportedValue_NullAsContractNameArgument_ShouldThrowArgumentNull()
- {
- CompositionBatch batch = new CompositionBatch();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("contractName", () =>
- {
- batch.AddExportedValue((string)null, "Value");
- });
- }
-
- [TestMethod]
- public void AddExportedValue_EmptyStringAsContractNameArgument_ShouldThrowArgument()
- {
- CompositionBatch batch = new CompositionBatch();
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("contractName", () =>
- {
- batch.AddExportedValue("", "Value");
- });
- }
-
- [TestMethod]
- public void AddExport_NullAsExportArgument_ShouldThrowArgumentNull()
- {
- CompositionBatch batch = new CompositionBatch();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("export", () =>
- {
- batch.AddExport((Export)null);
- });
- }
-
-
- [TestMethod]
- public void AddExport_ExportWithNullExportedValueAsExportArgument_CanBeExported()
- {
- CompositionBatch batch = new CompositionBatch();
- var export = ExportFactory.Create("Contract", (object)null);
-
- batch.AddExport(export);
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- var result = this.GetSingleExport(batch.PartsToAdd[0], "Contract");
-
- Assert.IsNotNull(result);
- Assert.IsNull(result.Value);
- }
-
-
-
- [TestMethod]
- public void AddExportedValueOfT_NullAsExportedValueArgument_CanBeExported()
- {
- CompositionBatch batch = new CompositionBatch();
-
- batch.AddExportedValue<string>((string)null);
-
- Assert.AreEqual(1, batch.PartsToAdd.Count);
- var result = this.GetSingleLazy<string>(batch.PartsToAdd[0]);
-
- Assert.IsNotNull(result);
- Assert.IsNull(result.Value);
- }
-
- [TestMethod]
- public void AddExportedValue_NullAsExportedValueArgument_CanBeExported()
- {
- CompositionBatch batch = new CompositionBatch();
-
- batch.AddExportedValue("Contract", (string)null);
-
- Assert.AreEqual(1, batch.PartsToAdd.Count);
- var result = this.GetSingleExport(batch.PartsToAdd[0], "Contract");
-
- Assert.IsNotNull(result);
- Assert.IsNull(result.Value);
- }
-
- [TestMethod]
- public void AddExport_ExportWithEmptyMetadata_IsExportedWithEmptyMetadata()
- {
- CompositionBatch batch = new CompositionBatch();
- var export = ExportFactory.Create("Contract", "Value", new Dictionary<string, object>());
-
- Assert.AreEqual(0, export.Metadata.Count);
-
- batch.AddExport(export);
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- var result = this.GetSingleExport(batch.PartsToAdd[0], "Contract");
-
- Assert.AreEqual(0, result.Metadata.Count);
- }
-
- [TestMethod]
- public void AddExportedValueOfT_IsExportedWithEmptyMetadata()
- {
- CompositionBatch batch = new CompositionBatch();
-
- batch.AddExportedValue<string>("Value");
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- var result = this.GetSingleLazy<string>(batch.PartsToAdd[0]);
-
- Assert.AreEqual(1, result.Metadata.Count); // contains type identity
- }
-
- [TestMethod]
- public void AddExportedValue_IsExportedWithEmptyMetadata()
- {
- CompositionBatch batch = new CompositionBatch();
-
- batch.AddExportedValue("Contract", "Value");
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- var result = this.GetSingleExport(batch.PartsToAdd[0], "Contract");
-
- Assert.AreEqual(1, result.Metadata.Count); // contains type identity
- }
-
- [TestMethod]
- public void AddExport_ReturnedComposablePart_IsInAddedPartsCollection()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var export = ExportFactory.Create("Contract", "Value");
- var part = batch.AddExport(export);
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- Assert.AreEqual("Value", this.GetSingleExport(batch.PartsToAdd[0], "Contract").Value);
- Assert.IsTrue(batch.PartsToAdd.Contains(part));
- }
-
- [TestMethod]
- public void AddExportedValueOfT_ReturnedComposablePart_IsInAddedPartsCollection()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddExportedValue<string>("Value");
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- Assert.AreEqual("Value", this.GetSingleLazy<string>(batch.PartsToAdd[0]).Value);
- Assert.IsTrue(batch.PartsToAdd.Contains(part));
- }
-
- [TestMethod]
- public void AddExportedValue_ReturnedComposablePart_IsInAddedPartsCollection()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddExportedValue("Contract", "Value");
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- Assert.AreEqual("Value", this.GetSingleExport(batch.PartsToAdd[0], "Contract").Value);
- Assert.IsTrue(batch.PartsToAdd.Contains(part));
- }
-
- [TestMethod]
- public void AddExportedValueOfT_ExportAsExportedValueArgument_ShouldBeWrappedInExport()
- {
- CompositionBatch batch = new CompositionBatch();
- var export = ExportFactory.Create("Contract", "Value");
-
- batch.AddExportedValue<object>(export);
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- Assert.AreSame(export, this.GetSingleLazy<object>(batch.PartsToAdd[0]).Value);
- }
-
- [TestMethod]
- public void AddExportedValue_ExportAsExportedValueArgument_ShouldBeWrappedInExport()
- {
- CompositionBatch batch = new CompositionBatch();
- var export = ExportFactory.Create("Contract", "Value");
-
- batch.AddExportedValue(export);
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- Assert.AreSame(export, this.GetSingleLazy<Export>(batch.PartsToAdd[0]).Value);
- }
-
- [TestMethod]
- public void AddExport_ReturnedComposablePart_NullAsDefinitionArgumentToGetExportedValue_ShouldThrowArgumentNull()
- {
- CompositionBatch batch = new CompositionBatch();
- var export = ExportFactory.Create("Contract", "Value");
-
- var part = batch.AddExport(export);
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("definition", () =>
- {
- part.GetExportedValue((ExportDefinition)null);
- });
- }
-
- [TestMethod]
- public void AddExport_ReturnedComposablePart_WrongDefinitionAsDefinitionArgumentToGetExportedValue_ShouldThrowArgument()
- {
- CompositionBatch batch = new CompositionBatch();
- var export = ExportFactory.Create("Contract", "Value");
-
- var part = batch.AddExport(export);
- var definition = ExportDefinitionFactory.Create();
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("definition", () =>
- {
- part.GetExportedValue(definition);
- });
- }
-
- [TestMethod]
- public void AddExport_ReturnedComposablePart_NullAsDefinitionArgumentToSetImports_ShouldThrowArgumentNull()
- {
- CompositionBatch batch = new CompositionBatch();
- var export = ExportFactory.Create("Contract", "Value");
-
- var part = batch.AddExport(export);
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("definition", () =>
- {
- part.SetImport((ImportDefinition)null, Enumerable.Empty<Export>());
- });
- }
-
- [TestMethod]
- public void AddExport_ReturnedComposablePart_NullAsExportsArgumentToSetImports_ShouldThrowArgumentNull()
- {
- CompositionBatch batch = new CompositionBatch();
- var export = ExportFactory.Create("Contract", "Value");
-
- var part = batch.AddExport(export);
- var definition = ImportDefinitionFactory.Create();
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("exports", () =>
- {
- part.SetImport(definition, (IEnumerable<Export>)null);
- });
- }
-
- [TestMethod]
- public void AddExport_ReturnedComposablePart_ExportsArrayWithNullElementAsExportsArgumentToSetImports_ShouldThrowArgument()
- {
- CompositionBatch batch = new CompositionBatch();
- var export = ExportFactory.Create("Contract", "Value");
-
- var part = batch.AddExport(export);
- var definition = ImportDefinitionFactory.Create();
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("exports", () =>
- {
- part.SetImport(definition, new Export[] { null });
- });
- }
-
- [TestMethod]
- public void AddExport_ReturnedComposablePart_SetImports_ShouldThrowArgument()
- {
- CompositionBatch batch = new CompositionBatch();
- var export = ExportFactory.Create("Contract", "Value");
-
- var part = batch.AddExport(export);
- var definition = ImportDefinitionFactory.Create();
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("definition", () =>
- {
- part.SetImport(definition, Enumerable.Empty<Export>());
- });
- }
-
- [TestMethod]
- public void AddExport_ReturnedComposablePart_ContainsExportDefinitionRepresentingExport()
- {
- var metadata = new Dictionary<string, object>();
- metadata["Name"] = "Value";
-
- CompositionBatch batch = new CompositionBatch();
- var export = ExportFactory.Create("Contract", "Value", metadata);
-
- var part = batch.AddExport(export);
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- var definition = part.ExportDefinitions.Single();
-
- Assert.AreEqual("Contract", definition.ContractName);
- Assert.AreEqual("Value", part.GetExportedValue(definition));
- EnumerableAssert.AreEqual(metadata, definition.Metadata);
- }
-
- [TestMethod]
- public void AddExportedValueOfT_ReturnedComposablePart_ImportDefinitionsPropertyIsEmpty()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddExportedValue<string>("Value");
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- Assert.AreEqual(0, part.ImportDefinitions.Count());
- }
-
- [TestMethod]
- public void AddExportedValueOfT_ReturnedComposablePart_MetadataPropertyIsEmpty()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddExportedValue<string>("Value");
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- Assert.AreEqual(0, part.Metadata.Count);
- }
-
- [TestMethod]
- public void AddExportedValueOfT_ReturnedComposablePart_NullAsDefinitionArgumentToGetExportedValue_ShouldThrowArgumentNull()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddExportedValue<string>("Value");
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("definition", () =>
- {
- part.GetExportedValue((ExportDefinition)null);
- });
- }
-
- [TestMethod]
- public void AddExportedValueOfT_ReturnedComposablePart_WrongDefinitionAsDefinitionArgumentToGetExportedValue_ShouldThrowArgument()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddExportedValue<string>("Value");
- var definition = ExportDefinitionFactory.Create();
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("definition", () =>
- {
- part.GetExportedValue(definition);
- });
- }
-
- [TestMethod]
- public void AddExportedValueOfT_ReturnedComposablePart_NullAsDefinitionArgumentToSetImports_ShouldThrowArgumentNull()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddExportedValue<string>("Value");
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("definition", () =>
- {
- part.SetImport((ImportDefinition)null, Enumerable.Empty<Export>());
- });
- }
-
- [TestMethod]
- public void AddExportedValueOfT_ReturnedComposablePart_NullAsExportsArgumentToSetImports_ShouldThrowArgumentNull()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddExportedValue<string>("Value");
- var definition = ImportDefinitionFactory.Create();
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("exports", () =>
- {
- part.SetImport(definition, (IEnumerable<Export>)null);
- });
- }
-
- [TestMethod]
- public void AddExportedValueOfT_ReturnedComposablePart_ExportsArrayWithNullElementAsExportsArgumentToSetImports_ShouldThrowArgument()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddExportedValue<string>("Value");
- var definition = ImportDefinitionFactory.Create();
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("exports", () =>
- {
- part.SetImport(definition, new Export[] { null });
- });
- }
-
- [TestMethod]
- public void AddExportedValueOfT_ReturnedComposablePart_SetImports_ShouldThrowArgument()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddExportedValue<string>("Value");
- var definition = ImportDefinitionFactory.Create();
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("definition", () =>
- {
- part.SetImport(definition, Enumerable.Empty<Export>());
- });
- }
-
- [TestMethod]
- public void AddExportedValueOfT_ReturnedComposablePart_ContainsExportDefinitionRepresentingExport()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddExportedValue<string>("Value");
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- var definition = part.ExportDefinitions.Single();
-
- Assert.AreEqual(NameForType<string>(), definition.ContractName);
- Assert.AreEqual("Value", part.GetExportedValue(definition));
- Assert.AreEqual(1, definition.Metadata.Count); // contains type identity
- }
-
- [TestMethod]
- public void AddExportedValue_ReturnedComposablePart_ImportDefinitionsPropertyIsEmpty()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddExportedValue("Contract", "Value");
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- Assert.AreEqual(0, part.ImportDefinitions.Count());
- }
-
- [TestMethod]
- public void AddExportedValue_ReturnedComposablePart_MetadataPropertyIsEmpty()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddExportedValue("Contract", "Value");
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- Assert.AreEqual(0, part.Metadata.Count);
- }
-
- [TestMethod]
- public void AddExportedValue_ReturnedComposablePart_NullAsDefinitionArgumentToGetExportedValue_ShouldThrowArgumentNull()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddExportedValue("Contract", "Value");
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("definition", () =>
- {
- part.GetExportedValue((ExportDefinition)null);
- });
- }
-
- [TestMethod]
- public void AddExportedValue_ReturnedComposablePart_WrongDefinitionAsDefinitionArgumentToGetExportedValue_ShouldThrowArgument()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddExportedValue("Contract", "Value");
- var definition = ExportDefinitionFactory.Create();
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("definition", () =>
- {
- part.GetExportedValue(definition);
- });
- }
-
- [TestMethod]
- public void AddExportedValue_ReturnedComposablePart_NullAsDefinitionArgumentToSetImports_ShouldThrowArgumentNull()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddExportedValue("Contract", "Value");
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("definition", () =>
- {
- part.SetImport((ImportDefinition)null, Enumerable.Empty<Export>());
- });
- }
-
- [TestMethod]
- public void AddExportedValue_ReturnedComposablePart_NullAsExportsArgumentToSetImports_ShouldThrowArgumentNull()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddExportedValue("Contract", "Value");
- var definition = ImportDefinitionFactory.Create();
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("exports", () =>
- {
- part.SetImport(definition, (IEnumerable<Export>)null);
- });
- }
-
- [TestMethod]
- public void AddExportedValue_ReturnedComposablePart_ExportsArrayWithNullElementAsExportsArgumentToSetImports_ShouldThrowArgument()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddExportedValue("Contract", "Value");
- var definition = ImportDefinitionFactory.Create();
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("exports", () =>
- {
- part.SetImport(definition, new Export[] { null });
- });
- }
-
- [TestMethod]
- public void AddExportedValue_ReturnedComposablePart_WrongDefinitionAsDefinitionArgumentToSetImports_ShouldThrowArgument()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddExportedValue("Contract", "Value");
- var definition = ImportDefinitionFactory.Create();
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("definition", () =>
- {
- part.SetImport(definition, Enumerable.Empty<Export>());
- });
- }
-
-
- [TestMethod]
- public void AddExportedValue_ReturnedComposablePart_ContainsExportDefinitionRepresentingExport()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddExportedValue("Contract", "Value");
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- var definition = part.ExportDefinitions.Single();
-
- Assert.AreEqual("Contract", definition.ContractName);
- Assert.AreEqual("Value", part.GetExportedValue(definition));
- Assert.AreEqual(1, definition.Metadata.Count); // containts type identity
- }
-
-
- [TestMethod]
- public void AddPart_Int32ValueTypeAsAttributedPartArgument_ShouldThrowArgument()
- {
- CompositionBatch batch = new CompositionBatch();
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("attributedPart", () =>
- {
- batch.AddPart((object)10);
- });
- }
-
- [TestMethod]
- public void AddPart_ReturnedComposablePart_NullAsDefinitionArgumentToGetExportedValue_ShouldThrowArgumentNull()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddPart(new Int32Importer());
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("definition", () =>
- {
- part.GetExportedValue((ExportDefinition)null);
- });
- }
-
- [TestMethod]
- public void AddPart_ReturnedComposablePart_WrongDefinitionAsDefinitionArgumentToGetExportedValue_ShouldThrowArgument()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddPart(new Int32Importer());
- var definition = ExportDefinitionFactory.Create();
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("definition", () =>
- {
- part.GetExportedValue(definition);
- });
- }
-
- [TestMethod]
- public void AddPart_ReturnedComposablePart_NullAsDefinitionArgumentToSetImports_ShouldThrowArgumentNull()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddPart(new Int32Importer());
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("definition", () =>
- {
- part.SetImport((ImportDefinition)null, Enumerable.Empty<Export>());
- });
- }
-
- [TestMethod]
- public void AddPart_ReturnedComposablePart_NullAsExportsArgumentToSetImports_ShouldThrowArgumentNull()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddPart(new Int32Importer());
- var definition = ImportDefinitionFactory.Create();
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("exports", () =>
- {
- part.SetImport(definition, (IEnumerable<Export>)null);
- });
- }
-
- [TestMethod]
- public void AddPart_ReturnedComposablePart_ExportsArrayWithNullElementAsExportsArgumentToSetImports_ShouldThrowArgument()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddPart(new Int32Importer());
- var definition = part.ImportDefinitions.First();
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("exports", () =>
- {
- part.SetImport(definition, new Export[] { null });
- });
- }
-
- [TestMethod]
- public void AddPart_ReturnedComposablePart_WrongDefinitionAsDefinitionArgumentToSetImports_ShouldThrowArgument()
- {
- CompositionBatch batch = new CompositionBatch();
-
- var part = batch.AddPart(new Int32Importer());
- var definition = ImportDefinitionFactory.Create();
- Assert.AreEqual(1, batch.PartsToAdd.Count);
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("definition", () =>
- {
- part.SetImport(definition, Enumerable.Empty<Export>());
- });
- }
-
- private Export GetSingleLazy<T>(ComposablePart part)
- {
- return this.GetSingleExport(part, AttributedModelServices.GetContractName(typeof(T)));
- }
-
- private Export GetSingleExport(ComposablePart part, string contractName)
- {
- Assert.IsNotNull(part);
- Assert.AreEqual(0, part.Metadata.Count);
- Assert.AreEqual(1, part.ExportDefinitions.Count());
- Assert.AreEqual(0, part.ImportDefinitions.Count());
- ExportDefinition exportDefinition = part.ExportDefinitions.First();
- Assert.AreEqual(contractName, exportDefinition.ContractName);
-
- part.Activate();
-
- return new Export(exportDefinition, () => part.GetExportedValue(exportDefinition));
- }
-
-
- private static string NameForType<T>()
- {
- return AttributedModelServices.GetContractName(typeof(T));
- }
- }
-
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/CompositionTransactionTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/CompositionTransactionTests.cs deleted file mode 100644 index cf1dd30e887..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/CompositionTransactionTests.cs +++ /dev/null @@ -1,516 +0,0 @@ -using System;
-using System.Text;
-using System.Reflection;
-using System.Collections.Generic;
-
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Hosting;
-using System.UnitTesting;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- [TestClass]
- public class AtomicCompositionTests
- {
- [TestMethod]
- public void Constructor1()
- {
- var ct = new AtomicComposition();
- }
-
- [TestMethod]
- public void Constructor2()
- {
- // Null should be allowed
- var ct = new AtomicComposition(null);
-
- // Another AtomicComposition should be allowed
- var ct2 = new AtomicComposition(ct);
- }
-
- [TestMethod]
- public void Constructor2_MultipleTimes()
- {
- var outer = new AtomicComposition();
-
- var ct1 = new AtomicComposition(outer);
-
- ExceptionAssert.Throws<InvalidOperationException>(() => new AtomicComposition(outer));
- }
-
- [TestMethod]
- public void Dispose_AllMethodsShouldThrow()
- {
- var ct = new AtomicComposition();
-
- ct.Dispose();
-
- ExceptionAssert.ThrowsDisposed(ct, () => ct.AddCompleteAction(() => ct = null));
- ExceptionAssert.ThrowsDisposed(ct, () => ct.Complete());
- ExceptionAssert.ThrowsDisposed(ct, () => ct.SetValue(ct, 10));
- object value;
- ExceptionAssert.ThrowsDisposed(ct, () => ct.TryGetValue(ct, out value));
- }
-
- [TestMethod]
- public void AfterComplete_AllMethodsShouldThrow()
- {
- var ct = new AtomicComposition();
-
- ct.Complete();
-
- ExceptionAssert.Throws<InvalidOperationException>(() => ct.AddCompleteAction(() => ct = null));
- ExceptionAssert.Throws<InvalidOperationException>(() => ct.Complete());
- ExceptionAssert.Throws<InvalidOperationException>(() => ct.SetValue(ct, 10));
- object value;
- ExceptionAssert.Throws<InvalidOperationException>(() => ct.TryGetValue(ct, out value));
- }
-
- [TestMethod]
- public void SetValue_ToNull_ShouldBeAllowed()
- {
- var ct = new AtomicComposition();
-
- ct.SetValue(ct, null);
-
- object value = new object();
-
- Assert.IsTrue(ct.TryGetValue(ct, out value));
- Assert.IsNull(value);
- }
-
- [TestMethod]
- public void SetValue_ValueType_ShouldBeAllowed()
- {
- var ct = new AtomicComposition();
-
- ct.SetValue(ct, 45);
-
- int value;
-
- Assert.IsTrue(ct.TryGetValue(ct, out value));
- Assert.AreEqual(45, value);
- }
-
- [TestMethod]
- public void SetValue_Reference_ShouldBeAllowed()
- {
- var ct = new AtomicComposition();
-
- var sb = new StringBuilder();
- ct.SetValue(ct, sb);
-
- StringBuilder value;
-
- Assert.IsTrue(ct.TryGetValue(ct, out value));
- Assert.AreEqual(sb, value);
- }
-
- [TestMethod]
- public void SetValue_CauseResize_ShouldWorkFine()
- {
- var ct = new AtomicComposition();
-
- var keys = new List<object>();
- var values = new List<object>();
-
-
- for (int i = 0; i < 20; i++)
- {
- var key = new object();
- keys.Add(key);
- values.Add(i);
- ct.SetValue(key, i);
- }
-
- for (int i = 0; i < keys.Count; i++)
- {
- object value;
- Assert.IsTrue(ct.TryGetValue(keys[i], out value));
- Assert.AreEqual(i, value);
- }
- }
-
- [TestMethod]
- public void SetValue_ChangeOuterValuesWhileHaveInner_ShouldThrow()
- {
- var ct = new AtomicComposition();
-
- var ct2 = new AtomicComposition(ct);
-
- var key = new object();
- ExceptionAssert.Throws<InvalidOperationException>(() => ct.SetValue(key, 1));
-
- object value;
- Assert.IsFalse(ct2.TryGetValue(key, out value));
- Assert.IsFalse(ct.TryGetValue(key, out value));
-
- // remove the inner atomicComposition so the outer one becomes unlocked.
- ct2.Dispose();
-
- ct.SetValue(key, 2);
- Assert.IsTrue(ct.TryGetValue(key, out value));
- Assert.AreEqual(2, value);
- }
-
- [TestMethod]
- public void Complete_ShouldExecuteActions()
- {
- bool executedAction = false;
-
- var ct = new AtomicComposition();
-
- ct.AddCompleteAction(() => executedAction = true);
-
- ct.Complete();
-
- Assert.IsTrue(executedAction);
- }
-
- [TestMethod]
- public void Complete_ShouldCopyActionsToInner()
- {
- bool executedAction = false;
-
- var innerAtomicComposition = new AtomicComposition();
-
- using (var ct = new AtomicComposition(innerAtomicComposition))
- {
- ct.AddCompleteAction(() => executedAction = true);
-
- ct.Complete();
- Assert.IsFalse(executedAction, "Action should not have been exectued yet");
- }
-
- innerAtomicComposition.Complete();
- Assert.IsTrue(executedAction);
- }
-
- [TestMethod]
- public void Complete_ShouldCopyValuesToInner()
- {
- var innerAtomicComposition = new AtomicComposition();
-
- object value;
- using (var ct = new AtomicComposition(innerAtomicComposition))
- {
- ct.SetValue(this, 21);
-
- Assert.IsFalse(innerAtomicComposition.TryGetValue(this, out value));
-
- ct.Complete();
-
- Assert.IsTrue(innerAtomicComposition.TryGetValue(this, out value));
- Assert.AreEqual(21, value);
- }
-
- // reverify after dispose
- Assert.IsTrue(innerAtomicComposition.TryGetValue(this, out value));
- Assert.AreEqual(21, value);
- }
-
- [TestMethod]
- public void NoComplete_ShouldNotCopyActionsToInner()
- {
- bool executedAction = false;
-
- var innerAtomicComposition = new AtomicComposition();
-
- using (var ct = new AtomicComposition(innerAtomicComposition))
- {
- ct.AddCompleteAction(() => executedAction = true);
-
- Assert.IsFalse(executedAction, "Action should not have been exectued yet");
-
- // Do not complete
- }
-
- innerAtomicComposition.Complete();
- Assert.IsFalse(executedAction);
- }
-
- [TestMethod]
- public void NoComplete_ShouldNotCopyValuesToInner()
- {
- var innerAtomicComposition = new AtomicComposition();
-
- object value;
- using (var ct = new AtomicComposition(innerAtomicComposition))
- {
- ct.SetValue(this, 21);
-
- Assert.IsFalse(innerAtomicComposition.TryGetValue(this, out value));
-
- // Do not call complete
- }
-
- // reverify after dispose
- Assert.IsFalse(innerAtomicComposition.TryGetValue(this, out value));
- }
-
-
- [TestMethod]
- public void AtomicComposition_CompleteActions()
- {
- var setMe = false;
- var setMeToo = false;
- var dontSetMe = false;
- using (var contextA = new AtomicComposition())
- {
- contextA.AddCompleteAction(() => setMe = true);
- using (var contextB = new AtomicComposition(contextA))
- {
- contextB.AddCompleteAction(() => setMeToo = true);
- contextB.Complete();
- }
-
- using (var contextC = new AtomicComposition(contextA))
- {
- contextC.AddCompleteAction(() => dontSetMe = true);
- // Don't complete
- }
- Assert.IsFalse(setMe);
- Assert.IsFalse(setMeToo);
- Assert.IsFalse(dontSetMe);
-
- contextA.Complete();
-
- Assert.IsTrue(setMe);
- Assert.IsTrue(setMeToo);
- Assert.IsFalse(dontSetMe);
- }
- }
-
- private void TestNoValue(AtomicComposition context, object key)
- {
- string value;
- Assert.IsFalse(context.TryGetValue(key, out value));
- }
-
- private void TestValue(AtomicComposition context, object key, string expectedValue)
- {
- string value;
- Assert.IsTrue(context.TryGetValue(key, out value));
- Assert.AreEqual(expectedValue, value);
- }
-
- [TestMethod]
- public void AtomicComposition_CompleteValues()
- {
- object key1 = new Object();
- object key2 = new Object();
-
- using (var contextA = new AtomicComposition())
- {
- TestNoValue(contextA, key1);
- TestNoValue(contextA, key2);
- contextA.SetValue(key1, "Hello");
- TestValue(contextA, key1, "Hello");
- TestNoValue(contextA, key2);
-
- // Try overwriting
- using (var contextB = new AtomicComposition(contextA))
- {
- TestValue(contextB, key1, "Hello");
- TestNoValue(contextB, key2);
- contextB.SetValue(key1, "Greetings");
- TestValue(contextB, key1, "Greetings");
- TestNoValue(contextB, key2);
-
- contextB.Complete();
- }
- TestValue(contextA, key1, "Greetings");
- TestNoValue(contextA, key2);
-
- // Try overwrite with revert
- using (var contextC = new AtomicComposition(contextA))
- {
- TestValue(contextC, key1, "Greetings");
- TestNoValue(contextC, key2);
- contextC.SetValue(key1, "Goodbye");
- contextC.SetValue(key2, "Goodbye, Again");
- TestValue(contextC, key1, "Goodbye");
- TestValue(contextC, key2, "Goodbye, Again");
-
- // Don't complete
- }
- TestValue(contextA, key1, "Greetings");
- TestNoValue(contextA, key2);
-
- contextA.Complete();
- }
- }
-
- private void TestQuery(AtomicComposition context, object key, int parameter, bool expectation)
- {
- Func<int, bool> query;
- if (context.TryGetValue(key, out query))
- Assert.AreEqual(expectation, query(parameter));
- }
-
- private void SetQuery(AtomicComposition context, object key, Func<int, Func<int, bool>, bool> query)
- {
- Func<int, bool> parentQuery;
- context.TryGetValue(key, out parentQuery);
- Func<int, bool> queryFunction = parameter => { return query(parameter, parentQuery); };
- context.SetValue(key, queryFunction);
- }
-
- [TestMethod]
- public void AtomicComposition_NestedQueries()
- {
- // This is a rather convoluted test that exercises the way AtomicComposition used to work to
- // ensure consistency of the newer design
- var key = new Object();
-
- using (var contextA = new AtomicComposition())
- {
- SetQuery(contextA, key, (int parameter, Func<int, bool> parentQuery) =>
- {
- if (parameter == 22)
- return true;
- if (parentQuery != null)
- return parentQuery(parameter);
- return false;
- });
- TestQuery(contextA, key, 22, true);
-
- using (var contextB = new AtomicComposition(contextA))
- {
- TestQuery(contextB, key, 22, true);
- SetQuery(contextB, key, (int parameter, Func<int, bool> parentQuery) =>
- {
- if (parentQuery != null)
- return !parentQuery(parameter);
- Assert.Fail(); // Should never have no parent
- return false;
- });
- TestQuery(contextB, key, 21, true);
- TestQuery(contextB, key, 22, false);
-
- using (var contextC = new AtomicComposition(contextB))
- {
- SetQuery(contextC, key, (int parameter, Func<int, bool> parentQuery) =>
- {
- if (parameter == 23)
- return true;
- if (parentQuery != null)
- return !parentQuery(parameter);
- Assert.Fail(); // Should never have no parent
- return false;
- });
- TestQuery(contextC, key, 21, false);
- TestQuery(contextC, key, 22, true);
- TestQuery(contextC, key, 23, true);
- contextC.Complete();
- }
-
- using (var contextD = new AtomicComposition(contextB))
- {
- SetQuery(contextD, key, (int parameter, Func<int, bool> parentQuery) =>
- {
- if (parentQuery != null)
- return parentQuery(parameter + 1);
- Assert.Fail(); // Should never have no parent
- return false;
- });
- TestQuery(contextD, key, 21, true);
- TestQuery(contextD, key, 22, true);
- TestQuery(contextD, key, 23, false);
- // No complete
- }
-
- contextB.Complete();
- }
- TestQuery(contextA, key, 21, false);
- TestQuery(contextA, key, 22, true);
- TestQuery(contextA, key, 23, true);
- contextA.Complete();
- }
- }
-
- [TestMethod]
- public void AddRevertAction_ShouldExecuteWhenDisposedAndNotCompleteted()
- {
- var ct = new AtomicComposition();
- bool executed = false;
-
- ct.AddRevertAction(() => executed = true);
-
- ct.Dispose();
-
- Assert.IsTrue(executed);
- }
-
- [TestMethod]
- public void AddRevertAction_ShouldNotExecuteWhenCompleteted()
- {
- var ct = new AtomicComposition();
- bool executed = false;
-
- ct.AddRevertAction(() => executed = true);
-
- ct.Complete();
-
- Assert.IsFalse(executed);
-
- ct.Dispose();
-
- Assert.IsFalse(executed);
- }
-
- [TestMethod]
- public void AddRevertAction_ShouldExecuteInReverseOrder()
- {
- var ct = new AtomicComposition();
- Stack<int> stack = new Stack<int>();
- stack.Push(1);
- stack.Push(2);
- stack.Push(3);
-
- ct.AddRevertAction(() => Assert.AreEqual(1, stack.Pop()));
- ct.AddRevertAction(() => Assert.AreEqual(2, stack.Pop()));
- ct.AddRevertAction(() => Assert.AreEqual(3, stack.Pop()));
-
- ct.Dispose();
-
- Assert.IsTrue(stack.Count == 0);
- }
-
- [TestMethod]
- public void AddRevertAction_ShouldBeCopiedWhenCompleteed()
- {
- Stack<int> stack = new Stack<int>();
- stack.Push(1);
- stack.Push(2);
- stack.Push(11);
- stack.Push(12);
- stack.Push(3);
-
- using (var ct = new AtomicComposition())
- {
- ct.AddRevertAction(() => Assert.AreEqual(1, stack.Pop()));
- ct.AddRevertAction(() => Assert.AreEqual(2, stack.Pop()));
-
- using (var ct2 = new AtomicComposition(ct))
- {
- ct2.AddRevertAction(() => Assert.AreEqual(11, stack.Pop()));
- ct2.AddRevertAction(() => Assert.AreEqual(12, stack.Pop()));
-
- // completeting should move those revert actions to ct
- ct2.Complete();
-
- Assert.AreEqual(5, stack.Count);
- }
-
- ct.AddRevertAction(() => Assert.AreEqual(3, stack.Pop()));
-
- // Do not complete let ct dispose and revert
- }
-
- Assert.IsTrue(stack.Count == 0);
- }
-
-
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/DirectoryCatalogDebuggerProxyTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/DirectoryCatalogDebuggerProxyTests.cs deleted file mode 100644 index 9dfd4155727..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/DirectoryCatalogDebuggerProxyTests.cs +++ /dev/null @@ -1,171 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-#if !SILVERLIGHT
-
-using System;
-using System.ComponentModel.Composition.Hosting;
-using System.IO;
-using System.Linq;
-using System.UnitTesting;
-using System.Reflection;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition.Primitives
-{
- [TestClass]
- public class DirectoryCatalogDebuggerProxyTests
- {
- [TestMethod]
- public void Constructor_NullAsCatalogArgument_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("catalog", () =>
- {
- new DirectoryCatalog.DirectoryCatalogDebuggerProxy((DirectoryCatalog)null);
- });
- }
-
- [TestMethod]
- public void Constructor_ValueAsCatalogArgument_ShouldSetPartsProperty()
- {
- var expectations = Expectations.GetAssemblies();
-
- foreach (var e in expectations)
- {
- using (TemporaryFileCopier copier = new TemporaryFileCopier(e.Location))
- {
- var catalog = CreateDirectoryCatalog(copier.DirectoryPath);
-
- var proxy = new DirectoryCatalog.DirectoryCatalogDebuggerProxy(catalog);
-
- EnumerableAssert.AreSequenceEqual(catalog.Parts, proxy.Parts);
- }
- }
- }
-
- [TestMethod]
- public void Constructor_ValueAsCatalogArgument_ShouldSetAssemblyProperty()
- {
- var expectations = Expectations.GetAssemblies();
-
- using (TemporaryFileCopier copier = new TemporaryFileCopier(expectations.Select(assembly => assembly.Location).ToArray()))
- {
- var catalog = CreateDirectoryCatalog(copier.DirectoryPath);
- var proxy = new DirectoryCatalog.DirectoryCatalogDebuggerProxy(catalog);
-
- EnumerableAssert.AreEqual(expectations, proxy.Assemblies);
- }
- }
-
- [TestMethod]
- public void Constuctor_ValueAsCatalogArgument_ShouldSetPathProperty()
- {
- string path = FileIO.GetNewTemporaryDirectory();
-
- var catalog = CreateDirectoryCatalog(path);
- var proxy = new DirectoryCatalog.DirectoryCatalogDebuggerProxy(catalog);
-
- Assert.AreEqual(path, proxy.Path);
- }
-
- [TestMethod]
- public void Constuctor_ValueAsCatalogArgument_ShouldSetSearchPatternProperty()
- {
- using (TemporaryDirectory directory = new TemporaryDirectory())
- {
- var expectations = new ExpectationCollection<string, string>();
-
- expectations.Add("*.*", "*.*");
- expectations.Add("*.doc", "*.doc");
- expectations.Add("*.exe", "*.exe");
- expectations.Add("*.dll", "*.dll");
-
- foreach (var e in expectations)
- {
- var catalog = CreateDirectoryCatalog(directory.DirectoryPath, e.Input);
- var proxy = new DirectoryCatalog.DirectoryCatalogDebuggerProxy(catalog);
-
- Assert.AreEqual(e.Output, proxy.SearchPattern);
- }
- }
- }
-
- [TestMethod]
- public void FullPath_ValidPath_ShouldBeFine()
- {
- using (TemporaryDirectory directory = new TemporaryDirectory())
- {
- var expectations = new ExpectationCollection<string, string>();
-
- // Ensure the path is always normalized properly.
- string rootTempPath = Path.GetFullPath(FileIO.GetRootTemporaryDirectory()).ToUpperInvariant();
-
- // Note: These relative paths work properly because the unit test temporary directories are always
- // created as a subfolder off the AppDomain.CurrentDomain.BaseDirectory.
- expectations.Add(".", Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ".")).ToUpperInvariant());
- expectations.Add(FileIO.RootTemporaryDirectoryName, rootTempPath);
- expectations.Add(FileIO.GetRootTemporaryDirectory(), rootTempPath);
- expectations.Add(directory.DirectoryPath, Path.GetFullPath(directory.DirectoryPath).ToUpperInvariant());
-
- foreach (var e in expectations)
- {
- var cat = CreateDirectoryCatalog(e.Input, DirectoryCatalogTests.NonExistentSearchPattern);
- var proxy = new DirectoryCatalog.DirectoryCatalogDebuggerProxy(cat);
-
- Assert.AreEqual(e.Output, proxy.FullPath);
- }
- }
- }
-
- [TestMethod]
- public void LoadedFiles_EmptyDirectory_ShouldBeFine()
- {
- using (var directory = new TemporaryDirectory())
- {
- var cat = CreateDirectoryCatalog(directory.DirectoryPath);
- var proxy = new DirectoryCatalog.DirectoryCatalogDebuggerProxy(cat);
-
- Assert.AreEqual(0, proxy.LoadedFiles.Count);
- }
- }
-
- [TestMethod]
- public void LoadedFiles_ContainsMultipleDllsAndSomeNonDll_ShouldOnlyContainDlls()
- {
- using (var directory = new TemporaryDirectory())
- {
- // Add one text file
- using (File.CreateText(Path.Combine(directory.DirectoryPath, "Test.txt"))) { }
-
- // Add two dll's
- string dll1 = Path.Combine(directory.DirectoryPath, "Test1.dll");
- string dll2 = Path.Combine(directory.DirectoryPath, "Test2.dll");
- File.Copy(Assembly.GetExecutingAssembly().Location, dll1);
- File.Copy(Assembly.GetExecutingAssembly().Location, dll2);
-
- var cat = CreateDirectoryCatalog(directory.DirectoryPath);
- var proxy = new DirectoryCatalog.DirectoryCatalogDebuggerProxy(cat);
-
- CollectionAssert.AreEquivalent(new string[] { dll1.ToUpperInvariant(), dll2.ToUpperInvariant() },
- proxy.LoadedFiles);
- }
- }
-
- private DirectoryCatalog.DirectoryCatalogDebuggerProxy CreateAssemblyDebuggerProxy(DirectoryCatalog catalog)
- {
- return new DirectoryCatalog.DirectoryCatalogDebuggerProxy(catalog);
- }
-
- private DirectoryCatalog CreateDirectoryCatalog(string path)
- {
- return new DirectoryCatalog(path);
- }
-
- private DirectoryCatalog CreateDirectoryCatalog(string path, string filter)
- {
- return new DirectoryCatalog(path, filter);
- }
- }
-}
-
-#endif
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/DirectoryCatalogTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/DirectoryCatalogTests.cs deleted file mode 100644 index 3639a80cfe2..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/DirectoryCatalogTests.cs +++ /dev/null @@ -1,543 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-#if !SILVERLIGHT
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Factories;
-using System.IO;
-using System.Linq;
-using System.Linq.Expressions;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Primitives;
-using System.Reflection;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class DirectoryCatalogTests
- {
- internal const string NonExistentSearchPattern = "*.NonExistentSearchPattern";
-
- [TestMethod]
- public void ICompositionElementDisplayName_ShouldIncludeCatalogTypeNameAndDirectoryPath()
- {
- var paths = GetPathExpectations();
-
- foreach (var path in paths)
- {
- var catalog = (ICompositionElement)CreateDirectoryCatalog(path, NonExistentSearchPattern);
-
- string expected = string.Format("DirectoryCatalog (Path=\"{0}\")", path);
-
- Assert.AreEqual(expected, catalog.DisplayName);
- }
- }
-
- [TestMethod]
- public void ICompositionElementDisplayName_ShouldIncludeDerivedCatalogTypeNameAndAssemblyFullName()
- {
- var paths = GetPathExpectations();
-
- foreach (var path in paths)
- {
- var catalog = (ICompositionElement)new DerivedDirectoryCatalog(path, NonExistentSearchPattern);
-
- string expected = string.Format("DerivedDirectoryCatalog (Path=\"{0}\")", path);
-
- Assert.AreEqual(expected, catalog.DisplayName);
- }
- }
-
- [TestMethod]
- public void ToString_ShouldReturnICompositionElementDisplayName()
- {
- var paths = GetPathExpectations();
-
- foreach (var path in paths)
- {
- var catalog = (ICompositionElement)CreateDirectoryCatalog(path, NonExistentSearchPattern);
-
- Assert.AreEqual(catalog.DisplayName, catalog.ToString());
- }
- }
-
- [TestMethod]
- public void ICompositionElementDisplayName_WhenCatalogDisposed_ShouldNotThrow()
- {
- var catalog = CreateDirectoryCatalog();
- catalog.Dispose();
-
- var displayName = ((ICompositionElement)catalog).DisplayName;
- }
-
- [TestMethod]
- public void ICompositionElementOrigin_WhenCatalogDisposed_ShouldNotThrow()
- {
- var catalog = CreateDirectoryCatalog();
- catalog.Dispose();
-
- var origin = ((ICompositionElement)catalog).Origin;
- }
-
- [TestMethod]
- public void Parts_WhenCatalogDisposed_ShouldThrowObjectDisposed()
- {
- var catalog = CreateDirectoryCatalog();
- catalog.Dispose();
-
- ExceptionAssert.ThrowsDisposed(catalog, () =>
- {
- var parts = catalog.Parts;
- });
- }
-
- [TestMethod]
- public void GetExports_WhenCatalogDisposed_ShouldThrowObjectDisposed()
- {
- var catalog = CreateDirectoryCatalog();
- catalog.Dispose();
- var definition = ImportDefinitionFactory.Create();
-
- ExceptionAssert.ThrowsDisposed(catalog, () =>
- {
- catalog.GetExports(definition);
- });
- }
-
- [TestMethod]
- public void Refresh_WhenCatalogDisposed_ShouldThrowObjectDisposed()
- {
- var catalog = CreateDirectoryCatalog();
- catalog.Dispose();
-
- ExceptionAssert.ThrowsDisposed(catalog, () =>
- {
- catalog.Refresh();
- });
- }
-
- [TestMethod]
- public void ToString_WhenCatalogDisposed_ShouldNotThrow()
- {
- var catalog = CreateDirectoryCatalog();
- catalog.Dispose();
-
- catalog.ToString();
- }
-
- [TestMethod]
- public void GetExports_NullAsConstraintArgument_ShouldThrowArgumentNull()
- {
- var catalog = CreateDirectoryCatalog();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("definition", () =>
- {
- catalog.GetExports((ImportDefinition)null);
- });
- }
-
-
- [TestMethod]
- public void Dispose_ShouldNotThrow()
- {
- using (var catalog = CreateDirectoryCatalog())
- {
- }
- }
-
- [TestMethod]
- public void Dispose_CanBeCalledMultipleTimes()
- {
- var catalog = CreateDirectoryCatalog();
- catalog.Dispose();
- catalog.Dispose();
- catalog.Dispose();
- }
-
-
- [TestMethod]
- public void AddAssembly1_NonExistentUriAsAssemblyFileNameArgument_ShouldNotSupportedException()
- {
- ExceptionAssert.Throws<NotSupportedException>(() =>
- {
- var catalog = new DirectoryCatalog("http://microsoft.com/myassembly.dll");
- });
- }
-
- [TestMethod]
- public void AddAssembly1_NullPathArgument_ShouldThrowArugmentNull()
- {
- ExceptionAssert.Throws<ArgumentNullException>(() =>
- new DirectoryCatalog((string)null));
- }
-
- [TestMethod]
- public void AddAssembly1_EmptyPathArgument_ShouldThrowArugment()
- {
- ExceptionAssert.Throws<ArgumentException>(() =>
- new DirectoryCatalog(""));
- }
-
- [TestMethod]
- public void AddAssembly1_InvalidPathName_ShouldThrowDirectoryNotFound()
- {
- ExceptionAssert.Throws<ArgumentException>(() =>
- {
- var c1 = new DirectoryCatalog("*");
- });
- }
-
- [TestMethod]
- public void AddAssembly1_TooLongPathNameArgument_ShouldThrowPathTooLongException()
- {
- ExceptionAssert.Throws<PathTooLongException>(() =>
- {
- var c1 = new DirectoryCatalog(@"c:\This is a very long path\And Just to make sure\We will continue to make it very long\This is a very long path\And Just to make sure\We will continue to make it very long\This is a very long path\And Just to make sure\We will continue to make it very long\myassembly.dll");
- });
- }
-
-
- [TestMethod]
- public void Parts()
- {
- using (var directory = CreateTemporaryDirectory())
- {
- var catalog = new DirectoryCatalog(directory.DirectoryPath);
- Assert.IsNotNull(catalog.Parts);
- Assert.IsTrue(catalog.Parts.Count() > 0);
- }
- }
-
- [TestMethod]
- public void Parts_ShouldSetDefinitionOriginToCatalogItself()
- {
- using (var directory = CreateTemporaryDirectory())
- {
- var catalog = new DirectoryCatalog(directory.DirectoryPath);
- Assert.IsTrue(catalog.Parts.Count() > 0);
-
- foreach (ICompositionElement definition in catalog.Parts)
- {
- Assert.AreSame(catalog, definition.Origin);
- }
- }
- }
-
- [TestMethod]
- public void Path_ValidPath_ShouldBeFine()
- {
- using (var directory = CreateTemporaryDirectory())
- {
- var expectations = new ExpectationCollection<string, string>();
-
- expectations.Add(".", ".");
- expectations.Add(FileIO.RootTemporaryDirectoryName, FileIO.RootTemporaryDirectoryName);
- expectations.Add(FileIO.GetRootTemporaryDirectory(), FileIO.GetRootTemporaryDirectory());
- expectations.Add(directory.DirectoryPath, directory.DirectoryPath);
-
- foreach (var e in expectations)
- {
- var cat = CreateDirectoryCatalog(e.Input, NonExistentSearchPattern);
-
- Assert.AreEqual(e.Output, cat.Path);
- }
- }
- }
-
- [TestMethod]
- public void FullPath_ValidPath_ShouldBeFine()
- {
- using (var directory = CreateTemporaryDirectory())
- {
- var expectations = new ExpectationCollection<string, string>();
-
- // Ensure the path is always normalized properly.
- string rootTempPath = Path.GetFullPath(FileIO.GetRootTemporaryDirectory()).ToUpperInvariant();
-
- // Note: These relative paths work properly because the unit test temporary directories are always
- // created as a subfolder off the AppDomain.CurrentDomain.BaseDirectory.
- expectations.Add(".", Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ".")).ToUpperInvariant());
- expectations.Add(FileIO.RootTemporaryDirectoryName, rootTempPath);
- expectations.Add(FileIO.GetRootTemporaryDirectory(), rootTempPath);
- expectations.Add(directory.DirectoryPath, Path.GetFullPath(directory.DirectoryPath).ToUpperInvariant());
-
- foreach (var e in expectations)
- {
- var cat = CreateDirectoryCatalog(e.Input, NonExistentSearchPattern);
-
- Assert.AreEqual(e.Output, cat.FullPath);
- }
- }
- }
-
- [TestMethod]
- public void LoadedFiles_EmptyDirectory_ShouldBeFine()
- {
- using (var directory = new TemporaryDirectory())
- {
- var cat = new DirectoryCatalog(directory.DirectoryPath);
-
- Assert.AreEqual(0, cat.LoadedFiles.Count);
- }
- }
-
- [TestMethod]
- public void LoadedFiles_ContainsMultipleDllsAndSomeNonDll_ShouldOnlyContainDlls()
- {
- using (var directory = new TemporaryDirectory())
- {
- // Add one text file
- using (File.CreateText(Path.Combine(directory.DirectoryPath, "Test.txt"))) { }
-
- // Add two dll's
- string dll1 = Path.Combine(directory.DirectoryPath, "Test1.dll");
- string dll2 = Path.Combine(directory.DirectoryPath, "Test2.dll");
- File.Copy(Assembly.GetExecutingAssembly().Location, dll1);
- File.Copy(Assembly.GetExecutingAssembly().Location, dll2);
-
- var cat = new DirectoryCatalog(directory.DirectoryPath);
-
- CollectionAssert.AreEquivalent(new string[] { dll1.ToUpperInvariant(), dll2.ToUpperInvariant() },
- cat.LoadedFiles);
- }
- }
-
- [TestMethod]
- public void Constructor_InvalidAssembly_ShouldBeFine()
- {
- using (var directory = CreateTemporaryDirectory())
- {
- using (File.CreateText(Path.Combine(directory.DirectoryPath, "Test.dll"))) { }
- var cat = new DirectoryCatalog(directory.DirectoryPath);
- }
- }
-
- [TestMethod]
- public void Constructor_NonExistentDirectory_ShouldThrow()
- {
- using (var directory = CreateTemporaryDirectory())
- {
- ExceptionAssert.Throws<DirectoryNotFoundException>( () =>
- new DirectoryCatalog(directory.DirectoryPath + @"\NonexistentDirectoryWithoutEndingSlash"));
-
- ExceptionAssert.Throws<DirectoryNotFoundException>( () =>
- new DirectoryCatalog(directory.DirectoryPath + @"\NonexistentDirectoryWithEndingSlash\"));
-
- }
- }
-
- [TestMethod]
- public void Constructor_PassExistingFileName_ShouldThrow()
- {
- using (var directory = CreateTemporaryDirectory())
- {
- using (File.CreateText(Path.Combine(directory.DirectoryPath, "Test.txt"))) { }
- ExceptionAssert.Throws<IOException>(() =>
- new DirectoryCatalog(Path.Combine(directory.DirectoryPath, "Test.txt")));
- }
- }
-
- [TestMethod]
- public void Constructor_PassNonExistingFileName_ShouldThrow()
- {
- using (var directory = CreateTemporaryDirectory())
- {
- ExceptionAssert.Throws<DirectoryNotFoundException>(() =>
- new DirectoryCatalog(Path.Combine(directory.DirectoryPath, "NonExistingFile.txt")));
- }
- }
-
- [TestMethod]
- public void Refresh_AssemblyAdded_ShouldFireOnChanged()
- {
- using (var directory = new TemporaryDirectory())
- {
- bool changedFired = false;
- bool changingFired = false;
- var cat = new DirectoryCatalog(directory.DirectoryPath);
-
- Assert.AreEqual(0, cat.Parts.Count(), "Catalog should initially be empty");
-
- cat.Changing += new EventHandler<ComposablePartCatalogChangeEventArgs>((o, e) =>
- {
- Assert.AreEqual(0, cat.Parts.Count(), "Catalog changes should NOT have been completeed yet");
- changingFired = true;
- });
-
- cat.Changed += new EventHandler<ComposablePartCatalogChangeEventArgs>((o, e) =>
- {
- Assert.AreNotEqual(0, cat.Parts.Count(), "Catalog changes should have been completeed");
- changedFired = true;
- });
-
-
- File.Copy(Assembly.GetExecutingAssembly().Location, Path.Combine(directory.DirectoryPath, "Test.dll"));
-
- cat.Refresh();
-
- Assert.IsTrue(changingFired);
- Assert.IsTrue(changedFired);
- }
- }
-
- [TestMethod]
- public void Refresh_AssemblyRemoved_ShouldFireOnChanged()
- {
- using (var directory = CreateTemporaryDirectory())
- {
- string file = Path.Combine(directory.DirectoryPath, "Test.dll");
- File.Copy(Assembly.GetExecutingAssembly().Location, file);
- bool changedFired = false;
- var cat = new DirectoryCatalog(directory.DirectoryPath);
-
- cat.Changed += new EventHandler<ComposablePartCatalogChangeEventArgs>((o, e) =>
- changedFired = true);
-
- // This assembly can be deleted because it was already loaded by the CLR in another context
- // in another location so it isn't locked on disk.
- File.Delete(file);
-
- cat.Refresh();
-
- Assert.IsTrue(changedFired);
- }
- }
-
- [TestMethod]
- public void Refresh_NoChanges_ShouldNotFireOnChanged()
- {
- using (var directory = CreateTemporaryDirectory())
- {
- var cat = new DirectoryCatalog(directory.DirectoryPath);
-
- cat.Changed += new EventHandler<ComposablePartCatalogChangeEventArgs>((o, e) =>
- Assert.Fail("Should not recieve any change notifications"));
-
- cat.Refresh();
- }
- }
-
- [TestMethod]
- public void Refresh_DirectoryRemoved_ShouldThrowDirectoryNotFound()
- {
- DirectoryCatalog cat;
- using (var directory = CreateTemporaryDirectory())
- {
- cat = new DirectoryCatalog(directory.DirectoryPath);
- }
-
- ExceptionAssert.Throws<DirectoryNotFoundException>(RetryMode.DoNotRetry, () =>
- cat.Refresh());
- }
-
- [TestMethod]
- public void GetExports()
- {
- using (var directory = CreateTemporaryDirectory())
- {
- var catalog = new AggregateCatalog();
- Expression<Func<ExportDefinition, bool>> constraint = (ExportDefinition exportDefinition) => exportDefinition.ContractName == AttributedModelServices.GetContractName(typeof(MyExport));
- IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>> matchingExports = null;
-
- matchingExports = catalog.GetExports(constraint);
- Assert.IsNotNull(matchingExports);
- Assert.IsTrue(matchingExports.Count() == 0);
-
- var testsDirectoryCatalog = new DirectoryCatalog(directory.DirectoryPath);
- catalog.Catalogs.Add(testsDirectoryCatalog);
- matchingExports = catalog.GetExports(constraint);
-
- Assert.IsNotNull(matchingExports);
- Assert.IsTrue(matchingExports.Count() >= 0);
-
- IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>> expectedMatchingExports = catalog.Parts
- .SelectMany(part => part.ExportDefinitions, (part, export) => new Tuple<ComposablePartDefinition, ExportDefinition>(part, export))
- .Where(partAndExport => partAndExport.Item2.ContractName == AttributedModelServices.GetContractName(typeof(MyExport)));
-
- Assert.IsTrue(matchingExports.SequenceEqual(expectedMatchingExports));
-
- catalog.Catalogs.Remove(testsDirectoryCatalog);
- matchingExports = catalog.GetExports(constraint);
- Assert.IsNotNull(matchingExports);
- Assert.IsTrue(matchingExports.Count() == 0);
- }
- }
-
- [TestMethod]
- public void AddAndRemoveDirectory()
- {
- using (var directory = CreateTemporaryDirectory())
- {
- var cat = new AggregateCatalog();
- var container = new CompositionContainer(cat);
-
- Assert.IsFalse(container.IsPresent<MyExport>());
-
- var dir1 = new DirectoryCatalog(directory.DirectoryPath);
- cat.Catalogs.Add(dir1);
- Assert.IsTrue(container.IsPresent<MyExport>());
-
- cat.Catalogs.Remove(dir1);
-
- Assert.IsFalse(container.IsPresent<MyExport>());
- }
- }
-
- [TestMethod]
- public void AddDirectoryNotFoundException()
- {
- ExceptionAssert.Throws<DirectoryNotFoundException>(() =>
- {
- var cat = new DirectoryCatalog("Directory That Should Never Exist tadfasdfasdfsdf");
- });
- }
-
- [TestMethod]
- public void ExecuteOnCreationThread()
- {
- // Add a proper test for event notification on caller thread
- }
-
-
- private DirectoryCatalog CreateDirectoryCatalog()
- {
- return CreateDirectoryCatalog(FileIO.GetNewTemporaryDirectory());
- }
-
- private DirectoryCatalog CreateDirectoryCatalog(string path)
- {
- return new DirectoryCatalog(path);
- }
-
- private DirectoryCatalog CreateDirectoryCatalog(string path, string searchPattern)
- {
- return new DirectoryCatalog(path, searchPattern);
- }
-
- private TemporaryDirectory CreateTemporaryDirectory()
- {
- return new TemporaryFileCopier(typeof(DirectoryCatalogTests).Assembly.Location);
- }
-
- public IEnumerable<string> GetPathExpectations()
- {
- yield return AppDomain.CurrentDomain.BaseDirectory;
- yield return AppDomain.CurrentDomain.BaseDirectory + @"\";
- yield return ".";
- }
-
- private class DerivedDirectoryCatalog : DirectoryCatalog
- {
- public DerivedDirectoryCatalog(string path, string searchPattern)
- : base(path, searchPattern)
- {
- }
- }
- }
-}
-
-#endif
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/ImportEngineTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/ImportEngineTests.cs deleted file mode 100644 index 5119689ab2e..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/ImportEngineTests.cs +++ /dev/null @@ -1,567 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.UnitTesting;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class ImportEngineTests
- {
- [TestMethod]
- public void PreviewImports_Successful_NoAtomicComposition_ShouldBlockChanges()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- var import = ImportDefinitionFactory.Create("Value");
- var importer = PartFactory.CreateImporter(import);
-
- exportProvider.AddExport("Value", 21);
-
- engine.PreviewImports(importer, null);
-
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- exportProvider.AddExport("Value", 22));
-
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- exportProvider.RemoveExport("Value"));
-
- GC.KeepAlive(importer);
- }
-
- [TestMethod]
- public void PreviewImports_Unsuccessful_NoAtomicComposition_ShouldNotBlockChanges()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- var import = ImportDefinitionFactory.Create("Value");
- var importer = PartFactory.CreateImporter(import);
-
- ExceptionAssert.Throws<CompositionException>(() =>
- engine.PreviewImports(importer, null));
-
- exportProvider.AddExport("Value", 22);
- exportProvider.AddExport("Value", 23);
- exportProvider.RemoveExport("Value");
-
- GC.KeepAlive(importer);
- }
-
- [TestMethod]
- public void PreviewImports_Successful_AtomicComposition_Completeted_ShouldBlockChanges()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- var import = ImportDefinitionFactory.Create("Value");
- var importer = PartFactory.CreateImporter(import);
-
- exportProvider.AddExport("Value", 21);
-
- using (var atomicComposition = new AtomicComposition())
- {
- engine.PreviewImports(importer, atomicComposition);
- atomicComposition.Complete();
- }
-
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- exportProvider.AddExport("Value", 22));
-
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- exportProvider.RemoveExport("Value"));
-
- GC.KeepAlive(importer);
- }
-
- [TestMethod]
- public void PreviewImports_Successful_AtomicComposition_RolledBack_ShouldNotBlockChanges()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- var import = ImportDefinitionFactory.Create("Value");
- var importer = PartFactory.CreateImporter(import);
-
- exportProvider.AddExport("Value", 21);
-
- using (var atomicComposition = new AtomicComposition())
- {
- engine.PreviewImports(importer, atomicComposition);
-
- // Let atomicComposition get disposed thus rolledback
- }
-
- exportProvider.AddExport("Value", 22);
- exportProvider.RemoveExport("Value");
-
- GC.KeepAlive(importer);
- }
-
- [TestMethod]
- public void PreviewImports_Unsuccessful_AtomicComposition_ShouldNotBlockChanges()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- var import = ImportDefinitionFactory.Create("Value");
- var importer = PartFactory.CreateImporter(import);
-
- using (var atomicComposition = new AtomicComposition())
- {
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- engine.PreviewImports(importer, atomicComposition));
- }
-
- exportProvider.AddExport("Value", 22);
- exportProvider.AddExport("Value", 23);
- exportProvider.RemoveExport("Value");
-
- GC.KeepAlive(importer);
- }
-
- [TestMethod]
- public void PreviewImports_ReleaseImports_ShouldNotBlockChanges()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- var import = ImportDefinitionFactory.Create("Value");
- var importer = PartFactory.CreateImporter(import);
-
- exportProvider.AddExport("Value", 21);
-
- engine.PreviewImports(importer, null);
-
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- exportProvider.AddExport("Value", 22));
-
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- exportProvider.RemoveExport("Value"));
-
- engine.ReleaseImports(importer, null);
-
- exportProvider.AddExport("Value", 22);
- exportProvider.RemoveExport("Value");
-
- GC.KeepAlive(importer);
- }
-
- [TestMethod]
- public void PreviewImports_MissingOptionalImport_ShouldSucceed()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- var import = ImportDefinitionFactory.Create("Value", ImportCardinality.ZeroOrOne);
- var importer = PartFactory.CreateImporter(import);
-
- engine.PreviewImports(importer, null);
-
- GC.KeepAlive(importer);
- }
-
- [TestMethod]
- public void PreviewImports_ZeroCollectionImport_ShouldSucceed()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- var import = ImportDefinitionFactory.Create("Value", ImportCardinality.ZeroOrMore);
- var importer = PartFactory.CreateImporter(import);
-
- engine.PreviewImports(importer, null);
-
- GC.KeepAlive(importer);
- }
-
- [TestMethod]
- public void PreviewImports_MissingOptionalImport_NonRecomposable_ShouldNotBlockChanges()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- var import = ImportDefinitionFactory.Create("Value", ImportCardinality.ZeroOrOne, false, false);
- var importer = PartFactory.CreateImporter(import);
-
- engine.PreviewImports(importer, null);
-
- exportProvider.AddExport("Value", 21);
- exportProvider.AddExport("Value", 22);
- exportProvider.RemoveExport("Value");
-
- GC.KeepAlive(importer);
- }
-
- [TestMethod]
- public void PreviewImports_ZeroCollectionImport_NonRecomposable_ShouldNotBlockChanges()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- var import = ImportDefinitionFactory.Create("Value", ImportCardinality.ZeroOrMore, false, false);
- var importer = PartFactory.CreateImporter(import);
-
- engine.PreviewImports(importer, null);
-
- exportProvider.AddExport("Value", 21);
- exportProvider.AddExport("Value", 22);
- exportProvider.RemoveExport("Value");
-
- GC.KeepAlive(importer);
- }
-
- [TestMethod]
- public void SatisfyImports_NonRecomposable_ValueShouldNotChange()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- exportProvider.AddExport("Value", 21);
-
- var import = ImportDefinitionFactory.Create("Value", false);
- var importer = PartFactory.CreateImporter(import);
-
- engine.SatisfyImports(importer);
-
- Assert.AreEqual(21, importer.GetImport(import));
-
- // After rejection batch failures throw ChangeRejectedException to indicate that
- // the failure did not affect the container
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- exportProvider.ReplaceExportValue("Value", 42));
-
- Assert.AreEqual(21, importer.GetImport(import), "Value should not change!");
-
- GC.KeepAlive(importer);
- }
-
- [TestMethod]
- public void SatisfyImports_Recomposable_ValueShouldChange()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- exportProvider.AddExport("Value", 21);
-
- var import = ImportDefinitionFactory.Create("Value", true);
- var importer = PartFactory.CreateImporter(import);
-
- engine.SatisfyImports(importer);
-
- Assert.AreEqual(21, importer.GetImport(import));
-
- exportProvider.ReplaceExportValue("Value", 42);
-
- Assert.AreEqual(42, importer.GetImport(import), "Value should change!");
-
- GC.KeepAlive(importer);
- }
-
- [TestMethod]
- public void SatisfyImports_NonRecomposable_Prerequisite_ValueShouldNotChange()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- var import = ImportDefinitionFactory.Create("Value", false, true);
- var importer = PartFactory.CreateImporter(import);
-
- exportProvider.AddExport("Value", 21);
-
- engine.SatisfyImports(importer);
-
- Assert.AreEqual(21, importer.GetImport(import));
-
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- exportProvider.ReplaceExportValue("Value", 42));
-
- Assert.AreEqual(21, importer.GetImport(import), "Value should NOT change!");
-
- GC.KeepAlive(importer);
- }
-
- [TestMethod]
- public void SatisfyImports_Recomposable_Prerequisite_ValueShouldChange()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- var import = ImportDefinitionFactory.Create("Value", true, true);
- var importer = PartFactory.CreateImporter(import);
-
- exportProvider.AddExport("Value", 21);
-
- engine.SatisfyImports(importer);
-
- Assert.AreEqual(21, importer.GetImport(import));
-
- exportProvider.ReplaceExportValue("Value", 42);
-
- Assert.AreEqual(42, importer.GetImport(import), "Value should change!");
-
- GC.KeepAlive(importer);
- }
-
- [TestMethod]
- public void SatisfyImports_OneRecomposable_OneNotRecomposable()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- var import1 = ImportDefinitionFactory.Create("Value", true);
- var import2 = ImportDefinitionFactory.Create("Value", false);
- var importer = PartFactory.CreateImporter(import1, import2);
-
- exportProvider.AddExport("Value", 21);
-
- engine.SatisfyImports(importer);
-
- // Initial compose values should be 21
- Assert.AreEqual(21, importer.GetImport(import1));
- Assert.AreEqual(21, importer.GetImport(import2));
-
- // Reset value to ensure it doesn't get set to same value again
- importer.ResetImport(import1);
- importer.ResetImport(import2);
-
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- exportProvider.ReplaceExportValue("Value", 42));
-
- Assert.AreEqual(null, importer.GetImport(import1), "Value should NOT have been set!");
- Assert.AreEqual(null, importer.GetImport(import2), "Value should NOT have been set!");
-
- GC.KeepAlive(importer);
- }
-
- [TestMethod]
- public void SatisfyImports_TwoRecomposables_SingleExportValueChanged()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- var import1 = ImportDefinitionFactory.Create("Value1", true);
- var import2 = ImportDefinitionFactory.Create("Value2", true);
- var importer = PartFactory.CreateImporter(import1, import2);
-
- exportProvider.AddExport("Value1", 21);
- exportProvider.AddExport("Value2", 23);
-
- engine.SatisfyImports(importer);
-
- Assert.AreEqual(21, importer.GetImport(import1));
- Assert.AreEqual(23, importer.GetImport(import2));
-
- importer.ResetImport(import1);
- importer.ResetImport(import2);
-
- // Only change Value1
- exportProvider.ReplaceExportValue("Value1", 42);
-
- Assert.AreEqual(42, importer.GetImport(import1), "Value should have been set!");
-
- Assert.AreEqual(null, importer.GetImport(import2), "Value should NOT have changed to the value in the container.");
-
- GC.KeepAlive(importer);
- }
-
- [TestMethod]
- public void SatisfyImports_Recomposable_Unregister_ValueShouldChangeOnce()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- exportProvider.AddExport("Value", 21);
-
- var import = ImportDefinitionFactory.Create("Value", true);
- var importer = PartFactory.CreateImporter(import);
-
- engine.SatisfyImports(importer);
-
- Assert.AreEqual(21, importer.GetImport(import));
-
- exportProvider.ReplaceExportValue("Value", 42);
-
- Assert.AreEqual(42, importer.GetImport(import), "Value should change!");
-
- engine.ReleaseImports(importer, null);
-
- exportProvider.ReplaceExportValue("Value", 666);
-
- Assert.AreEqual(42, importer.GetImport(import), "Value should not change!");
-
- GC.KeepAlive(importer);
- }
-
- [TestMethod]
- public void SatisfyImports_MissingOptionalImport_NonRecomposable_ShouldNotBlockChanges()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- var import = ImportDefinitionFactory.Create("Value", ImportCardinality.ZeroOrOne, false, false);
- var importer = PartFactory.CreateImporter(import);
-
- exportProvider.AddExport("Value", 20);
-
- engine.SatisfyImports(importer);
-
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- exportProvider.AddExport("Value", 21));
-
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- exportProvider.RemoveExport("Value"));
-
- GC.KeepAlive(importer);
- }
-
- [TestMethod]
- public void SatisfyImports_ZeroCollectionImport_NonRecomposable_ShouldNotBlockChanges()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- var import = ImportDefinitionFactory.Create("Value", ImportCardinality.ZeroOrMore, false, false);
- var importer = PartFactory.CreateImporter(import);
-
- exportProvider.AddExport("Value", 20);
-
- engine.SatisfyImports(importer);
-
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- exportProvider.AddExport("Value", 21));
-
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- exportProvider.RemoveExport("Value"));
-
- GC.KeepAlive(importer);
- }
-
- [TestMethod]
- public void SatisfyImports_MissingOptionalImport_Recomposable_ShouldNotBlockChanges()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- var import = ImportDefinitionFactory.Create("Value", ImportCardinality.ZeroOrOne, true, false);
- var importer = PartFactory.CreateImporter(import);
-
- exportProvider.AddExport("Value", 20);
-
- engine.SatisfyImports(importer);
-
- exportProvider.AddExport("Value", 21);
- exportProvider.RemoveExport("Value");
-
- GC.KeepAlive(importer);
- }
-
- [TestMethod]
- public void SatisfyImports_ZeroCollectionImport_Recomposable_ShouldNotBlockChanges()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- var import = ImportDefinitionFactory.Create("Value", ImportCardinality.ZeroOrMore, true, false);
- var importer = PartFactory.CreateImporter(import);
-
- exportProvider.AddExport("Value", 20);
-
- engine.SatisfyImports(importer);
-
- exportProvider.AddExport("Value", 21);
- exportProvider.RemoveExport("Value");
-
- GC.KeepAlive(importer);
- }
-
- [TestMethod]
- public void SatisfyImportsOnce_Recomposable_ValueShouldNotChange_NoRecompositionRequested()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- exportProvider.AddExport("Value", 21);
-
- var import = ImportDefinitionFactory.Create("Value", true);
- var importer = PartFactory.CreateImporter(import);
-
- engine.SatisfyImportsOnce(importer);
-
- Assert.AreEqual(21, importer.GetImport(import));
-
- exportProvider.ReplaceExportValue("Value", 42);
-
- Assert.AreEqual(21, importer.GetImport(import), "Value should not change!");
-
- GC.KeepAlive(importer);
- }
-
- [TestMethod]
- public void SatisifyImportsOnce_Recomposable_ValueShouldNotChange_NoRecompositionRequested_ViaNonArgumentSignature()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- exportProvider.AddExport("Value", 21);
-
- var import = ImportDefinitionFactory.Create("Value", true);
- var importer = PartFactory.CreateImporter(import);
-
- engine.SatisfyImportsOnce(importer);
-
- Assert.AreEqual(21, importer.GetImport(import));
-
- exportProvider.ReplaceExportValue("Value", 42);
-
- Assert.AreEqual(21, importer.GetImport(import), "Value should not change!");
-
- GC.KeepAlive(importer);
- }
-
- [TestMethod]
- public void SatisfyImportsOnce_Successful_ShouldNotBlockChanges()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- var import = ImportDefinitionFactory.Create("Value");
- var importer = PartFactory.CreateImporter(import);
-
- exportProvider.AddExport("Value", 21);
-
- engine.SatisfyImportsOnce(importer);
-
- exportProvider.AddExport("Value", 22);
- exportProvider.RemoveExport("Value");
-
- GC.KeepAlive(importer);
- }
-
- [TestMethod]
- public void SatisfyImportsOnce_Unsuccessful_ShouldNotBlockChanges()
- {
- var exportProvider = ExportProviderFactory.CreateRecomposable();
- var engine = new ImportEngine(exportProvider);
-
- var import = ImportDefinitionFactory.Create("Value");
- var importer = PartFactory.CreateImporter(import);
-
- ExceptionAssert.Throws<CompositionException>(() =>
- engine.SatisfyImportsOnce(importer));
-
- exportProvider.AddExport("Value", 22);
- exportProvider.AddExport("Value", 23);
- exportProvider.RemoveExport("Value");
-
- GC.KeepAlive(importer);
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/TypeCatalogTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/TypeCatalogTests.cs deleted file mode 100644 index 2d1499101f8..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Hosting/TypeCatalogTests.cs +++ /dev/null @@ -1,506 +0,0 @@ -//------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.UnitTesting;
-using System.IO;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Reflection;
-using System.UnitTesting;
-using Microsoft.Internal;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.Globalization;
-using System.Text;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class TypeCatalogTests
- {
- [TestMethod]
- public void Constructor2_NullAsTypesArgument_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("types", () =>
- {
- new TypeCatalog((Type[])null);
- });
- }
-
- [TestMethod]
- public void Constructor3_NullAsTypesArgument_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("types", () =>
- {
- new TypeCatalog((IEnumerable<Type>)null);
- });
- }
-
- [TestMethod]
- public void Constructor2_ArrayWithNullAsTypesArgument_ShouldThrowArgument()
- {
- ExceptionAssert.ThrowsArgument<ArgumentException>("types", () =>
- {
- new TypeCatalog(new Type[] { null });
- });
- }
-
- [TestMethod]
- public void Constructor3_ArrayWithNullAsTypesArgument_ShouldThrowArgument()
- {
- ExceptionAssert.ThrowsArgument<ArgumentException>("types", () =>
- {
- new TypeCatalog((IEnumerable<Type>)new Type[] { null });
- });
- }
-
- [TestMethod]
- public void Constructor2_EmptyEnumerableAsTypesArgument_ShouldSetPartsPropertyToEmptyEnumerable()
- {
- var catalog = new TypeCatalog(Enumerable.Empty<Type>());
-
- EnumerableAssert.IsEmpty(catalog.Parts);
- }
-
- [TestMethod]
- public void Constructor3_EmptyArrayAsTypesArgument_ShouldSetPartsPropertyToEmpty()
- {
- var catalog = new TypeCatalog(new Type[0]);
-
- EnumerableAssert.IsEmpty(catalog.Parts);
- }
-
- [TestMethod]
- public void Constructor2_ArrayAsTypesArgument_ShouldNotAllowModificationAfterConstruction()
- {
- var types = new Type[] { PartFactory.GetAttributedExporterType() };
- var catalog = new TypeCatalog(types);
-
- types[0] = null;
-
- Assert.IsNotNull(catalog.Parts.First());
- }
-
- [TestMethod]
- public void Constructor3_ArrayAsTypesArgument_ShouldNotAllowModificationAfterConstruction()
- {
- var types = new Type[] { PartFactory.GetAttributedExporterType() };
- var catalog = new TypeCatalog((IEnumerable<Type>)types);
-
- types[0] = null;
-
- Assert.IsNotNull(catalog.Parts.First());
- }
-
- [TestMethod]
- public void Constructor2_ShouldSetOriginToNull()
- {
- var catalog = (ICompositionElement)new TypeCatalog(PartFactory.GetAttributedExporterType());
-
- Assert.IsNull(catalog.Origin);
- }
-
- [TestMethod]
- public void Constructor3_ShouldSetOriginToNull()
- {
- var catalog = (ICompositionElement)new TypeCatalog((IEnumerable<Type>)new Type[] { PartFactory.GetAttributedExporterType() });
-
- Assert.IsNull(catalog.Origin);
- }
-
- [TestMethod]
- public void DisplayName_WhenCatalogDisposed_ShouldNotThrow()
- {
- var catalog = CreateTypeCatalog();
- catalog.Dispose();
-
- var displayName = ((ICompositionElement)catalog).DisplayName;
- }
-
- [TestMethod]
- public void Origin_WhenCatalogDisposed_ShouldNotThrow()
- {
- var catalog = CreateTypeCatalog();
- catalog.Dispose();
-
- var origin = ((ICompositionElement)catalog).Origin;
- }
-
- [TestMethod]
- public void Parts_WhenCatalogDisposed_ShouldThrowObjectDisposed()
- {
- var catalog = CreateTypeCatalog();
- catalog.Dispose();
-
- ExceptionAssert.ThrowsDisposed(catalog, () =>
- {
- var parts = catalog.Parts;
- });
- }
-
- [TestMethod]
- public void ToString_WhenCatalogDisposed_ShouldNotThrow()
- {
- var catalog = CreateTypeCatalog();
- catalog.Dispose();
-
- catalog.ToString();
- }
-
-
- [TestMethod]
- public void GetExports_WhenCatalogDisposed_ShouldThrowObjectDisposed()
- {
- var catalog = CreateTypeCatalog();
- catalog.Dispose();
- var definition = ImportDefinitionFactory.Create();
-
- ExceptionAssert.ThrowsDisposed(catalog, () =>
- {
- catalog.GetExports(definition);
- });
- }
-
- [TestMethod]
- public void GetExports_NullAsConstraintArgument_ShouldThrowArgumentNull()
- {
- var catalog = CreateTypeCatalog();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("definition", () =>
- {
- catalog.GetExports((ImportDefinition)null);
- });
- }
-
- [TestMethod]
- public void Dispose_ShouldNotThrow()
- {
- using (var catalog = CreateTypeCatalog())
- {
- }
- }
-
- [TestMethod]
- public void Dispose_CanBeCalledMultipleTimes()
- {
- var catalog = CreateTypeCatalog();
- catalog.Dispose();
- catalog.Dispose();
- catalog.Dispose();
- }
-
-
- [TestMethod]
- public void Parts()
- {
- var catalog = new TypeCatalog(Assembly.GetExecutingAssembly().GetTypes());
- Assert.IsNotNull(catalog.Parts);
- Assert.IsTrue(catalog.Parts.Count()>0);
- }
-
- [TestMethod]
- public void Parts_ShouldSetDefinitionOriginToCatalogItself()
- {
- var catalog = CreateTypeCatalog();
- Assert.IsTrue(catalog.Parts.Count() > 0);
-
- foreach (ICompositionElement definition in catalog.Parts)
- {
- Assert.AreSame(catalog, definition.Origin);
- }
- }
-
-
- [TestMethod]
- public void ICompositionElementDisplayName_SingleTypeAsTypesArgument_ShouldIncludeCatalogTypeNameAndTypeFullName()
- {
- var expectations = Expectations.GetAttributedTypes();
-
- foreach (var e in expectations)
- {
- var catalog = (ICompositionElement)CreateTypeCatalog(e);
-
- string expected = string.Format(Strings.TypeCatalog_DisplayNameFormat, typeof(TypeCatalog).Name, e.FullName);
-
- Assert.AreEqual(expected, catalog.DisplayName);
- }
- }
-
- [TestMethod]
- public void ICompositionElementDisplayName_ValueAsTypesArgument_ShouldIncludeCatalogTypeNameAndTypeFullNames()
- {
- var expectations = new ExpectationCollection<Type[], string>();
- expectations.Add(new Type[] { typeof(Type) },
- GetDisplayName(false, typeof(TypeCatalog)));
-
- expectations.Add(new Type[] { typeof(ExportValueTypeSingleton) },
- GetDisplayName(false, typeof(TypeCatalog), typeof(ExportValueTypeSingleton)));
-
- expectations.Add(new Type[] { typeof(ExportValueTypeSingleton), typeof(ExportValueTypeSingleton) },
- GetDisplayName(false, typeof(TypeCatalog), typeof(ExportValueTypeSingleton), typeof(ExportValueTypeSingleton)));
-
- expectations.Add(new Type[] { typeof(ExportValueTypeSingleton), typeof(string), typeof(ExportValueTypeSingleton) },
- GetDisplayName(false, typeof(TypeCatalog), typeof(ExportValueTypeSingleton), typeof(ExportValueTypeSingleton)));
-
- expectations.Add(new Type[] { typeof(ExportValueTypeSingleton), typeof(ExportValueTypeFactory) },
- GetDisplayName(false, typeof(TypeCatalog), typeof(ExportValueTypeSingleton), typeof(ExportValueTypeFactory)));
-
- expectations.Add(new Type[] { typeof(ExportValueTypeSingleton), typeof(ExportValueTypeFactory), typeof(CallbackExecuteCodeDuringCompose) },
- GetDisplayName(true, typeof(TypeCatalog), typeof(ExportValueTypeSingleton), typeof(ExportValueTypeFactory)));
-
- foreach (var e in expectations)
- {
- var catalog = (ICompositionElement)CreateTypeCatalog(e.Input);
-
- Assert.AreEqual(e.Output, catalog.DisplayName);
- }
- }
-
- [TestMethod]
- public void ICompositionElementDisplayName_ShouldIncludeDerivedCatalogTypeNameAndTypeFullNames()
- {
- var expectations = Expectations.GetAttributedTypes();
-
- foreach (var e in expectations)
- {
- var catalog = (ICompositionElement)new DerivedTypeCatalog(e);
-
- string expected = string.Format(Strings.TypeCatalog_DisplayNameFormat, typeof(DerivedTypeCatalog).Name, e.FullName);
-
- Assert.AreEqual(expected, catalog.DisplayName);
- }
- }
-
- [TestMethod]
- public void ToString_ShouldReturnICompositionElementDisplayName()
- {
- var expectations = Expectations.GetAttributedTypes();
-
- foreach (var e in expectations)
- {
- var catalog = (ICompositionElement)CreateTypeCatalog(e);
-
- Assert.AreEqual(catalog.DisplayName, catalog.ToString());
- }
- }
-
-
- [TestMethod]
- public void GetExports()
- {
- var catalog = new TypeCatalog(Assembly.GetExecutingAssembly().GetTypes());
- Expression<Func<ExportDefinition, bool>> constraint = (ExportDefinition exportDefinition) => exportDefinition.ContractName == AttributedModelServices.GetContractName(typeof(MyExport));
- IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>> matchingExports = catalog.GetExports(constraint);
- Assert.IsNotNull(matchingExports);
- Assert.IsTrue(matchingExports.Count() >= 0);
-
- IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>> expectedMatchingExports = catalog.Parts
- .SelectMany(part => part.ExportDefinitions, (part, export) => new Tuple<ComposablePartDefinition, ExportDefinition>(part, export))
- .Where(partAndExport => partAndExport.Item2.ContractName == AttributedModelServices.GetContractName(typeof(MyExport)));
- Assert.IsTrue(matchingExports.SequenceEqual(expectedMatchingExports));
- }
-
- [TestMethod]
- public void TwoTypesWithSameSimpleName()
- {
- var catalog = new TypeCatalog(Assembly.GetExecutingAssembly().GetTypes());
- var container = new CompositionContainer(catalog);
-
- NotSoUniqueName unique1 = container.GetExportedValue<NotSoUniqueName>();
-
- Assert.IsNotNull(unique1);
-
- Assert.AreEqual(23, unique1.MyIntProperty);
-
- NotSoUniqueName2.NotSoUniqueName nestedUnique = container.GetExportedValue<NotSoUniqueName2.NotSoUniqueName>();
-
- Assert.IsNotNull(nestedUnique);
-
- Assert.AreEqual("MyStringProperty", nestedUnique.MyStringProperty);
- }
-
- [TestMethod]
- public void GettingFunctionExports()
- {
- var catalog = new TypeCatalog(Assembly.GetExecutingAssembly().GetTypes());
- var container = new CompositionContainer(catalog);
-
- ImportDefaultFunctions import = container.GetExportedValue<ImportDefaultFunctions>("ImportDefaultFunctions");
- import.VerifyIsBound();
- }
-
- [TestMethod]
- public void AnExportOfAnInstanceThatFailsToCompose()
- {
- var catalog = new TypeCatalog(Assembly.GetExecutingAssembly().GetTypes());
- var container = new CompositionContainer(catalog);
-
- // Rejection causes the part in the catalog whose imports cannot be
- // satisfied to be ignored, resulting in a cardinality mismatch instead of a
- // composition exception
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- {
- container.GetExportedValue<string>("ExportMyString");
- });
- }
-
- [TestMethod]
- public void SharedPartCreation()
- {
- var catalog = new TypeCatalog(Assembly.GetExecutingAssembly().GetTypes());
- var container = new CompositionContainer(catalog);
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(new Int32Exporter(41));
- container.Compose(batch);
-
- var sharedPart1 = container.GetExportedValue<MySharedPartExport>();
- Assert.AreEqual(41, sharedPart1.Value);
- var sharedPart2 = container.GetExportedValue<MySharedPartExport>();
- Assert.AreEqual(41, sharedPart2.Value);
-
- Assert.AreEqual(sharedPart1, sharedPart2, "These should be the same instances");
- }
-
- [TestMethod]
- public void NonSharedPartCreation()
- {
- var catalog = new TypeCatalog(Assembly.GetExecutingAssembly().GetTypes());
- var container = new CompositionContainer(catalog);
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(new Int32Exporter(41));
- container.Compose(batch);
-
- var nonSharedPart1 = container.GetExportedValue<MyNonSharedPartExport>();
- Assert.AreEqual(41, nonSharedPart1.Value);
- var nonSharedPart2 = container.GetExportedValue<MyNonSharedPartExport>();
- Assert.AreEqual(41, nonSharedPart2.Value);
-
- Assert.AreNotEqual(nonSharedPart1, nonSharedPart2, "These should be different instances");
- }
-
- [TestMethod]
- public void RecursiveNonSharedPartCreation()
- {
- var catalog = new TypeCatalog(Assembly.GetExecutingAssembly().GetTypes());
- var container = new CompositionContainer(catalog);
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotGetExportedValue, () =>
- {
- container.GetExportedValue<DirectCycleNonSharedPart>();
- });
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotGetExportedValue, () =>
- {
- container.GetExportedValue<CycleNonSharedPart>();
- });
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotGetExportedValue, () =>
- {
- container.GetExportedValue<CycleNonSharedPart1>();
- });
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotGetExportedValue, () =>
- {
- container.GetExportedValue<CycleNonSharedPart2>();
- });
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotGetExportedValue, () =>
- {
- container.GetExportedValue<CycleWithSharedPartAndNonSharedPart>();
- });
-
- Assert.IsNotNull(container.GetExportedValue<CycleSharedPart>());
- Assert.IsNotNull(container.GetExportedValue<CycleSharedPart1>());
- Assert.IsNotNull(container.GetExportedValue<CycleSharedPart2>());
- Assert.IsNotNull(container.GetExportedValue<NoCycleNonSharedPart>());
- }
-
- [TestMethod]
- public void TryToDiscoverExportWithGenericParameter()
- {
- var catalog = new TypeCatalog(Assembly.GetExecutingAssembly().GetTypes());
- var container = new CompositionContainer(catalog);
-
- // Open generic should fail because we should discover that type
- Assert.IsNull(container.GetExportedValueOrDefault<object>(AttributedModelServices.GetContractName(typeof(ExportWithGenericParameter<>))));
-
- // This specific generic was not exported any where so it should fail
- Assert.IsNull(container.GetExportedValueOrDefault<object>(AttributedModelServices.GetContractName(typeof(ExportWithGenericParameter<double>))));
-
- // This specific generic was exported so it should succeed
- Assert.IsNotNull(container.GetExportedValueOrDefault<object>(AttributedModelServices.GetContractName(typeof(ExportWithGenericParameter<int>))));
-
- // Shouldn't discovoer static type with open generic
- Assert.IsNull(container.GetExportedValueOrDefault<object>(AttributedModelServices.GetContractName(typeof(StaticExportWithGenericParameter<>))));
-
- // Should find a type that inherits from an export
- Assert.IsNotNull(container.GetExportedValueOrDefault<object>(AttributedModelServices.GetContractName(typeof(ExportWhichInheritsFromGeneric))));
-
- // This should be exported because it is inherited by ExportWhichInheritsFromGeneric
- Assert.IsNotNull(container.GetExportedValueOrDefault<object>(AttributedModelServices.GetContractName(typeof(ExportWithGenericParameter<string>))));
- }
-
- private string GetDisplayName(bool useEllipses, Type catalogType, params Type[] types)
- {
- return String.Format(CultureInfo.CurrentCulture,
- Strings.TypeCatalog_DisplayNameFormat,
- catalogType.Name,
- this.GetTypesDisplay(useEllipses, types));
- }
-
- private string GetTypesDisplay(bool useEllipses, Type[] types)
- {
- int count = types.Length;
- if (count == 0)
- {
- return Strings.TypeCatalog_Empty;
- }
-
- StringBuilder builder = new StringBuilder();
- foreach (Type type in types)
- {
- if (builder.Length > 0)
- {
- builder.Append(CultureInfo.CurrentCulture.TextInfo.ListSeparator);
- builder.Append(" ");
- }
-
- builder.Append(type.FullName);
- }
-
- if (useEllipses)
- { // Add an elipse to indicate that there
- // are more types than actually listed
- builder.Append(CultureInfo.CurrentCulture.TextInfo.ListSeparator);
- builder.Append(" ...");
- }
-
- return builder.ToString();
- }
-
-
- private TypeCatalog CreateTypeCatalog()
- {
- var type = PartFactory.GetAttributedExporterType();
-
- return CreateTypeCatalog(type);
- }
-
- private TypeCatalog CreateTypeCatalog(params Type[] types)
- {
- return new TypeCatalog(types);
- }
-
- private class DerivedTypeCatalog : TypeCatalog
- {
- public DerivedTypeCatalog(params Type[] types)
- : base(types)
- {
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ImportAttributeTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ImportAttributeTests.cs deleted file mode 100644 index 2a4f46772f3..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ImportAttributeTests.cs +++ /dev/null @@ -1,139 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.UnitTesting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class ImportAttributeTests
- {
- [TestMethod]
- public void Constructor1_ShouldSetContractNamePropertyToEmptyString()
- {
- var attribute = new ImportAttribute();
-
- Assert.IsNull(attribute.ContractName);
- Assert.IsNull(attribute.ContractType);
- }
-
- [TestMethod]
- public void Constructor2_NullAsContractNameArgument_ShouldSetContractNamePropertyToEmptyString()
- {
- var attribute = new ImportAttribute((string)null);
-
- Assert.IsNull(attribute.ContractName);
- Assert.IsNull(attribute.ContractType);
- }
-
- [TestMethod]
- public void Constructor3_NullAsContractTypeArgument_ShouldSetContractNamePropertyToEmptyString()
- {
- var attribute = new ImportAttribute((Type)null);
-
- Assert.IsNull(attribute.ContractName);
- Assert.IsNull(attribute.ContractType);
- }
-
- [TestMethod]
- public void Constructor4_NullAsContractTypeArgument_ShouldSetContractNamePropertyToEmptyString()
- {
- var attribute = new ImportAttribute((string)null, (Type)null);
-
- Assert.IsNull(attribute.ContractName);
- Assert.IsNull(attribute.ContractType);
- }
-
- [TestMethod]
- public void Constructor2_ValueAsContractNameArgument_ShouldSetContractNameProperty()
- {
- var expectations = Expectations.GetContractNamesWithEmpty();
-
- foreach (var e in expectations)
- {
- var attribute = new ImportAttribute(e);
-
- Assert.AreEqual(e, attribute.ContractName);
- }
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetAllowDefaultPropertyToFalse()
- {
- var attribute = new ImportAttribute();
-
- Assert.IsFalse(attribute.AllowDefault);
- }
-
- [TestMethod]
- public void Constructor2_ShouldSetAllowDefaultPropertyToFalse()
- {
- var attribute = new ImportAttribute("ContractName");
-
- Assert.IsFalse(attribute.AllowDefault);
- }
-
- [TestMethod]
- public void Constructor3_ShouldSetAllowDefaultPropertyToFalse()
- {
- var attribute = new ImportAttribute(typeof(String));
-
- Assert.IsFalse(attribute.AllowDefault);
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetAllowRecompositionPropertyToFalse()
- {
- var attribute = new ImportAttribute();
-
- Assert.IsFalse(attribute.AllowRecomposition);
- }
-
- [TestMethod]
- public void Constructor2_ShouldSetAllowRecompositionPropertyToFalse()
- {
- var attribute = new ImportAttribute("ContractName");
-
- Assert.IsFalse(attribute.AllowRecomposition);
- }
-
- [TestMethod]
- public void Constructor3_ShouldSetAllowRecompositionPropertyToFalse()
- {
- var attribute = new ImportAttribute(typeof(String));
-
- Assert.IsFalse(attribute.AllowRecomposition);
- }
-
- [TestMethod]
- public void AllowDefault_ValueAsValueArgument_ShouldSetProperty()
- {
- var expectations = Expectations.GetBooleans();
-
- var attribute = new ImportAttribute();
-
- foreach (var e in expectations)
- {
- attribute.AllowDefault = e;
- Assert.AreEqual(e, attribute.AllowDefault);
- }
- }
-
- [TestMethod]
- public void AllowRecomposition_ValueAsValueArgument_ShouldSetProperty()
- {
- var expectations = Expectations.GetBooleans();
-
- var attribute = new ImportAttribute();
-
- foreach (var e in expectations)
- {
- attribute.AllowRecomposition = e;
- Assert.AreEqual(e, attribute.AllowRecomposition);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ImportDefinitionTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ImportDefinitionTests.cs deleted file mode 100644 index a3092cd2ed5..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ImportDefinitionTests.cs +++ /dev/null @@ -1,246 +0,0 @@ -//------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.Linq.Expressions;
-using System.Text.RegularExpressions;
-using System.UnitTesting;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class ImportDefinitionTests
- {
- [TestMethod]
- public void Constructor1_ShouldSetCardinalityPropertyToExactlyOne()
- {
- var definition = new NoOverridesImportDefinition();
-
- Assert.AreEqual(ImportCardinality.ExactlyOne, definition.Cardinality);
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetIsPrerequisitePropertyToTrue()
- {
- var definition = new NoOverridesImportDefinition();
-
- Assert.IsTrue(definition.IsPrerequisite);
- }
-
- [TestMethod]
- public void Constructor1_ShouldSetIsRecomposablePropertyToFalse()
- {
- var definition = new NoOverridesImportDefinition();
-
- Assert.IsFalse(definition.IsRecomposable);
- }
-
- [TestMethod]
- public void Constructor2_NullAsConstraintArgument_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("constraint", () =>
- {
- new ImportDefinition((Expression<Func<ExportDefinition, bool>>)null, "", ImportCardinality.ExactlyOne, false, false);
- });
- }
-
- [TestMethod]
- public void Constructor2_OutOfRangeValueAsCardinalityArgument_ShouldThrowArgument()
- {
- var expectations = Expectations.GetInvalidEnumValues<ImportCardinality>();
-
- foreach (var e in expectations)
- {
- ExceptionAssert.ThrowsArgument<ArgumentException>("cardinality", () =>
- {
- new ImportDefinition(d => true, "", e, false, false);
- });
- }
- }
-
- [TestMethod]
- public void Constructor2_ValueAsCardinalityArgument_ShouldSetCardinalityProperty()
- {
- var expectations = Expectations.GetEnumValues<ImportCardinality>();
-
- foreach (var e in expectations)
- {
- var definition = new ImportDefinition(d => true, "", e, false, false);
-
- Assert.AreEqual(e, definition.Cardinality);
- }
- }
-
- [TestMethod]
- public void Constructor2_ValueAsConstraintArgument_ShouldSetConstraintProperty()
- {
- var expectations = new List<Expression<Func<ExportDefinition, bool>>>();
- expectations.Add(d => d.ContractName == "ContractName");
- expectations.Add(d => d.ContractName.Equals("ContractName"));
- expectations.Add(d => (string)d.Metadata["Name"] == "Value");
- expectations.Add(d => true);
-
- foreach (var e in expectations)
- {
- var definition = new ImportDefinition(e, "", ImportCardinality.ExactlyOne, false, false);
-
- Assert.AreEqual(e, definition.Constraint);
- }
- }
-
- [TestMethod]
- public void Constructor2_ValueAsIsRecomposableArgument_ShouldSetIsRecomposableProperty()
- {
- var expectations = Expectations.GetBooleans();
-
- foreach (var e in expectations)
- {
- var definition = new ImportDefinition(d => true, "", ImportCardinality.ExactlyOne, e, false);
-
- Assert.AreEqual(e, definition.IsRecomposable);
- }
- }
-
- [TestMethod]
- public void Constructor2_ValueAsIsPrerequisiteArgument_ShouldSetIsPrerequisiteProperty()
- {
- var expectations = Expectations.GetBooleans();
-
- foreach (var e in expectations)
- {
- var definition = new ImportDefinition(d => true, "", ImportCardinality.ExactlyOne, false, e);
-
- Assert.AreEqual(e, definition.IsPrerequisite);
- }
- }
-
- [TestMethod]
- public void Constructor2_ContractName_ShouldSetAppropriately()
- {
- var expectations = new ExpectationCollection<string, string>();
-
- expectations.Add(null, string.Empty);
- expectations.Add(string.Empty, string.Empty);
- expectations.Add("Contract", "Contract");
-
- string cn = AttributedModelServices.GetContractName(typeof(ImportDefinitionTests));
- expectations.Add(cn, cn);
-
- foreach (var e in expectations)
- {
- var definition = new ImportDefinition(d => true, e.Input, ImportCardinality.ExactlyOne, false, false);
-
- Assert.AreEqual(e.Output, definition.ContractName);
- }
- }
-
-
- [TestMethod]
- public void Constraint_WhenNotOverridden_ShouldThrowNotImplemented()
- {
- var definition = new NoOverridesImportDefinition();
-
- ExceptionAssert.Throws<NotImplementedException>(() =>
- {
- var constraint = definition.Constraint;
- });
- }
-
- [TestMethod]
- public void ToString_WhenConstraintPropertyNotOverridden_ShouldThrowNotImplemented()
- {
- var definition = new NoOverridesImportDefinition();
-
- ExceptionAssert.Throws<NotImplementedException>(() =>
- {
- definition.ToString();
- });
- }
-
- [TestMethod]
- public void ToString_ValueAsConstraintArgument_ShouldReturnConstraintProperty()
- {
- var expectations = new ExpectationCollection<Expression<Func<ExportDefinition, bool>>, string>();
- expectations.Add(d => d.ContractName == "ContractName", @"d.ContractName ==? ""ContractName""");
- expectations.Add(d => d.ContractName.Equals("ContractName"), @"d.ContractName.Equals\(""ContractName""\)");
- expectations.Add(d => (string)d.Metadata["Name"] == "Value", @"Convert\(d.Metadata.get_Item\(""Name""\)\) ==? ""Value""");
- expectations.Add(d => true, "True");
-
- foreach (var e in expectations)
- {
- var item = new ImportDefinition(e.Input, "", ImportCardinality.ExactlyOne, false, false);
-
- Assert.IsTrue(Regex.IsMatch(item.ToString(), e.Output));
- }
- }
-
- [TestMethod]
- public void ToString_DerivedImportDefinition_ShouldReturnOverriddenConstraintProperty()
- {
- var expectations = new ExpectationCollection<Expression<Func<ExportDefinition, bool>>, string>();
- expectations.Add(d => d.ContractName == "ContractName", @"d.ContractName ==? ""ContractName""");
- expectations.Add(d => d.ContractName.Equals("ContractName"), @"d.ContractName.Equals\(""ContractName""\)");
- expectations.Add(d => (string)d.Metadata["Name"] == "Value", @"Convert\(d.Metadata.get_Item\(""Name""\)\) ==? ""Value""");
- expectations.Add(d => true, "True");
-
- foreach (var e in expectations)
- {
- var item = new DerivedImportDefinition(e.Input);
-
- Assert.IsTrue(Regex.IsMatch(item.ToString(), e.Output));
- }
- }
-
- [TestMethod]
- [WorkItem(738535)]
- [Ignore]
- public void ContractName_ShouldBeIncludedInConstraintAutomatically()
- {
- string testContractName = "TestContractName";
- var contractImportDefinition = new ImportDefinition(ed => true, testContractName, ImportCardinality.ZeroOrMore, false, false);
-
- var shouldMatch = new ExportDefinition(testContractName, null);
- var shouldNotMatch = new ExportDefinition(testContractName + testContractName, null);
-
- Assert.IsTrue(contractImportDefinition.IsConstraintSatisfiedBy(shouldMatch));
- Assert.IsFalse(contractImportDefinition.IsConstraintSatisfiedBy(shouldNotMatch));
- }
-
- [TestMethod]
- public void EmptyContractName_ShouldMatchAllContractNames()
- {
- var importDefinition = new ImportDefinition(ed => true, string.Empty, ImportCardinality.ZeroOrMore, false, false);
-
- var shouldMatch1 = new ExportDefinition("contract1", null);
- var shouldMatch2 = new ExportDefinition("contract2", null);
-
- Assert.IsTrue(importDefinition.IsConstraintSatisfiedBy(shouldMatch1));
- Assert.IsTrue(importDefinition.IsConstraintSatisfiedBy(shouldMatch2));
- }
-
- private class NoOverridesImportDefinition : ImportDefinition
- {
- }
-
- private class DerivedImportDefinition : ImportDefinition
- {
- private readonly Expression<Func<ExportDefinition, bool>> _constraint;
-
- public DerivedImportDefinition(Expression<Func<ExportDefinition, bool>> constraint)
- {
- _constraint = constraint;
- }
-
- public override Expression<Func<ExportDefinition, bool>> Constraint
- {
- get { return _constraint ?? base.Constraint; }
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ImportingComposablePart.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ImportingComposablePart.cs deleted file mode 100644 index e89f71ed33f..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ImportingComposablePart.cs +++ /dev/null @@ -1,144 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Factories;
-using System.Linq;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition
-{
- internal class ImportingComposablePart : ComposablePart
- {
- private readonly List<ImportDefinition> _importDefinitions = new List<ImportDefinition>();
- private readonly List<ExportDefinition> _exportDefinitions = new List<ExportDefinition>();
- private Dictionary<ImportDefinition, object> _importValues = new Dictionary<ImportDefinition, object>();
-
- public ImportingComposablePart(ImportCardinality cardinality, bool isRecomposable, params string[] contractNames)
- : this((string)null, cardinality, isRecomposable, contractNames)
- {
- }
-
- public ImportingComposablePart(string exportContractName, ImportCardinality cardinality, bool isRecomposable, params string[] contractNames)
- {
- if (exportContractName != null)
- {
- var definition = ExportDefinitionFactory.Create(exportContractName);
-
- _exportDefinitions.Add(definition);
- }
-
- foreach (string contractName in contractNames)
- {
- var definition = ImportDefinitionFactory.Create(contractName,
- cardinality,
- isRecomposable,
- false);
-
- _importDefinitions.Add(definition);
- }
- }
-
- public ImportingComposablePart(params ImportDefinition[] importDefintions)
- {
- _importDefinitions.AddRange(importDefintions);
- }
-
- public override IEnumerable<ExportDefinition> ExportDefinitions
- {
- get { return this._exportDefinitions; }
- }
-
- public override IEnumerable<ImportDefinition> ImportDefinitions
- {
- get { return this._importDefinitions; }
- }
-
- public override IDictionary<string, object> Metadata
- {
- get { return new Dictionary<string, object>(); }
- }
-
- public int ImportSatisfiedCount
- {
- get;
- private set;
- }
-
- public void ResetImportSatisfiedCount()
- {
- ImportSatisfiedCount = 0;
- }
-
- public object Value
- {
- get
- {
- Assert.AreEqual(1, _importValues.Count);
-
- return _importValues.Values.First();
- }
- }
-
- public object GetImport(string contractName)
- {
- foreach (var pair in _importValues)
- {
- var definition = (ContractBasedImportDefinition)pair.Key;
- if (definition.ContractName == contractName)
- {
- return pair.Value;
- }
- }
-
- return null;
- }
-
- public object GetImport(ImportDefinition definition)
- {
- Assert.IsTrue(_importValues.ContainsKey(definition));
- return _importValues[definition];
- }
-
- public override object GetExportedValue(ExportDefinition definition)
- {
- Assert.Fail();
- return null;
- }
-
- public override void SetImport(ImportDefinition definition, IEnumerable<Export> exports)
- {
- Assert.IsTrue(_importDefinitions.Contains(definition));
-
- ImportSatisfiedCount++;
-
- _importValues[definition] = GetExportValue(exports);
- }
-
- public void ResetImport(ImportDefinition definition)
- {
- Assert.IsTrue(_importDefinitions.Contains(definition));
- _importValues[definition] = null;
- }
-
- private object GetExportValue(IEnumerable<Export> exports)
- {
- var exportedValues = exports.Select(export => export.Value);
-
- int count = exportedValues.Count();
- if (count == 0)
- {
- return null;
- }
- else if (count == 1)
- {
- return exportedValues.First();
- }
-
- return exportedValues.ToArray();
- }
- }
-
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ImportingConstructorAttributeTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ImportingConstructorAttributeTests.cs deleted file mode 100644 index f222b065394..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ImportingConstructorAttributeTests.cs +++ /dev/null @@ -1,20 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class ImportingConstructorAttributeTests
- {
- [TestMethod]
- public void Constructor_ShouldNotThrow()
- {
- var attribute = new ImportingConstructorAttribute();
-
- Assert.IsNotNull(attribute);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/InitializationScopeTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/InitializationScopeTests.cs deleted file mode 100644 index 303563e6e9e..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/InitializationScopeTests.cs +++ /dev/null @@ -1,150 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.Linq;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class InitializationScopeTests
- {
- [TestMethod]
- public void SingleContainerSimpleCompose()
- {
- var container = ContainerFactory.Create();
- ImportingComposablePart importPart;
- CompositionBatch batch = new CompositionBatch();
-
- batch.AddExportedValue("value1", "Hello");
- batch.AddExportedValue("value2", "World");
- batch.AddPart(importPart = PartFactory.CreateImporter("value1", "value2"));
- container.Compose(batch);
-
- Assert.AreEqual(2, importPart.ImportSatisfiedCount);
- Assert.AreEqual("Hello", importPart.GetImport("value1"));
- Assert.AreEqual("World", importPart.GetImport("value2"));
- }
-
- [TestMethod]
- public void ParentedContainerSimpleCompose()
- {
- var container = ContainerFactory.Create();
- var importPart = PartFactory.CreateImporter("value1", "value2");
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddExportedValue("value1", "Parent");
-
- var childContainer = new CompositionContainer(container);
- CompositionBatch childBatch = new CompositionBatch();
- childBatch.AddExportedValue("value2", "Child");
- childBatch.AddPart(importPart);
-
- Assert.AreEqual(0, importPart.ImportSatisfiedCount, "Import should not happen until outer scope is disposed");
-
- container.Compose(batch);
- childContainer.Compose(childBatch);
-
- Assert.AreEqual(2, importPart.ImportSatisfiedCount);
- Assert.AreEqual("Parent", importPart.GetImport("value1"));
- Assert.AreEqual("Child", importPart.GetImport("value2"));
- }
-
- [TestMethod]
- public void SingleContainerPartReplacement()
- {
- var container = ContainerFactory.Create();
- var importPart = PartFactory.CreateImporter(true, "value1", "value2");
-
- CompositionBatch batch = new CompositionBatch();
- var export1Key = batch.AddExportedValue("value1", "Hello");
- batch.AddExportedValue("value2", "World");
- batch.AddPart(importPart);
- container.Compose(batch);
-
- Assert.AreEqual(2, importPart.ImportSatisfiedCount);
- Assert.AreEqual("Hello", importPart.GetImport("value1"));
- Assert.AreEqual("World", importPart.GetImport("value2"));
-
- importPart.ResetImportSatisfiedCount();
-
- batch = new CompositionBatch();
- batch.RemovePart(export1Key);
- batch.AddExportedValue("value1", "Goodbye");
- container.Compose(batch);
-
- Assert.AreEqual(1, importPart.ImportSatisfiedCount);
- Assert.AreEqual("Goodbye", importPart.GetImport("value1"));
- Assert.AreEqual("World", importPart.GetImport("value2"));
- }
-
- [TestMethod]
- public void ParentedContainerPartReplacement()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
- var importPart = PartFactory.CreateImporter(true, "value1", "value2");
- var exportKey = batch.AddExportedValue("value1", "Parent");
-
- var childContainer = new CompositionContainer(container);
- CompositionBatch childBatch = new CompositionBatch();
- childBatch.AddExportedValue("value2", "Child");
- childBatch.AddPart(importPart);
-
- Assert.AreEqual(0, importPart.ImportSatisfiedCount, "Should not import until outer scope is disposed");
- container.Compose(batch);
- childContainer.Compose(childBatch);
-
- Assert.AreEqual(2, importPart.ImportSatisfiedCount);
- Assert.AreEqual("Parent", importPart.GetImport("value1"));
- Assert.AreEqual("Child", importPart.GetImport("value2"));
-
- importPart.ResetImportSatisfiedCount();
- batch = new CompositionBatch();
- batch.RemovePart(exportKey);
- batch.AddExportedValue("value1", "New Parent");
- container.Compose(batch);
-
- Assert.AreEqual(1, importPart.ImportSatisfiedCount);
- Assert.AreEqual("New Parent", importPart.GetImport("value1"));
- Assert.AreEqual("Child", importPart.GetImport("value2"));
- }
-
- [TestMethod]
- public void SelectiveRecompose()
- {
- var container = ContainerFactory.Create();
- var stableImporter = PartFactory.CreateImporter("stable");
- var dynamicImporter = PartFactory.CreateImporter("dynamic", true);
- CompositionBatch batch = new CompositionBatch();
-
- batch.AddPart(stableImporter);
- batch.AddPart(dynamicImporter);
- var exportKey = batch.AddExportedValue("dynamic", 1);
- batch.AddExportedValue("stable", 42);
- container.Compose(batch);
-
- Assert.AreEqual(1, stableImporter.ImportSatisfiedCount);
- Assert.AreEqual(stableImporter.GetImport("stable"), 42);
- Assert.AreEqual(1, dynamicImporter.ImportSatisfiedCount);
- Assert.AreEqual(dynamicImporter.GetImport("dynamic"), 1);
-
- batch = new CompositionBatch();
- stableImporter.ResetImportSatisfiedCount();
- dynamicImporter.ResetImportSatisfiedCount();
- batch.RemovePart(exportKey);
- batch.AddExportedValue("dynamic", 2);
- container.Compose(batch);
-
- Assert.AreEqual(0, stableImporter.ImportSatisfiedCount, "Should not have imported the stable import part");
- Assert.AreEqual(stableImporter.GetImport("stable"), 42);
- Assert.AreEqual(1, dynamicImporter.ImportSatisfiedCount);
- Assert.AreEqual(dynamicImporter.GetImport("dynamic"), 2);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/MetadataAttributeAttributeTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/MetadataAttributeAttributeTests.cs deleted file mode 100644 index 0cde9ac78bb..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/MetadataAttributeAttributeTests.cs +++ /dev/null @@ -1,21 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class MetadataAttributeAttributeTests
- {
- [TestMethod]
- public void Constructor_ShouldNotThrow()
- {
- var attribute = new MetadataAttributeAttribute();
-
- Assert.IsNotNull(attribute);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/MetadataTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/MetadataTests.cs deleted file mode 100644 index 73d8c873c5d..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/MetadataTests.cs +++ /dev/null @@ -1,1255 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.UnitTesting;
-using System.Linq;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.UnitTesting;
-using System.Reflection;
-using System.Collections.ObjectModel;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class MetadataTests
- {
- #region Tests for metadata on exports
-
- public enum SimpleEnum
- {
- First
- }
-
- [PartNotDiscoverable]
- [Export]
- [ExportMetadata("String", "42")]
- [ExportMetadata("Int", 42)]
- [ExportMetadata("Float", 42.0f)]
- [ExportMetadata("Enum", SimpleEnum.First)]
- [ExportMetadata("Type", typeof(string))]
- [ExportMetadata("Object", 42)]
- public class SimpleMetadataExporter
- {
- }
-
- [PartNotDiscoverable]
- [Export]
- [ExportMetadata("String", null)] // null
- [ExportMetadata("Int", 42)]
- [ExportMetadata("Float", 42.0f)]
- [ExportMetadata("Enum", SimpleEnum.First)]
- [ExportMetadata("Type", typeof(string))]
- [ExportMetadata("Object", 42)]
- public class SimpleMetadataExporterWithNullReferenceValue
- {
- }
-
- [PartNotDiscoverable]
- [Export]
- [ExportMetadata("String", "42")]
- [ExportMetadata("Int", null)] //null
- [ExportMetadata("Float", 42.0f)]
- [ExportMetadata("Enum", SimpleEnum.First)]
- [ExportMetadata("Type", typeof(string))]
- [ExportMetadata("Object", 42)]
- public class SimpleMetadataExporterWithNullNonReferenceValue
- {
- }
-
- [PartNotDiscoverable]
- [Export]
- [ExportMetadata("String", "42")]
- [ExportMetadata("Int", "42")] // wrong type
- [ExportMetadata("Float", 42.0f)]
- [ExportMetadata("Enum", SimpleEnum.First)]
- [ExportMetadata("Type", typeof(string))]
- [ExportMetadata("Object", 42)]
- public class SimpleMetadataExporterWithTypeMismatch
- {
- }
-
- public interface ISimpleMetadataView
- {
- string String { get; }
- int Int { get; }
- float Float { get; }
- SimpleEnum Enum { get; }
- Type Type { get; }
- object Object { get; }
- }
-
- [TestMethod]
- public void SimpleMetadataTest()
- {
- var container = ContainerFactory.Create();
- container.ComposeParts(new SimpleMetadataExporter());
-
- var export = container.GetExport<SimpleMetadataExporter, ISimpleMetadataView>();
-
- Assert.AreEqual("42", export.Metadata.String);
- Assert.AreEqual(42, export.Metadata.Int);
- Assert.AreEqual(42.0f, export.Metadata.Float);
- Assert.AreEqual(SimpleEnum.First, export.Metadata.Enum);
- Assert.AreEqual(typeof(string), export.Metadata.Type);
- Assert.AreEqual(42, export.Metadata.Object);
- }
-
- [TestMethod]
- public void SimpleMetadataTestWithNullReferenceValue()
- {
- var container = ContainerFactory.Create();
- container.ComposeParts(new SimpleMetadataExporterWithNullReferenceValue());
-
- var export = container.GetExport<SimpleMetadataExporterWithNullReferenceValue, ISimpleMetadataView>();
-
- Assert.AreEqual(null, export.Metadata.String);
- Assert.AreEqual(42, export.Metadata.Int);
- Assert.AreEqual(42.0f, export.Metadata.Float);
- Assert.AreEqual(SimpleEnum.First, export.Metadata.Enum);
- Assert.AreEqual(typeof(string), export.Metadata.Type);
- Assert.AreEqual(42, export.Metadata.Object);
- }
-
- [TestMethod]
- public void SimpleMetadataTestWithNullNonReferenceValue()
- {
- var container = ContainerFactory.Create();
- container.ComposeParts(new SimpleMetadataExporterWithNullNonReferenceValue());
-
- var exports = container.GetExports<SimpleMetadataExporterWithNullNonReferenceValue, ISimpleMetadataView>();
- Assert.IsFalse(exports.Any());
- }
-
- [TestMethod]
- public void SimpleMetadataTestWithTypeMismatch()
- {
- var container = ContainerFactory.Create();
- container.ComposeParts(new SimpleMetadataExporterWithTypeMismatch());
-
- var exports = container.GetExports<SimpleMetadataExporterWithTypeMismatch, ISimpleMetadataView>();
- Assert.IsFalse(exports.Any());
- }
-
- [TestMethod]
- public void ValidMetadataTest()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(new MyExporterWithValidMetadata());
- container.Compose(batch);
-
- var typeVi = container.GetExport<MyExporterWithValidMetadata, IDictionary<string, object>>();
- var metadataFoo = typeVi.Metadata["foo"] as IList<string>;
- Assert.AreEqual(2, metadataFoo.Count(), "There are should be two items in the metadata foo's collection");
- Assert.IsTrue(metadataFoo.Contains("bar1"), "The metadata collection should include value 'bar1'");
- Assert.IsTrue(metadataFoo.Contains("bar2"), "The metadata collection should include value 'bar2'");
- Assert.AreEqual("world", typeVi.Metadata["hello"], "The single item metadata should be present");
- Assert.AreEqual("GoodOneValue2", typeVi.Metadata["GoodOne2"], "The metadata supplied by strong attribute should also be present");
-
- var metadataAcme = typeVi.Metadata["acme"] as IList<object>;
- Assert.AreEqual(2, metadataAcme.Count(), "There are should be two items in the metadata acme's collection");
- Assert.IsTrue(metadataAcme.Contains("acmebar"), "The metadata collection should include value 'bar'");
- Assert.IsTrue(metadataAcme.Contains(2.0), "The metadata collection should include value 2");
-
- var memberVi = container.GetExport<Func<double>, IDictionary<string, object>>("ContractForValidMetadata");
- var metadataBar = memberVi.Metadata["bar"] as IList<string>;
- Assert.AreEqual(2, metadataBar.Count(), "There are should be two items in the metadata bar's collection");
- Assert.IsTrue(metadataBar.Contains("foo1"), "The metadata collection should include value 'foo1'");
- Assert.IsTrue(metadataBar.Contains("foo2"), "The metadata collection should include value 'foo2'");
- Assert.AreEqual("hello", memberVi.Metadata["world"], "The single item metadata should be present");
- Assert.AreEqual("GoodOneValue2", memberVi.Metadata["GoodOne2"], "The metadata supplied by strong attribute should also be present");
-
- var metadataStuff = memberVi.Metadata["stuff"] as IList<object>;
- Assert.AreEqual(2, metadataAcme.Count(), "There are should be two items in the metadata acme's collection");
- Assert.IsTrue(metadataStuff.Contains("acmebar"), "The metadata collection should include value 'acmebar'");
- Assert.IsTrue(metadataStuff.Contains(2.0), "The metadata collection should include value 2");
-
- }
-
- [TestMethod]
- public void ValidMetadataDiscoveredByComponentCatalogTest()
- {
- var container = ContainerFactory.CreateWithDefaultAttributedCatalog();
- ValidMetadataDiscoveredByCatalog(container);
- }
-
- private void ValidMetadataDiscoveredByCatalog(CompositionContainer container)
- {
- var export1 = container.GetExport<MyExporterWithValidMetadata, IDictionary<string, object>>();
-
- var metadataFoo = export1.Metadata["foo"] as IList<string>;
- Assert.AreEqual(2, metadataFoo.Count(), "There are should be two items in the metadata foo's collection");
- Assert.IsTrue(metadataFoo.Contains("bar1"), "The metadata collection should include value 'bar1'");
- Assert.IsTrue(metadataFoo.Contains("bar2"), "The metadata collection should include value 'bar2'");
- Assert.AreEqual("world", export1.Metadata["hello"], "The single item metadata should also be present");
- Assert.AreEqual("GoodOneValue2", export1.Metadata["GoodOne2"], "The metadata supplied by strong attribute should also be present");
-
- var metadataAcme = export1.Metadata["acme"] as IList<object>;
- Assert.AreEqual(2, metadataAcme.Count(), "There are should be two items in the metadata acme's collection");
- Assert.IsTrue(metadataAcme.Contains("acmebar"), "The metadata collection should include value 'bar'");
- Assert.IsTrue(metadataAcme.Contains(2.0), "The metadata collection should include value 2");
-
- var export2 = container.GetExport<Func<double>, IDictionary<string, object>>("ContractForValidMetadata");
- var metadataBar = export2.Metadata["bar"] as IList<string>;
- Assert.AreEqual(2, metadataBar.Count(), "There are should be two items in the metadata foo's collection");
- Assert.IsTrue(metadataBar.Contains("foo1"), "The metadata collection should include value 'foo1'");
- Assert.IsTrue(metadataBar.Contains("foo2"), "The metadata collection should include value 'foo2'");
- Assert.AreEqual("hello", export2.Metadata["world"], "The single item metadata should also be present");
- Assert.AreEqual("GoodOneValue2", export2.Metadata["GoodOne2"], "The metadata supplied by strong attribute should also be present");
-
- var metadataStuff = export2.Metadata["stuff"] as IList<object>;
- Assert.AreEqual(2, metadataAcme.Count(), "There are should be two items in the metadata acme's collection");
- Assert.IsTrue(metadataStuff.Contains("acmebar"), "The metadata collection should include value 'acmebar'");
- Assert.IsTrue(metadataStuff.Contains(2.0), "The metadata collection should include value 2");
- }
-
-
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true)]
- [MetadataAttribute]
- public class BadStrongMetadata : Attribute
- {
- public string SelfConflicted { get { return "SelfConflictedValue"; } }
- }
-
- [Export]
- [BadStrongMetadata]
- [ExportMetadata("InvalidCollection", "InvalidCollectionValue1")]
- [ExportMetadata("InvalidCollection", "InvalidCollectionValue2", IsMultiple = true)]
- [BadStrongMetadata]
- [ExportMetadata("RepeatedMetadata", "RepeatedMetadataValue1")]
- [ExportMetadata("RepeatedMetadata", "RepeatedMetadataValue2")]
- [ExportMetadata("GoodOne1", "GoodOneValue1")]
- [ExportMetadata("ConflictedOne1", "ConfilictedOneValue1")]
- [GoodStrongMetadata]
- [ExportMetadata("ConflictedOne2", "ConflictedOne2Value2")]
- [PartNotDiscoverable]
- public class MyExporterWithInvalidMetadata
- {
- [Export("ContractForInvalidMetadata")]
- [ExportMetadata("ConflictedOne1", "ConfilictedOneValue1")]
- [GoodStrongMetadata]
- [ExportMetadata("ConflictedOne2", "ConflictedOne2Value2")]
- [ExportMetadata("RepeatedMetadata", "RepeatedMetadataValue1")]
- [ExportMetadata("RepeatedMetadata", "RepeatedMetadataValue2")]
- [BadStrongMetadata]
- [ExportMetadata("InvalidCollection", "InvalidCollectionValue1")]
- [ExportMetadata("InvalidCollection", "InvalidCollectionValue2", IsMultiple = true)]
- [BadStrongMetadata]
- [ExportMetadata("GoodOne1", "GoodOneValue1")]
- public double DoSomething() { return 0.618; }
- }
-
- [Export]
- [ExportMetadata("DuplicateMetadataName", "My Name")]
- [ExportMetadata("DuplicateMetadataName", "Your Name")]
- [PartNotDiscoverable]
- public class ClassWithInvalidDuplicateMetadataOnType
- {
-
- }
-
- [TestMethod]
- public void InvalidDuplicateMetadataOnType_ShouldThrow()
- {
- var part = AttributedModelServices.CreatePart(new ClassWithInvalidDuplicateMetadataOnType());
- var export = part.ExportDefinitions.First();
- var ex = ExceptionAssert.Throws<InvalidOperationException>(RetryMode.DoNotRetry, () =>
- {
- var metadata = export.Metadata;
- });
-
- Assert.IsTrue(ex.Message.Contains("DuplicateMetadataName"));
- }
-
- [PartNotDiscoverable]
- public class ClassWithInvalidDuplicateMetadataOnMember
- {
- [Export]
- [ExportMetadata("DuplicateMetadataName", "My Name")]
- [ExportMetadata("DuplicateMetadataName", "Your Name")]
- public ClassWithDuplicateMetadataOnMember Member { get; set; }
- }
-
- [TestMethod]
- public void InvalidDuplicateMetadataOnMember_ShouldThrow()
- {
- var part = AttributedModelServices.CreatePart(new ClassWithInvalidDuplicateMetadataOnMember());
- var export = part.ExportDefinitions.First();
-
- var ex = ExceptionAssert.Throws<InvalidOperationException>(RetryMode.DoNotRetry, () =>
- {
- var metadata = export.Metadata;
- });
-
- Assert.IsTrue(ex.Message.Contains("DuplicateMetadataName"));
- }
-
- [Export]
- [ExportMetadata("DuplicateMetadataName", "My Name", IsMultiple=true)]
- [ExportMetadata("DuplicateMetadataName", "Your Name", IsMultiple=true)]
- public class ClassWithValidDuplicateMetadataOnType
- {
-
- }
-
- [TestMethod]
- public void ValidDuplicateMetadataOnType_ShouldDiscoverAllMetadata()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(new ClassWithValidDuplicateMetadataOnType());
-
- container.Compose(batch);
-
- var export = container.GetExport<ClassWithValidDuplicateMetadataOnType, IDictionary<string, object>>();
-
- var names = export.Metadata["DuplicateMetadataName"] as string[];
-
- Assert.AreEqual(2, names.Length);
- }
-
- public class ClassWithDuplicateMetadataOnMember
- {
- [Export]
- [ExportMetadata("DuplicateMetadataName", "My Name", IsMultiple=true)]
- [ExportMetadata("DuplicateMetadataName", "Your Name", IsMultiple=true)]
- public ClassWithDuplicateMetadataOnMember Member { get; set; }
- }
-
- [TestMethod]
- public void ValidDuplicateMetadataOnMember_ShouldDiscoverAllMetadata()
- {
- var container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(new ClassWithDuplicateMetadataOnMember());
-
- container.Compose(batch);
-
- var export = container.GetExport<ClassWithDuplicateMetadataOnMember, IDictionary<string, object>>();
-
- var names = export.Metadata["DuplicateMetadataName"] as string[];
-
- Assert.AreEqual(2, names.Length);
- }
-
- [Export]
- [ExportMetadata(CompositionConstants.PartCreationPolicyMetadataName, "My Policy")]
- [PartNotDiscoverable]
- public class ClassWithReservedMetadataValue
- {
-
- }
-
- [TestMethod]
- public void InvalidMetadata_UseOfReservedName_ShouldThrow()
- {
- var part = AttributedModelServices.CreatePart(new ClassWithReservedMetadataValue());
- var export = part.ExportDefinitions.First();
-
- var ex = ExceptionAssert.Throws<InvalidOperationException>(RetryMode.DoNotRetry, () =>
- {
- var metadata = export.Metadata;
- });
-
- Assert.IsTrue(ex.Message.Contains(CompositionConstants.PartCreationPolicyMetadataName));
- }
-
- #endregion
-
- #region Tests for weakly supported metadata as part of contract
-
- [TestMethod]
- [WorkItem(468388)]
- [Ignore]
- public void FailureImportForNoRequiredMetadatForExportCollection()
- {
- CompositionContainer container = ContainerFactory.Create();
-
- MyImporterWithExportCollection importer;
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(new MyExporterWithNoMetadata());
- batch.AddPart(importer = new MyImporterWithExportCollection());
-
- Assert.Fail();
-
- //var result = container.TryCompose();
-
- //Assert.IsTrue(result.Succeeded, "Composition should be successful because collection import is not required");
- //Assert.AreEqual(1, result.Issues.Count, "There should be one issue reported");
- //Assert.IsTrue(result.Issues[0].Description.Contains("Foo"), "The missing required metadata is 'Foo'");
- }
-
- [TestMethod]
- [WorkItem(472538)]
- [Ignore]
- public void FailureImportForNoRequiredMetadataThroughComponentCatalogTest()
- {
- var container = ContainerFactory.CreateWithDefaultAttributedCatalog();
- FailureImportForNoRequiredMetadataThroughCatalog(container);
- }
-
- private void FailureImportForNoRequiredMetadataThroughCatalog(CompositionContainer container)
- {
- Assert.Fail("This needs to be fixed, see: 472538");
-
- //var export1 = container.GetExport<MyImporterWithExport>();
-
- //export1.TryGetExportedValue().VerifyFailure(CompositionIssueId.RequiredMetadataNotFound, CompositionIssueId.CardinalityMismatch);
-
- //var export2 = container.GetExport<MyImporterWithExportCollection>();
- //export2.TryGetExportedValue().VerifySuccess(CompositionIssueId.RequiredMetadataNotFound);
-
- //container.TryGetExportedValue<MyImporterWithValue>().VerifyFailure(CompositionIssueId.RequiredMetadataNotFound, CompositionIssueId.CardinalityMismatch);
- }
-
- [TestMethod]
- [WorkItem(468388)]
- [Ignore]
- public void SelectiveImportBasedOnMetadataForExport()
- {
- CompositionContainer container = ContainerFactory.Create();
-
- MyImporterWithExportForSelectiveImport importer;
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(new MyExporterWithNoMetadata());
- batch.AddPart(new MyExporterWithMetadata());
- batch.AddPart(importer = new MyImporterWithExportForSelectiveImport());
-
- Assert.Fail();
- //var result = container.TryCompose();
-
- //Assert.IsTrue(result.Succeeded, "Composition should be successfull because one of two exports meets both the contract name and metadata requirement");
- //Assert.AreEqual(1, result.Issues.Count, "There should be one issue reported about the export who has no required metadata");
- //Assert.IsTrue(result.Issues[0].Description.Contains("Foo"), "The missing required metadata is 'Foo'");
- //Assert.IsNotNull(importer.ValueInfo, "The import should really get bound");
- }
-
- [TestMethod]
- [WorkItem(468388)]
- [Ignore]
- public void SelectiveImportBasedOnMetadataForExportCollection()
- {
- CompositionContainer container = ContainerFactory.Create();
-
- MyImporterWithExportCollectionForSelectiveImport importer;
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(new MyExporterWithNoMetadata());
- batch.AddPart(new MyExporterWithMetadata());
- batch.AddPart(importer = new MyImporterWithExportCollectionForSelectiveImport());
-
- Assert.Fail();
-
- //var result = container.TryCompose();
-
- //Assert.IsTrue(result.Succeeded, "Composition should be successfull in anyway for collection import");
- //Assert.AreEqual(1, result.Issues.Count, "There should be one issue reported however, about the export who has no required metadata");
- //Assert.IsTrue(result.Issues[0].Description.Contains("Foo"), "The missing required metadata is 'Foo'");
- //Assert.AreEqual(1, importer.ValueInfoCol.Count, "The export with required metadata should get bound");
- //Assert.IsNotNull(importer.ValueInfoCol[0], "The import should really get bound");
- }
-
-
- [TestMethod]
- [WorkItem(472538)]
- [Ignore]
- public void SelectiveImportBasedOnMetadataThruoughComponentCatalogTest()
- {
- var container = ContainerFactory.CreateWithDefaultAttributedCatalog();
- SelectiveImportBasedOnMetadataThruoughCatalog(container);
- }
-
- private void SelectiveImportBasedOnMetadataThruoughCatalog(CompositionContainer container)
- {
- Assert.Fail("This needs to be fixed, see: 472538");
-
- //var export1 = container.GetExport<MyImporterWithExportForSelectiveImport>();
- //export1.TryGetExportedValue().VerifySuccess(CompositionIssueId.RequiredMetadataNotFound);
-
- //var export2 = container.GetExport<MyImporterWithExportCollectionForSelectiveImport>();
- //export2.TryGetExportedValue().VerifySuccess(CompositionIssueId.RequiredMetadataNotFound);
- }
-
- [TestMethod]
- public void ChildParentContainerTest1()
- {
- CompositionContainer parent = ContainerFactory.Create();
- CompositionContainer child = new CompositionContainer(parent);
-
- CompositionBatch childBatch = new CompositionBatch();
- CompositionBatch parentBatch = new CompositionBatch();
- parentBatch.AddPart(new MyExporterWithNoMetadata());
- childBatch.AddPart(new MyExporterWithMetadata());
- parent.Compose(parentBatch);
- child.Compose(childBatch);
-
- var exports = child.GetExports(CreateImportDefinition(typeof(IMyExporter), "Foo"));
-
- Assert.AreEqual(1, exports.Count());
- }
-
- [TestMethod]
- public void ChildParentContainerTest2()
- {
- CompositionContainer parent = ContainerFactory.Create();
- CompositionContainer child = new CompositionContainer(parent);
-
- CompositionBatch childBatch = new CompositionBatch();
- CompositionBatch parentBatch = new CompositionBatch();
- parentBatch.AddPart(new MyExporterWithMetadata());
- childBatch.AddPart(new MyExporterWithNoMetadata());
- parent.Compose(parentBatch);
-
- var exports = child.GetExports(CreateImportDefinition(typeof(IMyExporter), "Foo"));
-
- Assert.AreEqual(1, exports.Count());
- }
-
- [TestMethod]
- public void ChildParentContainerTest3()
- {
- CompositionContainer parent = ContainerFactory.Create();
- CompositionContainer child = new CompositionContainer(parent);
-
- CompositionBatch childBatch = new CompositionBatch();
- CompositionBatch parentBatch = new CompositionBatch();
-
- parentBatch.AddPart(new MyExporterWithMetadata());
- childBatch.AddPart(new MyExporterWithMetadata());
- parent.Compose(parentBatch);
- child.Compose(childBatch);
-
- var exports = child.GetExports(CreateImportDefinition(typeof(IMyExporter), "Foo"));
-
- Assert.AreEqual(2, exports.Count(), "There should be two from child and parent container each");
- }
-
- private static ImportDefinition CreateImportDefinition(Type type, string metadataKey)
- {
- return new ContractBasedImportDefinition(AttributedModelServices.GetContractName(typeof(IMyExporter)), null, new KeyValuePair<string, Type>[] { new KeyValuePair<string, Type>(metadataKey, typeof(object))}, ImportCardinality.ZeroOrMore, true, true, CreationPolicy.Any);
- }
-
- #endregion
-
- #region Tests for strongly typed metadata as part of contract
-
- [TestMethod]
- [WorkItem(468388)]
- [Ignore]
- public void SelectiveImportBySTM_Export()
- {
- CompositionContainer container = ContainerFactory.Create();
- CompositionBatch batch = new CompositionBatch();
-
- MyImporterWithExportStronglyTypedMetadata importer;
- batch.AddPart(new MyExporterWithNoMetadata());
- batch.AddPart(new MyExporterWithMetadata());
- batch.AddPart(importer = new MyImporterWithExportStronglyTypedMetadata());
-
- Assert.Fail();
-
- //var result = container.TryCompose();
-
- //Assert.IsTrue(result.Succeeded, "Composition should be successful becasue one of two exports does not have required metadata");
- //Assert.AreEqual(1, result.Issues.Count, "There should be an issue reported about the export who has no required metadata");
- //Assert.IsNotNull(importer.ValueInfo, "The valid export should really get bound");
- //Assert.AreEqual("Bar", importer.ValueInfo.Metadata.Foo, "The value of metadata 'Foo' should be 'Bar'");
- }
-
- [TestMethod]
- [WorkItem(468388)]
- [Ignore]
- public void SelectiveImportBySTM_ExportCollection()
- {
- CompositionContainer container = ContainerFactory.Create();
-
- MyImporterWithExportCollectionStronglyTypedMetadata importer;
- CompositionBatch batch = new CompositionBatch();
-
- batch.AddPart(new MyExporterWithNoMetadata());
- batch.AddPart(new MyExporterWithMetadata());
- batch.AddPart(importer = new MyImporterWithExportCollectionStronglyTypedMetadata());
-
- Assert.Fail();
-
- //var result = container.TryCompose();
-
- //Assert.IsTrue(result.Succeeded, "Collection import should be successful in anyway");
- //Assert.AreEqual(1, result.Issues.Count, "There should be an issue reported about the export with no required metadata");
- //Assert.AreEqual(1, importer.ValueInfoCol.Count, "There should be only one export got bound");
- //Assert.AreEqual("Bar", importer.ValueInfoCol.First().Metadata.Foo, "The value of metadata 'Foo' should be 'Bar'");
- }
-
- [TestMethod]
- public void SelectiveImportBySTMThroughComponentCatalog1()
- {
- var container = ContainerFactory.CreateWithDefaultAttributedCatalog();
- SelectiveImportBySTMThroughCatalog1(container);
- }
-
- public void SelectiveImportBySTMThroughCatalog1(CompositionContainer container)
- {
- Assert.IsNotNull(container.GetExport<IMyExporter, IMetadataView>());
-
- var result2 = container.GetExports<IMyExporter, IMetadataView>();
- }
-
- [TestMethod]
- [WorkItem(468388)]
- [Ignore]
- public void SelectiveImportBySTMThroughComponentCatalog2()
- {
- var container = ContainerFactory.CreateWithDefaultAttributedCatalog();
- SelectiveImportBySTMThroughCatalog2(container);
- }
-
- public void SelectiveImportBySTMThroughCatalog2(CompositionContainer container)
- {
- Assert.Fail("This needs to be fixed, see: 472538");
-
- //var export1 = container.GetExport<MyImporterWithExportStronglyTypedMetadata>();
- //var result1 = export1.TryGetExportedValue().VerifySuccess(CompositionIssueId.RequiredMetadataNotFound);
- //Assert.IsNotNull(result1.Value.ValueInfo, "The valid export should really get bound");
- //Assert.AreEqual("Bar", result1.Value.ValueInfo.Metadata.Foo, "The value of metadata 'Foo' should be 'Bar'");
-
- //var export2 = container.GetExport<MyImporterWithExportCollectionStronglyTypedMetadata>();
- //var result2 = export2.TryGetExportedValue().VerifySuccess(CompositionIssueId.RequiredMetadataNotFound);
- //Assert.AreEqual(1, result2.Value.ValueInfoCol.Count, "There should be only one export got bound");
- //Assert.AreEqual("Bar", result2.Value.ValueInfoCol.First().Metadata.Foo, "The value of metadata 'Foo' should be 'Bar'");
- }
-
- [TestMethod]
- public void TestMultipleStronglyTypedAttributes()
- {
- var container = ContainerFactory.CreateWithDefaultAttributedCatalog();
-
- var export = container.GetExport<ExportMultiple, IMyOptions>();
- EnumerableAssert.AreEqual(export.Metadata.OptionNames.OrderBy(s => s), "name1", "name2", "name3");
- EnumerableAssert.AreEqual(export.Metadata.OptionValues.OrderBy(o => o.ToString()), "value1", "value2", "value3");
- }
-
- [TestMethod]
- public void TestMultipleStronglyTypedAttributesAsIEnumerable()
- {
- var container = ContainerFactory.CreateWithDefaultAttributedCatalog();
-
- var export = container.GetExport<ExportMultiple, IMyOptionsAsIEnumerable>();
- EnumerableAssert.AreEqual(export.Metadata.OptionNames.OrderBy(s => s), "name1", "name2", "name3");
- EnumerableAssert.AreEqual(export.Metadata.OptionValues.OrderBy(o => o.ToString()), "value1", "value2", "value3");
- }
-
- [TestMethod]
- public void TestMultipleStronglyTypedAttributesAsArray()
- {
- var container = ContainerFactory.CreateWithDefaultAttributedCatalog();
-
- var export = container.GetExport<ExportMultiple, IMyOptionsAsArray>();
- EnumerableAssert.AreEqual(export.Metadata.OptionNames.OrderBy(s => s), "name1", "name2", "name3");
- EnumerableAssert.AreEqual(export.Metadata.OptionValues.OrderBy(o => o.ToString()), "value1", "value2", "value3");
- }
-
- [TestMethod]
- public void TestMultipleStronglyTypedAttributesWithInvalidType()
- {
- var container = ContainerFactory.CreateWithDefaultAttributedCatalog();
-
- // IMyOption2 actually contains all the correct properties but just the wrong types. This should cause us to not match the exports by metadata
- var exports = container.GetExports<ExportMultiple, IMyOption2>();
- Assert.AreEqual(0, exports.Count());
- }
-
- [TestMethod]
- public void TestOptionalMetadataValueTypeMismatch()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(OptionalFooIsInt));
- var exports = container.GetExports<OptionalFooIsInt, IMetadataView>();
- Assert.AreEqual(1, exports.Count());
- var export = exports.Single();
- Assert.AreEqual(null, export.Metadata.OptionalFoo);
- }
-
- #endregion
-
-
- [ExportMetadata("Name", "FromBaseType")]
- public abstract class BaseClassWithMetadataButNoExport
- {
- }
-
- [Export(typeof(BaseClassWithMetadataButNoExport))]
- public class DerivedClassWithExportButNoMetadata : BaseClassWithMetadataButNoExport
- {
- }
-
- [TestMethod]
- public void Metadata_BaseClassWithMetadataButNoExport()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(BaseClassWithMetadataButNoExport),
- typeof(DerivedClassWithExportButNoMetadata));
-
- var export = container.GetExport<BaseClassWithMetadataButNoExport, IDictionary<string, object>>();
-
- Assert.IsFalse(export.Metadata.ContainsKey("Name"), "Export should only contain metadata from the derived!");
- }
-
- [InheritedExport(typeof(BaseClassWithExportButNoMetadata))]
- public abstract class BaseClassWithExportButNoMetadata
- {
- }
-
-
- [ExportMetadata("Name", "FromDerivedType")]
- public class DerivedClassMetadataButNoExport : BaseClassWithExportButNoMetadata
- {
- }
-
- [TestMethod]
- public void Metadata_BaseClassWithExportButNoMetadata()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(BaseClassWithExportButNoMetadata),
- typeof(DerivedClassMetadataButNoExport));
-
- var export = container.GetExport<BaseClassWithExportButNoMetadata, IDictionary<string, object>>();
-
- Assert.IsFalse(export.Metadata.ContainsKey("Name"), "Export should only contain metadata from the base!");
- }
-
- [Export(typeof(BaseClassWithExportAndMetadata))]
- [ExportMetadata("Name", "FromBaseType")]
- public class BaseClassWithExportAndMetadata
- {
- }
-
- [Export(typeof(DerivedClassWithExportAndMetadata))]
- [ExportMetadata("Name", "FromDerivedType")]
- public class DerivedClassWithExportAndMetadata : BaseClassWithExportAndMetadata
- {
- }
-
- [TestMethod]
- public void Metadata_BaseAndDerivedWithExportAndMetadata()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(BaseClassWithExportAndMetadata),
- typeof(DerivedClassWithExportAndMetadata));
-
- var exportBase = container.GetExport<BaseClassWithExportAndMetadata, IDictionary<string, object>>();
-
- Assert.AreEqual("FromBaseType", exportBase.Metadata["Name"]);
-
- var exportDerived = container.GetExport<DerivedClassWithExportAndMetadata, IDictionary<string, object>>();
- Assert.AreEqual("FromDerivedType", exportDerived.Metadata["Name"]);
- }
-
- [Export]
- [ExportMetadata("Data", null, IsMultiple=true)]
- [ExportMetadata("Data", false, IsMultiple=true)]
- [ExportMetadata("Data", Int16.MaxValue, IsMultiple = true)]
- [ExportMetadata("Data", Int32.MaxValue, IsMultiple = true)]
- [ExportMetadata("Data", Int64.MaxValue, IsMultiple = true)]
- [ExportMetadata("Data", UInt16.MaxValue, IsMultiple = true)]
- [ExportMetadata("Data", UInt32.MaxValue, IsMultiple = true)]
- [ExportMetadata("Data", UInt64.MaxValue, IsMultiple = true)]
- [ExportMetadata("Data", "String", IsMultiple = true)]
- [ExportMetadata("Data", typeof(ClassWithLotsOfDifferentMetadataTypes), IsMultiple = true)]
- [ExportMetadata("Data", CreationPolicy.NonShared, IsMultiple=true)]
- [ExportMetadata("Data", new object[] { 1, 2, null }, IsMultiple=true)]
- [CLSCompliant(false)]
- public class ClassWithLotsOfDifferentMetadataTypes
- {
- }
-
- [TestMethod]
- public void ExportWithValidCollectionOfMetadata_ShouldDiscoverAllMetadata()
- {
- var catalog = CatalogFactory.CreateAttributed(typeof(ClassWithLotsOfDifferentMetadataTypes));
-
- var export = catalog.Parts.First().ExportDefinitions.First();
-
- var data = (object[])export.Metadata["Data"];
-
- Assert.AreEqual(12, data.Length);
- }
-
- [Export]
- [ExportMetadata("Data", null, IsMultiple = true)]
- [ExportMetadata("Data", 1, IsMultiple = true)]
- [ExportMetadata("Data", 2, IsMultiple = true)]
- [ExportMetadata("Data", 3, IsMultiple = true)]
- public class ClassWithIntCollectionWithNullValue
- {
- }
-
- [TestMethod]
- public void ExportWithIntCollectionPlusNullValueOfMetadata_ShouldDiscoverAllMetadata()
- {
- var catalog = CatalogFactory.CreateAttributed(typeof(ClassWithIntCollectionWithNullValue));
-
- var export = catalog.Parts.First().ExportDefinitions.First();
-
- var data = (object[])export.Metadata["Data"];
-
- Assert.IsNotInstanceOfType(data, typeof(int[]));
-
- Assert.AreEqual(4, data.Length);
- }
-
- [AttributeUsage(AttributeTargets.Class, AllowMultiple=true)]
- [MetadataAttribute]
- public class DataAttribute : Attribute
- {
- public object Object { get; set; }
- }
-
- [Export]
- [Data(Object="42")]
- [Data(Object = "10")]
- public class ExportWithMultipleMetadata_ExportStringsAsObjects
- {
- }
-
- [Export]
- [Data(Object = "42")]
- [Data(Object = "10")]
- [Data(Object = null)]
- public class ExportWithMultipleMetadata_ExportStringsAsObjects_WithNull
- {
- }
-
- [Export]
- [Data(Object = 42)]
- [Data(Object = 10)]
- public class ExportWithMultipleMetadata_ExportIntsAsObjects
- {
- }
-
- [Export]
- [Data(Object = null)]
- [Data(Object = 42)]
- [Data(Object = 10)]
- public class ExportWithMultipleMetadata_ExportIntsAsObjects_WithNull
- {
- }
-
- public interface IObjectView_AsStrings
- {
- string[] Object { get; }
- }
-
- public interface IObjectView_AsInts
- {
- int[] Object { get; }
- }
-
- public interface IObjectView
- {
- object[] Object { get; }
- }
-
-
- [TestMethod]
- public void ExportWithMultipleMetadata_ExportStringsAsObjects_ShouldDiscoverMetadataAsStrings()
- {
- var container = ContainerFactory.Create();
- container.ComposeParts(new ExportWithMultipleMetadata_ExportStringsAsObjects());
-
- var export = container.GetExport<ExportWithMultipleMetadata_ExportStringsAsObjects, IObjectView_AsStrings>();
- Assert.IsNotNull(export);
-
- Assert.IsNotNull(export.Metadata);
- Assert.IsNotNull(export.Metadata.Object);
- Assert.AreEqual(2, export.Metadata.Object.Length);
- }
-
- [TestMethod]
- public void ExportWithMultipleMetadata_ExportStringsAsObjects_With_Null_ShouldDiscoverMetadataAsStrings()
- {
- var container = ContainerFactory.Create();
- container.ComposeParts(new ExportWithMultipleMetadata_ExportStringsAsObjects_WithNull());
-
- var export = container.GetExport<ExportWithMultipleMetadata_ExportStringsAsObjects_WithNull, IObjectView_AsStrings>();
- Assert.IsNotNull(export);
-
- Assert.IsNotNull(export.Metadata);
- Assert.IsNotNull(export.Metadata.Object);
- Assert.AreEqual(3, export.Metadata.Object.Length);
- }
-
- [TestMethod]
- public void ExportWithMultipleMetadata_ExportIntsAsObjects_ShouldDiscoverMetadataAsInts()
- {
- var container = ContainerFactory.Create();
- container.ComposeParts(new ExportWithMultipleMetadata_ExportIntsAsObjects());
-
- var export = container.GetExport<ExportWithMultipleMetadata_ExportIntsAsObjects, IObjectView_AsInts>();
- Assert.IsNotNull(export);
-
- Assert.IsNotNull(export.Metadata);
- Assert.IsNotNull(export.Metadata.Object);
- Assert.AreEqual(2, export.Metadata.Object.Length);
- }
-
- [TestMethod]
- public void ExportWithMultipleMetadata_ExportIntsAsObjects_With_Null_ShouldDiscoverMetadataAsObjects()
- {
- var container = ContainerFactory.Create();
- container.ComposeParts(new ExportWithMultipleMetadata_ExportIntsAsObjects_WithNull());
-
- var exports = container.GetExports<ExportWithMultipleMetadata_ExportIntsAsObjects_WithNull, IObjectView_AsInts>();
- Assert.IsFalse(exports.Any());
-
- var export = container.GetExport<ExportWithMultipleMetadata_ExportIntsAsObjects_WithNull, IObjectView>();
-
- Assert.IsNotNull(export.Metadata);
- Assert.IsNotNull(export.Metadata.Object);
- Assert.AreEqual(3, export.Metadata.Object.Length);
- }
-
- [MetadataAttribute]
- [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
- public class OrderAttribute : Attribute
- {
- public string Before { get; set; }
- public string After { get; set; }
- }
-
- public interface IOrderMetadataView
- {
- string[] Before { get; }
- string[] After { get; }
- }
-
- [Export]
- [Order(Before = "Step3")]
- [Order(Before = "Step2")]
- public class OrderedItemBeforesOnly
- {
- }
-
- [TestMethod]
- public void ExportWithMultipleMetadata_ExportStringsAndNulls_ThroughMetadataAttributes()
- {
- var container = ContainerFactory.Create();
- container.ComposeParts(new OrderedItemBeforesOnly());
-
- var export = container.GetExport<OrderedItemBeforesOnly, IOrderMetadataView>();
- Assert.IsNotNull(export);
-
- Assert.IsNotNull(export.Metadata);
-
- Assert.IsNotNull(export.Metadata.Before);
- Assert.IsNotNull(export.Metadata.After);
-
- Assert.AreEqual(2, export.Metadata.Before.Length);
- Assert.AreEqual(2, export.Metadata.After.Length);
-
- Assert.IsNotNull(export.Metadata.Before[0]);
- Assert.IsNotNull(export.Metadata.Before[1]);
-
- Assert.IsNull(export.Metadata.After[0]);
- Assert.IsNull(export.Metadata.After[1]);
- }
-
- [MetadataAttribute]
- [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
- public class DataTypeAttribute : Attribute
- {
- public Type Type { get; set; }
- }
-
- public interface ITypesMetadataView
- {
- Type[] Type { get; }
- }
-
- [Export]
- [DataType(Type = typeof(int))]
- [DataType(Type = typeof(string))]
- public class ItemWithTypeExports
- {
- }
-
- [Export]
- [DataType(Type = typeof(int))]
- [DataType(Type = typeof(string))]
- [DataType(Type = null)]
- public class ItemWithTypeExports_WithNulls
- {
- }
-
- [Export]
- [DataType(Type = null)]
- [DataType(Type = null)]
- [DataType(Type = null)]
- public class ItemWithTypeExports_WithAllNulls
- {
- }
-
- [TestMethod]
- public void ExportWithMultipleMetadata_ExportTypes()
- {
- var container = ContainerFactory.Create();
- container.ComposeParts(new ItemWithTypeExports());
-
- var export = container.GetExport<ItemWithTypeExports, ITypesMetadataView>();
-
- Assert.IsNotNull(export.Metadata);
- Assert.IsNotNull(export.Metadata.Type);
- Assert.AreEqual(2, export.Metadata.Type.Length);
- }
-
- [TestMethod]
- public void ExportWithMultipleMetadata_ExportTypes_WithNulls()
- {
- var container = ContainerFactory.Create();
- container.ComposeParts(new ItemWithTypeExports_WithNulls());
-
- var export = container.GetExport<ItemWithTypeExports_WithNulls, ITypesMetadataView>();
-
- Assert.IsNotNull(export.Metadata);
- Assert.IsNotNull(export.Metadata.Type);
- Assert.AreEqual(3, export.Metadata.Type.Length);
- }
-
- [TestMethod]
- public void ExportWithMultipleMetadata_ExportTypes_WithAllNulls()
- {
- var container = ContainerFactory.Create();
- container.ComposeParts(new ItemWithTypeExports_WithAllNulls());
-
- var export = container.GetExport<ItemWithTypeExports_WithAllNulls, ITypesMetadataView>();
-
- Assert.IsNotNull(export.Metadata);
- Assert.IsNotNull(export.Metadata.Type);
- Assert.AreEqual(3, export.Metadata.Type.Length);
-
- Assert.IsNull(export.Metadata.Type[0]);
- Assert.IsNull(export.Metadata.Type[1]);
- Assert.IsNull(export.Metadata.Type[2]);
- }
- [Export]
- [ExportMetadata(null, "ValueOfNullKey")]
- public class ClassWithNullMetadataKey
- {
- }
-
- [TestMethod]
- public void ExportMetadataWithNullKey_ShouldUseEmptyString()
- {
- var nullMetadataCatalog = CatalogFactory.CreateAttributed(typeof(ClassWithNullMetadataKey));
- var nullMetadataExport = nullMetadataCatalog.Parts.Single().ExportDefinitions.Single();
-
- Assert.IsTrue(nullMetadataExport.Metadata.ContainsKey(string.Empty));
- Assert.AreEqual("ValueOfNullKey", nullMetadataExport.Metadata[string.Empty]);
- }
-
- }
-
-
-
-
-
- // Tests for metadata issues on export
-
- [Export]
- [ExportMetadata("foo", "bar1", IsMultiple = true)]
- [ExportMetadata("foo", "bar2", IsMultiple = true)]
- [ExportMetadata("acme", "acmebar", IsMultiple = true)]
- [ExportMetadata("acme", 2.0, IsMultiple = true)]
- [ExportMetadata("hello", "world")]
- [GoodStrongMetadata]
- public class MyExporterWithValidMetadata
- {
- [Export("ContractForValidMetadata")]
- [ExportMetadata("bar", "foo1", IsMultiple = true)]
- [ExportMetadata("bar", "foo2", IsMultiple = true)]
- [ExportMetadata("stuff", "acmebar", IsMultiple = true)]
- [ExportMetadata("stuff", 2.0, IsMultiple = true)]
- [ExportMetadata("world", "hello")] // the order of the attribute should not affect the result
- [GoodStrongMetadata]
- public double DoSomething() { return 0.618; }
- }
-
- [AttributeUsage(AttributeTargets.All, AllowMultiple = false)]
- [MetadataAttribute]
- public class GoodStrongMetadata : Attribute
- {
- public string GoodOne2 { get { return "GoodOneValue2"; } }
- public string ConflictedOne1 { get { return "ConflictedOneValue1"; } }
- public string ConflictedOne2 { get { return "ConflictedOneValue2"; } }
- }
-
- // Tests for metadata as part of contract
-
- public interface IMyExporter { }
-
- [Export]
- [Export(typeof(IMyExporter))]
- public class MyExporterWithNoMetadata : IMyExporter
- {
- }
-
- [Export]
- [Export(typeof(IMyExporter))]
- [ExportMetadata("Foo", "Bar")]
- public class MyExporterWithMetadata : IMyExporter
- {
- }
-
-
- public interface IMetadataFoo
- {
- string Foo { get; }
- }
-
- public interface IMetadataBar
- {
- string Bar { get; }
- }
-
- [Export]
- public class MyImporterWithExport
- {
- [Import(typeof(MyExporterWithNoMetadata))]
- public Lazy<MyExporterWithNoMetadata, IMetadataFoo> ValueInfo { get; set; }
- }
-
- [Export]
- public class SingleImportWithAllowDefault
- {
- [Import("Import", AllowDefault = true)]
- public Lazy<object> Import { get; set; }
- }
-
- [Export]
- public class SingleImport
- {
- [Import("Import")]
- public Lazy<object> Import { get; set; }
- }
-
- public interface IFooMetadataView
- {
- string Foo { get; }
- }
-
- [Export]
- public class MyImporterWithExportCollection
- {
- [ImportMany(typeof(MyExporterWithNoMetadata))]
- public IEnumerable<Lazy<MyExporterWithNoMetadata, IFooMetadataView>> ValueInfoCol { get; set; }
- }
-
- [Export]
- public class MyImporterWithExportForSelectiveImport
- {
- [Import]
- public Lazy<IMyExporter, IFooMetadataView> ValueInfo { get; set; }
- }
-
- [Export]
- public class MyImporterWithExportCollectionForSelectiveImport
- {
- [ImportMany]
- public Collection<Lazy<IMyExporter, IFooMetadataView>> ValueInfoCol { get; set; }
- }
-
- public interface IMetadataView
- {
- string Foo { get; }
-
- [System.ComponentModel.DefaultValue(null)]
- string OptionalFoo { get; }
- }
-
- [Export]
- [ExportMetadata("Foo", "fooValue3")]
- [ExportMetadata("OptionalFoo", 42)]
- public class OptionalFooIsInt { }
-
- [Export]
- public class MyImporterWithExportStronglyTypedMetadata
- {
- [Import]
- public Lazy<IMyExporter, IMetadataView> ValueInfo { get; set; }
- }
-
- [Export]
- public class MyImporterWithExportCollectionStronglyTypedMetadata
- {
- [ImportMany]
- public Collection<Lazy<IMyExporter, IMetadataView>> ValueInfoCol { get; set; }
- }
-
- public class MyExporterWithFullMetadata
- {
- [Export("MyStringContract")]
- public string String1 { get { return "String1"; } }
-
- [Export("MyStringContract")]
- [ExportMetadata("Foo", "fooValue")]
- public string String2 { get { return "String2"; } }
-
- [Export("MyStringContract")]
- [ExportMetadata("Bar", "barValue")]
- public string String3 { get { return "String3"; } }
-
- [Export("MyStringContract")]
- [ExportMetadata("Foo", "fooValue")]
- [ExportMetadata("Bar", "barValue")]
- public string String4 { get { return "String4"; } }
- }
-
- [MetadataAttribute]
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true)]
- public class MyOption : Attribute
- {
- public MyOption(string name, object value)
- {
- OptionNames = name;
- OptionValues = value;
- }
- public string OptionNames { get; set; }
- public object OptionValues { get; set; }
- }
-
- public interface IMyOptions
- {
- IList<string> OptionNames { get; }
- ICollection<string> OptionValues { get; }
- }
-
- public interface IMyOptionsAsIEnumerable
- {
- IEnumerable<string> OptionNames { get; }
- IEnumerable<string> OptionValues { get; }
- }
-
- public interface IMyOptionsAsArray
- {
- string[] OptionNames { get; }
- string[] OptionValues { get; }
- }
-
- [Export]
- [MyOption("name1", "value1")]
- [MyOption("name2", "value2")]
- [ExportMetadata("OptionNames", "name3", IsMultiple = true)]
- [ExportMetadata("OptionValues", "value3", IsMultiple = true)]
- public class ExportMultiple
- {
- }
-
- public interface IMyOption2
- {
- string OptionNames { get; }
- string OptionValues { get; }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/MetadataViewProviderTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/MetadataViewProviderTests.cs deleted file mode 100644 index 862402cd1b2..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/MetadataViewProviderTests.cs +++ /dev/null @@ -1,401 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class MetadataViewProviderTests
- {
-
- [TestMethod]
- public void GetMetadataView_InterfaceWithPropertySetter_ShouldThrowNotSupported()
- {
- var metadata = new Dictionary<string, object>();
- metadata["Value"] = "value";
-
- ExceptionAssert.Throws<NotSupportedException>(() =>
- {
- MetadataViewProvider.GetMetadataView<IMetadataViewWithPropertySetter>(metadata);
- });
- }
-
- [TestMethod]
- public void GetMetadataView_InterfaceWithMethod_ShouldThrowNotSupportedException()
- {
- var metadata = new Dictionary<string, object>();
- metadata["Value"] = "value";
-
- ExceptionAssert.Throws<NotSupportedException>(() =>
- {
- MetadataViewProvider.GetMetadataView<IMetadataViewWithMethod>(metadata);
- });
- }
-
- [TestMethod]
- public void GetMetadataView_InterfaceWithEvent_ShouldThrowNotSupportedException()
- {
- var metadata = new Dictionary<string, object>();
- metadata["Value"] = "value";
-
- ExceptionAssert.Throws<NotSupportedException>(() =>
- {
- MetadataViewProvider.GetMetadataView<IMetadataViewWithEvent>(metadata);
- });
- }
-
- [TestMethod]
- public void GetMetadataView_InterfaceWithIndexer_ShouldThrowNotSupportedException()
- {
- var metadata = new Dictionary<string, object>();
- metadata["Value"] = "value";
-
- ExceptionAssert.Throws<NotSupportedException>(() =>
- {
- MetadataViewProvider.GetMetadataView<IMetadataViewWithIndexer>(metadata);
- });
- }
-
- [TestMethod]
- public void GetMetadataView_AbstractClass_ShouldThrowMissingMethodException()
- {
- var metadata = new Dictionary<string, object>();
- metadata["Value"] = "value";
-
- ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- {
- MetadataViewProvider.GetMetadataView<AbstractClassMetadataView>(metadata);
- });
- }
-
- [TestMethod]
- public void GetMetadataView_AbstractClassWithConstructor_ShouldThrowMemberAccessException()
- {
- var metadata = new Dictionary<string, object>();
- metadata["Value"] = "value";
-
- ExceptionAssert.Throws<MemberAccessException>(() =>
- {
- MetadataViewProvider.GetMetadataView<AbstractClassWithConstructorMetadataView>(metadata);
- });
- }
-
- [TestMethod]
- public void GetMetadataView_IDictionaryAsTMetadataViewTypeArgument_ShouldReturnMetadata()
- {
- var metadata = new Dictionary<string, object>();
-
- var result = MetadataViewProvider.GetMetadataView<IDictionary<string, object>>(metadata);
-
- Assert.AreSame(metadata, result);
- }
-
- [TestMethod]
- public void GetMetadataView_IEnumerableAsTMetadataViewTypeArgument_ShouldReturnMetadata()
- {
- var metadata = new Dictionary<string, object>();
-
- var result = MetadataViewProvider.GetMetadataView<IEnumerable<KeyValuePair<string, object>>>(metadata);
-
- Assert.AreSame(metadata, result);
- }
-
-
- [TestMethod]
- public void GetMetadataView_DictionaryAsTMetadataViewTypeArgument_ShouldNotThrow()
- {
- var metadata = new Dictionary<string, object>();
- MetadataViewProvider.GetMetadataView<Dictionary<string, object>>(metadata);
- }
-
- [TestMethod]
- public void GetMetadataView_PrivateInterfaceAsTMetadataViewTypeArgument_ShouldhrowNotSupportedException()
- {
- var metadata = new Dictionary<string, object>();
- metadata["CanActivate"] = true;
-
- ExceptionAssert.Throws<NotSupportedException>(() =>
- {
- MetadataViewProvider.GetMetadataView<IActivator>(metadata);
- });
- }
-
- [TestMethod]
- public void GetMetadataView_DictionaryWithUncastableValueAsMetadataArgument_ShouldThrowCompositionContractMismatchException()
- {
- var metadata = new Dictionary<string, object>();
- metadata["Value"] = true;
-
- ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- {
- MetadataViewProvider.GetMetadataView<IMetadataView>(metadata);
- });
- }
-
- [TestMethod]
- public void GetMetadataView_InterfaceWithTwoPropertiesWithSameNameDifferentTypeAsTMetadataViewArgument_ShouldThrowContractMismatch()
- {
- var metadata = new Dictionary<string, object>();
- metadata["Value"] = 10;
-
- ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- {
- MetadataViewProvider.GetMetadataView<IMetadataView2>(metadata);
- });
- }
-
- [TestMethod]
- public void GetMetadataView_RawMetadata()
- {
- var metadata = new Dictionary<string, object>();
- metadata["Value"] = 10;
-
- var view = MetadataViewProvider.GetMetadataView<RawMetadata>(new Dictionary<string, object>(metadata));
-
- Assert.IsTrue(view.Count == metadata.Count);
- Assert.IsTrue(view["Value"] == metadata["Value"]);
- }
-
- [TestMethod]
- public void GetMetadataView_InterfaceInheritance()
- {
- var metadata = new Dictionary<string, object>();
- metadata["Value"] = "value";
- metadata["Value2"] = "value2";
-
- var view = MetadataViewProvider.GetMetadataView<IMetadataView3>(metadata);
- Assert.AreEqual("value", view.Value);
- Assert.AreEqual("value2", view.Value2);
- }
-
-
- [TestMethod]
- public void GetMetadataView_CachesViewType()
- {
- var metadata1 = new Dictionary<string, object>();
- metadata1["Value"] = "value1";
- var view1 = MetadataViewProvider.GetMetadataView<IMetadataView>(metadata1);
- Assert.AreEqual("value1", view1.Value);
-
- var metadata2 = new Dictionary<string, object>();
- metadata2["Value"] = "value2";
- var view2 = MetadataViewProvider.GetMetadataView<IMetadataView>(metadata2);
- Assert.AreEqual("value2", view2.Value);
-
- Assert.AreEqual(view1.GetType(), view2.GetType());
- }
-
- private interface IActivator
- {
- bool CanActivate
- {
- get;
- }
- }
- public class RawMetadata : Dictionary<string, object>
- {
- public RawMetadata(IDictionary<string, object> dictionary) : base(dictionary) { }
- }
-
- public interface IMetadataView
- {
- string Value
- {
- get;
- }
- }
-
- public interface IMetadataView2 : IMetadataView
- {
- new int Value
- {
- get;
- }
- }
-
- public interface IMetadataView3 : IMetadataView
- {
- string Value2
- {
- get;
- }
- }
-
- public interface IMetadataViewWithPropertySetter
- {
- string Value
- {
- get;
- set;
- }
- }
-
- public interface IMetadataViewWithMethod
- {
- string Value
- {
- get;
- }
- void Method();
- }
-
- public interface IMetadataViewWithEvent
- {
- string Value
- {
- get;
- }
- event EventHandler TestEvent;
- }
-
- public interface IMetadataViewWithIndexer
- {
- string Value
- {
- get;
- }
- string this[object o] { get; }
- }
-
- public abstract class AbstractClassMetadataView
- {
- public abstract object Value { get; }
- }
-
- public abstract class AbstractClassWithConstructorMetadataView
- {
- public AbstractClassWithConstructorMetadataView(IDictionary<string, object> metadata) {}
- public abstract object Value { get; }
- }
-
- public interface IMetadataViewWithDefaultedInt
- {
- [DefaultValue(120)]
- int MyInt { get; }
- }
-
- [TestMethod]
- public void GetMetadataView_IMetadataViewWithDefaultedInt()
- {
- var view = MetadataViewProvider.GetMetadataView<IMetadataViewWithDefaultedInt>(new Dictionary<string, object>());
- Assert.AreEqual(120, view.MyInt);
- }
-
-
- [TestMethod]
- public void GetMetadataView_IMetadataViewWithDefaultedIntAndInvalidMetadata()
- {
- Dictionary<string, object> metadata = new Dictionary<string, object>();
- metadata = new Dictionary<string, object>();
- metadata.Add("MyInt", 1.2);
- var view1 = MetadataViewProvider.GetMetadataView<IMetadataViewWithDefaultedInt>(metadata);
- Assert.AreEqual(120, view1.MyInt);
-
- metadata = new Dictionary<string, object>();
- metadata.Add("MyInt", "Hello, World");
- var view2 = MetadataViewProvider.GetMetadataView<IMetadataViewWithDefaultedInt>(metadata);
- Assert.AreEqual(120, view2.MyInt);
- }
-
-
- public interface IMetadataViewWithDefaultedBool
- {
- [DefaultValue(false)]
- bool MyBool { get; }
- }
-
- [TestMethod]
- public void GetMetadataView_IMetadataViewWithDefaultedBool()
- {
- var view = MetadataViewProvider.GetMetadataView<IMetadataViewWithDefaultedBool>(new Dictionary<string, object>());
- Assert.AreEqual(false, view.MyBool);
- }
-
- public interface IMetadataViewWithDefaultedInt64
- {
- [DefaultValue(Int64.MaxValue)]
- Int64 MyInt64 { get; }
- }
-
- [TestMethod]
- public void GetMetadataView_IMetadataViewWithDefaultedInt64()
- {
- var view = MetadataViewProvider.GetMetadataView<IMetadataViewWithDefaultedInt64>(new Dictionary<string, object>());
- Assert.AreEqual(Int64.MaxValue, view.MyInt64);
- }
-
- public interface IMetadataViewWithDefaultedString
- {
- [DefaultValue("MyString")]
- string MyString { get; }
- }
-
- [TestMethod]
- public void GetMetadataView_IMetadataViewWithDefaultedString()
- {
- var view = MetadataViewProvider.GetMetadataView<IMetadataViewWithDefaultedString>(new Dictionary<string, object>());
- Assert.AreEqual("MyString", view.MyString);
- }
-
- public interface IMetadataViewWithTypeMismatchDefaultValue
- {
- [DefaultValue("Strings can't cast to numbers")]
- int MyInt { get; }
- }
-
- [TestMethod]
- public void GetMetadataView_IMetadataViewWithTypeMismatchDefaultValue()
- {
- var exception = ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- {
- MetadataViewProvider.GetMetadataView<IMetadataViewWithTypeMismatchDefaultValue>(new Dictionary<string, object>());
- });
-
- Assert.IsInstanceOfType(exception.InnerException, typeof(TargetInvocationException));
- }
-
-
- public interface IMetadataViewUnboxAsInt
- {
- int Value { get; }
- }
-
-
- [TestMethod]
- public void GetMetadataView_IMetadataViewWithTypeMismatchOnUnbox()
- {
- var metadata = new Dictionary<string, object>();
- metadata["Value"] = (short)9999;
-
- var exception = ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- {
- MetadataViewProvider.GetMetadataView<IMetadataViewWithTypeMismatchDefaultValue>(new Dictionary<string, object>());
- });
-
- Assert.IsInstanceOfType(exception.InnerException, typeof(TargetInvocationException));
- }
-
- public interface IHasInt32
- {
- Int32 Value { get; }
- }
-
- [TestMethod]
- public void TestMetadataIntConversion()
- {
- var metadata = new Dictionary<string, object>();
- metadata["Value"] = (Int64)45;
-
- var exception = ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- {
- MetadataViewProvider.GetMetadataView<IHasInt32>(metadata);
- });
- }
-
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/MicroExport.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/MicroExport.cs deleted file mode 100644 index 3303f4d2ca7..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/MicroExport.cs +++ /dev/null @@ -1,79 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.Hosting;
-
-namespace System.ComponentModel.Composition
-{
- internal class MicroExport
- {
- public MicroExport(Type contractType, params object[] exportedValues)
- : this(AttributedModelServices.GetContractName(contractType), contractType, (IDictionary<string, object>)null, exportedValues)
- {
- }
-
- public MicroExport(string contractName, params object[] exportedValues)
- : this(contractName, exportedValues[0].GetType(), (IDictionary<string, object>)null, exportedValues)
- {
- }
-
- public MicroExport(Type contractType, IDictionary<string, object> metadata, params object[] exportedValues)
- : this(AttributedModelServices.GetContractName(contractType), exportedValues[0].GetType(), metadata, exportedValues)
- {
- }
-
- public MicroExport(string contractName, Type contractType, params object[] exportedValues)
- : this(contractName, contractType, (IDictionary<string, object>)null, exportedValues)
- {
- }
-
- public MicroExport(string contractName, IDictionary<string, object> metadata, params object[] exportedValues)
- : this(contractName, exportedValues[0].GetType(), metadata, exportedValues)
- {
- }
-
- public MicroExport(string contractName, Type contractType, IDictionary<string, object> metadata, params object[] exportedValues)
- {
- this.ContractName = contractName;
- this.ExportedValues = exportedValues;
-
- if (contractType != null)
- {
- string typeIdentity = AttributedModelServices.GetTypeIdentity(contractType);
-
- if (metadata == null)
- {
- metadata = new Dictionary<string, object>();
- }
-
- object val;
- if (!metadata.TryGetValue(CompositionConstants.ExportTypeIdentityMetadataName, out val))
- {
- metadata.Add(CompositionConstants.ExportTypeIdentityMetadataName, AttributedModelServices.GetTypeIdentity(contractType));
- }
- }
- this.Metadata = metadata;
- }
-
- public string ContractName
- {
- get;
- private set;
- }
-
- public object[] ExportedValues
- {
- get;
- private set;
- }
-
- public IDictionary<string, object> Metadata
- {
- get;
- private set;
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/PartCreationPolicyAttributeTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/PartCreationPolicyAttributeTests.cs deleted file mode 100644 index cbcac9cafc5..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/PartCreationPolicyAttributeTests.cs +++ /dev/null @@ -1,41 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class PartCreationPolicyAttributeTests
- {
- [TestMethod]
- public void Constructor_ShouldSetCreationPolicyToGivenValue()
- {
- var expectations = Expectations.GetEnumValues<CreationPolicy>();
-
- foreach (var e in expectations)
- {
- var attribute = new PartCreationPolicyAttribute(e);
-
- Assert.AreEqual(e, attribute.CreationPolicy);
- }
- }
-
- [TestMethod]
- public void Constructor_OutOfRangeValueAsCreationPolicyArgument_ShouldSetCreationPolicy()
- { // Attributes should not throw exceptions
-
- var expectations = Expectations.GetInvalidEnumValues<CreationPolicy>();
-
- foreach (var e in expectations)
- {
- var attribute = new PartCreationPolicyAttribute(e);
-
- Assert.AreEqual(e, attribute.CreationPolicy);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/PartMetadataAttributeTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/PartMetadataAttributeTests.cs deleted file mode 100644 index 54722a3c9a3..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/PartMetadataAttributeTests.cs +++ /dev/null @@ -1,48 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.UnitTesting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class PartMetadataAttributeTests
- {
- [TestMethod]
- public void Constructor_NullAsNameArgument_ShouldSetNamePropertyToEmptyString()
- {
- var attribute = new PartMetadataAttribute((string)null, "Value");
-
- Assert.AreEqual(string.Empty, attribute.Name);
- }
-
- [TestMethod]
- public void Constructor_ValueAsNameArgument_ShouldSetNameProperty()
- {
- var expectations = Expectations.GetMetadataNames();
-
- foreach (var e in expectations)
- {
- var attribute = new PartMetadataAttribute(e, "Value");
-
- Assert.AreEqual(e, attribute.Name);
- }
- }
-
- [TestMethod]
- public void Constructor_ValueAsValueArgument_ShouldSetValueProperty()
- {
- var expectations = Expectations.GetMetadataValues();
-
- foreach (var e in expectations)
- {
- var attribute = new PartMetadataAttribute("Name", e);
-
- Assert.AreEqual(e, attribute.Value);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Primitives/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Primitives/.gitattributes deleted file mode 100644 index 2c06c29c5de..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Primitives/.gitattributes +++ /dev/null @@ -1,5 +0,0 @@ -/ComposablePartCatalogDebuggerProxyTests.cs -crlf -/ComposablePartCatalogTests.cs -crlf -/CompositionElementDebuggerProxyTests.cs -crlf -/CompositionElementTests.cs -crlf -/SerializableCompositionElementTests.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Primitives/ComposablePartCatalogDebuggerProxyTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Primitives/ComposablePartCatalogDebuggerProxyTests.cs deleted file mode 100644 index 4bf0be6b52a..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Primitives/ComposablePartCatalogDebuggerProxyTests.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Factories;
-
-namespace System.ComponentModel.Composition.Primitives
-{
- [TestClass]
- public class ComposablePartCatalogDebuggerProxyTests
- {
- [TestMethod]
- public void Constructor_NullAsCatalogArgument_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("catalog", () =>
- {
- new ComposablePartCatalogDebuggerProxy((ComposablePartCatalog)null);
- });
- }
-
- [TestMethod]
- public void Constructor_ValueAsCatalogArgument_ShouldSetPartsProperty()
- {
- var expectations = Expectations.GetCatalogs();
- foreach (var e in expectations)
- {
- var proxy = new ComposablePartCatalogDebuggerProxy(e);
-
- EnumerableAssert.AreSequenceEqual(e.Parts, proxy.Parts);
- }
- }
-
- [TestMethod]
- [Ignore]
- [WorkItem(812029)]
- public void Parts_ShouldNotCacheUnderlyingParts()
- {
- var catalog = CatalogFactory.CreateAggregateCatalog();
- var proxy = CreateComposablePartCatalogDebuggerProxy(catalog);
-
- EnumerableAssert.IsEmpty(proxy.Parts);
-
- var expectations = Expectations.GetCatalogs();
- foreach (var e in expectations)
- {
- catalog.Catalogs.Add(e);
-
- EnumerableAssert.AreSequenceEqual(catalog.Parts, proxy.Parts);
-
- catalog.Catalogs.Remove(e);
- }
- }
-
- private ComposablePartCatalogDebuggerProxy CreateComposablePartCatalogDebuggerProxy(ComposablePartCatalog catalog)
- {
- return new ComposablePartCatalogDebuggerProxy(catalog);
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Primitives/ComposablePartCatalogTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Primitives/ComposablePartCatalogTests.cs deleted file mode 100644 index 73a809fb1d1..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Primitives/ComposablePartCatalogTests.cs +++ /dev/null @@ -1,114 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Factories;
-using System.Linq;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.Linq.Expressions;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class ComposablePartCatalogTests
- {
- [TestMethod]
- public void GetExports_WhenDisposed_ShouldThrowObjectDisposed()
- {
- var catalog = CatalogFactory.Create();
- catalog.Dispose();
- var definition = ImportDefinitionFactory.Create();
-
- ExceptionAssert.ThrowsDisposed(catalog, () =>
- {
- catalog.GetExports(definition);
- });
- }
-
- [TestMethod]
- public void GetExports_NullAsConstraintArgument_ShouldThrowArgumentNull()
- {
- var catalog = CatalogFactory.Create();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("definition", () =>
- {
- catalog.GetExports((ImportDefinition)null);
- });
- }
-
- [TestMethod]
- public void Dispose_ShouldNotThrow()
- {
- var catalog = CatalogFactory.Create();
- catalog.Dispose();
- }
-
- [TestMethod]
- public void Dispose_CanBeCalledMultipleTimes()
- {
- var catalog = CatalogFactory.Create();
- catalog.Dispose();
- catalog.Dispose();
- catalog.Dispose();
- }
-
- [TestMethod]
- public void Dispose_CallsGCSuppressFinalize()
- {
- bool finalizerCalled = false;
-
- var catalog = CatalogFactory.CreateDisposable(disposing =>
- {
- if (!disposing)
- {
- finalizerCalled = true;
- }
-
- });
-
- catalog.Dispose();
-
- GC.Collect();
- GC.WaitForPendingFinalizers();
- GC.Collect();
-
- Assert.IsFalse(finalizerCalled);
- }
-
- [TestMethod]
- public void Dispose_CallsDisposeBoolWithTrue()
- {
- var catalog = CatalogFactory.CreateDisposable(disposing =>
- {
- Assert.IsTrue(disposing);
- });
-
- catalog.Dispose();
- }
-
- [TestMethod]
- public void Dispose_CallsDisposeBoolOnce()
- {
- int disposeCount = 0;
- var catalog = CatalogFactory.CreateDisposable(disposing =>
- {
- disposeCount++;
- });
-
- catalog.Dispose();
-
- Assert.AreEqual(1, disposeCount);
- }
-
- private IQueryable<ComposablePartDefinition> GetPartDefinitions(ExportDefinition definition)
- {
- var partDefinition = PartDefinitionFactory.Create(null, () => null, Enumerable.Empty<ImportDefinition>(), new ExportDefinition[] { definition });
-
- return new ComposablePartDefinition[] { partDefinition }.AsQueryable();
- }
- }
-}
-
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Primitives/CompositionElementDebuggerProxyTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Primitives/CompositionElementDebuggerProxyTests.cs deleted file mode 100644 index f4d69dcbb13..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Primitives/CompositionElementDebuggerProxyTests.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Primitives;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- [TestClass]
- public class CompositionElementDebuggerProxyTests
- {
- [TestMethod]
- public void Constructor_NullAsElementArgument_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("element", () =>
- {
- new CompositionElementDebuggerProxy((CompositionElement)null);
- });
- }
-
- [TestMethod]
- public void Constructor_ValueAsElementArgument_ShouldSetDisplayNameProperty()
- {
- var expectations = Expectations.GetObjectsReferenceTypes();
-
- foreach (var e in expectations)
- {
- var element = CreateCompositionElement(e);
-
- var proxy = new CompositionElementDebuggerProxy(element);
-
- Assert.AreSame(element.DisplayName, proxy.DisplayName);
- }
- }
-
- [TestMethod]
- public void Constructor_ValueAsElementArgument_ShouldSetOriginProperty()
- {
- var expectations = Expectations.GetObjectsReferenceTypes();
-
- foreach (var e in expectations)
- {
- var element = CreateCompositionElement(e);
-
- var proxy = new CompositionElementDebuggerProxy(element);
-
- Assert.AreSame(element.Origin, proxy.Origin);
- }
- }
-
- [TestMethod]
- public void Constructor_ValueAsElementArgument_ShouldSetUnderlyingObjectProperty()
- {
- var expectations = Expectations.GetObjectsReferenceTypes();
-
- foreach (var e in expectations)
- {
- var element = CreateCompositionElement(e);
-
- var proxy = new CompositionElementDebuggerProxy(element);
-
- Assert.AreSame(element.UnderlyingObject, proxy.UnderlyingObject);
- }
- }
-
- private static CompositionElement CreateCompositionElement(object underlyingObject)
- {
- return new CompositionElement(underlyingObject);
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Primitives/CompositionElementTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Primitives/CompositionElementTests.cs deleted file mode 100644 index e7fdc1346f8..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Primitives/CompositionElementTests.cs +++ /dev/null @@ -1,75 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Primitives;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- [TestClass]
- public class CompositionElementTests
- {
- [TestMethod]
- public void Constructor_ValueAsUnderlyingObjectArgument_ShouldSetUnderlyingObjectProperty()
- {
- var expectations = Expectations.GetObjectsReferenceTypes();
-
- foreach (var e in expectations)
- {
- var element = new CompositionElement(e);
-
- Assert.AreSame(e, element.UnderlyingObject);
- }
- }
-
- [TestMethod]
- public void Constructor_ValueAsUnderlyingObjectArgument_ShouldSetDisplayNamePropertyToUnderlyingObjectToString()
- {
- var expectations = Expectations.GetObjectsReferenceTypes();
-
- foreach (var e in expectations)
- {
- var element = new CompositionElement(e);
-
- Assert.AreEqual(e.ToString(), element.DisplayName);
- }
- }
-
- [TestMethod]
- public void Constructor_ValueAsUnderlyingObjectArgument_ShouldSetOriginToUnknown()
- {
- var expectations = Expectations.GetObjectsReferenceTypes();
-
- foreach (var e in expectations)
- {
- var element = new CompositionElement(e);
-
- Assert.IsNotNull(element.Origin);
- Assert.IsNull(element.Origin.Origin);
- }
- }
-
- [TestMethod]
- public void ToString_ShouldReturnDisplayNameProperty()
- {
- var expectations = Expectations.GetObjectsReferenceTypes();
-
- foreach (var e in expectations)
- {
- var element = CreateCompositionElement(e);
-
- Assert.AreEqual(element.DisplayName, element.ToString());
- }
- }
-
- private static CompositionElement CreateCompositionElement(object underlyingObject)
- {
- return new CompositionElement(underlyingObject);
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Primitives/SerializableCompositionElementTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Primitives/SerializableCompositionElementTests.cs deleted file mode 100644 index 4f038de4987..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/Primitives/SerializableCompositionElementTests.cs +++ /dev/null @@ -1,137 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.UnitTesting;
-using System.Runtime.Serialization;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- [TestClass]
- public class SerializableCompositionElementTests
- {
- [TestMethod]
- public void FromICompositionElement_NullAsElementArgument_ShouldReturnNull()
- {
- var result = SerializableCompositionElement.FromICompositionElement((ICompositionElement)null);
-
- Assert.IsNull(result);
- }
-
- [TestMethod]
- public void FromICompositionElement_ValueWithNullDisplayNameAsElementArgument_ShouldSetDisplayNamePropertyToEmptyString()
- {
- var element = ElementFactory.Create((string)null);
- Assert.IsNull(element.DisplayName);
-
- var result = SerializableCompositionElement.FromICompositionElement(element);
-
- Assert.AreEqual(string.Empty, result.DisplayName);
- }
-
- [TestMethod]
- public void FromICompositionElement_ValueAsElementArgument_ShouldSetDisplayNameProperty()
- {
- var expectations = Expectations.GetDisplayNames();
-
- foreach (var e in expectations)
- {
- var element = ElementFactory.Create(e);
-
- var result = SerializableCompositionElement.FromICompositionElement(element);
-
- Assert.AreEqual(e, result.DisplayName);
- }
- }
-
- [TestMethod]
- public void FormICompositionElement_ValueWithNullOriginAsElementArgument_ShouldSetOriginPropertyToNull()
- {
- var element = ElementFactory.Create((ICompositionElement)null);
- Assert.IsNull(element.Origin);
-
- var result = SerializableCompositionElement.FromICompositionElement(element);
-
- Assert.IsNull(element.Origin);
- }
-
- [TestMethod]
- public void FromICompositionElement_ValueAsElementArgument_ShouldSetOriginProperty()
- {
- var expectations = Expectations.GetCompositionElements();
-
- foreach (var e in expectations)
- {
- var element = ElementFactory.Create(e);
-
- var result = SerializableCompositionElement.FromICompositionElement(element);
-
- ElementAssert.AreEqual(e, result.Origin);
- }
- }
-
- [TestMethod]
- public void ToString_ShouldReturnDisplayNameProperty()
- {
- var expectations = Expectations.GetDisplayNames();
-
- foreach (var e in expectations)
- {
- var element = ElementFactory.Create(e);
-
- var result = SerializableCompositionElement.FromICompositionElement(element);
-
- Assert.AreEqual(e, result.ToString());
- }
- }
-
-#if !SILVERLIGHT
-
- [TestMethod]
- public void Origin_CanBeSerialized()
- {
- var expectations = Expectations.GetCompositionElements();
-
- foreach (var e in expectations)
- {
- var element = CreateSerializableCompositionElement(e);
-
- var result = SerializationTestServices.RoundTrip(element);
-
- ElementAssert.AreEqual(e, result);
- }
- }
-
- [TestMethod]
- public void DisplayName_CanBeSerialized()
- {
- var expectations = Expectations.GetDisplayNames();
-
- foreach (var e in expectations)
- {
- var element = CreateSerializableCompositionElement(e);
-
- var result = SerializationTestServices.RoundTrip(element);
-
- Assert.AreEqual(e, result.DisplayName);
- }
- }
-
-#endif
-
- private static SerializableCompositionElement CreateSerializableCompositionElement(string displayName)
- {
- var element = ElementFactory.Create(displayName);
-
- return CreateSerializableCompositionElement(element);
- }
-
- private static SerializableCompositionElement CreateSerializableCompositionElement(ICompositionElement element)
- {
- return (SerializableCompositionElement)SerializableCompositionElement.FromICompositionElement(element);
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ReflectionModel/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ReflectionModel/.gitattributes deleted file mode 100644 index 394a811bd56..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ReflectionModel/.gitattributes +++ /dev/null @@ -1,7 +0,0 @@ -/LazyMemberInfoTests.cs -crlf -/ReflectionComposablePartDefinitionTests.cs -crlf -/ReflectionComposablePartTests.cs -crlf -/ReflectionMemberExportDefinitionTests.cs -crlf -/ReflectionMemberImportDefinitionTests.cs -crlf -/ReflectionModelServicesTests.cs -crlf -/ReflectionParameterImportDefinitionTests.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ReflectionModel/LazyMemberInfoTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ReflectionModel/LazyMemberInfoTests.cs deleted file mode 100644 index edc08f368a5..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ReflectionModel/LazyMemberInfoTests.cs +++ /dev/null @@ -1,248 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Reflection;
-using Microsoft.Internal;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.Collections.Generic;
-using System.Linq;
-using System.UnitTesting;
-using System.Threading;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- [TestClass]
- public class LazyMemberInfoTests
- {
- [TestMethod]
- public void Constructor_PassMember()
- {
- foreach (var memberAndAccessorsInfo in GetMembersAndAccessors(typeof(LazyMemberTestClass)))
- {
- MemberInfo member = memberAndAccessorsInfo.Item1;
- MemberTypes memberType = memberAndAccessorsInfo.Item2.Item1;
- MemberInfo[] accessors = memberAndAccessorsInfo.Item2.Item2;
-
- LazyMemberInfo lazy = new LazyMemberInfo(member);
- Assert.AreEqual(memberType, lazy.MemberType);
- Assert.AreEqual(accessors.Length, lazy.GetAccessors().Length);
- Assert.IsTrue(accessors.SequenceEqual(lazy.GetAccessors()));
- }
- }
-
- [TestMethod]
- public void Constructor_PassNullMember()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("member", () =>
- {
- LazyMemberInfo lazy = new LazyMemberInfo((MemberInfo)null);
- });
- }
-
- [TestMethod]
- public void Constructor_PassAccessors()
- {
- foreach (var memberAndAccessorsInfo in GetMembersAndAccessors(typeof(LazyMemberTestClass)))
- {
- MemberInfo member = memberAndAccessorsInfo.Item1;
- MemberTypes memberType = memberAndAccessorsInfo.Item2.Item1;
- MemberInfo[] accessors = memberAndAccessorsInfo.Item2.Item2;
-
- LazyMemberInfo lazy = new LazyMemberInfo(memberType, accessors);
- Assert.AreEqual(memberType, lazy.MemberType);
- Assert.AreEqual(accessors.Length, lazy.GetAccessors().Length);
- Assert.IsTrue(accessors.SequenceEqual(lazy.GetAccessors()));
- }
- }
-
- [TestMethod]
- public void Constructor_PassInvalidAccessors()
- {
- foreach (var memberAndAccessorsInfo in GetMembersAndAccessors(typeof(LazyMemberTestClass)))
- {
- MemberInfo member = memberAndAccessorsInfo.Item1;
- MemberTypes memberType = memberAndAccessorsInfo.Item2.Item1;
- MemberInfo[] accessors = memberAndAccessorsInfo.Item2.Item2;
-
- foreach (MemberTypes wrongMemberType in GetValidMemberTypes())
- {
- if (wrongMemberType == memberType)
- {
- continue;
- }
- ExceptionAssert.ThrowsArgument<ArgumentException>("accessors", () =>
- {
- LazyMemberInfo lazy = new LazyMemberInfo(wrongMemberType, accessors);
- });
- }
- }
- }
-
- [TestMethod]
- public void Constructor_PassAccessorsInvalidMemberType()
- {
- MemberTypes[] validMemberTypes = GetValidMemberTypes().ToArray();
- foreach (MemberTypes memberType in GetMemberTypeValues())
- {
- if (!validMemberTypes.Contains(memberType))
- {
- ExceptionAssert.ThrowsArgument<ArgumentException>("memberType", () =>
- {
- LazyMemberInfo lazy = new LazyMemberInfo(memberType, typeof(LazyMemberTestClass));
- });
- }
- }
- }
-
- [TestMethod]
- public void Constructor_PassNullAccessors()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("accessors", () =>
- {
- LazyMemberInfo lazy = new LazyMemberInfo(MemberTypes.Field, (MemberInfo[])null);
- });
- }
-
- [TestMethod]
- public void Constructor_PassAccessorsWithNulls()
- {
- ExceptionAssert.ThrowsArgument<ArgumentException>("accessors", () =>
- {
- LazyMemberInfo lazy = new LazyMemberInfo(MemberTypes.Field, new MemberInfo[] { null, null });
- });
- }
-
- [TestMethod]
- public void Constructor_PassAccessorCreators()
- {
- foreach (var memberAndAccessorsInfo in GetMembersAndAccessors(typeof(LazyMemberTestClass)))
- {
- MemberInfo member = memberAndAccessorsInfo.Item1;
- MemberTypes memberType = memberAndAccessorsInfo.Item2.Item1;
- MemberInfo[] accessors = memberAndAccessorsInfo.Item2.Item2;
-
- LazyMemberInfo lazy = new LazyMemberInfo(memberType, () => accessors);
- Assert.AreEqual(memberType, lazy.MemberType);
- Assert.AreEqual(accessors.Length, lazy.GetAccessors().Length);
- Assert.IsTrue(accessors.SequenceEqual(lazy.GetAccessors()));
- }
- }
-
- [TestMethod]
- public void Constructor_PassInvalidAccessorCreators()
- {
- foreach (var memberAndAccessorsInfo in GetMembersAndAccessors(typeof(LazyMemberTestClass)))
- {
- MemberInfo member = memberAndAccessorsInfo.Item1;
- MemberTypes memberType = memberAndAccessorsInfo.Item2.Item1;
- MemberInfo[] accessors = memberAndAccessorsInfo.Item2.Item2;
-
- foreach (MemberTypes wrongMemberType in GetValidMemberTypes())
- {
- if (wrongMemberType == memberType)
- {
- continue;
- }
- LazyMemberInfo lazy = new LazyMemberInfo(wrongMemberType, () => accessors);
- ExceptionAssert.Throws<InvalidOperationException>(() =>
- {
- lazy.GetAccessors();
- });
- }
- }
- }
-
- [TestMethod]
- public void Constructor_PassAccessorCreatorsWithInvalidMemberType()
- {
- MemberTypes[] validMemberTypes = GetValidMemberTypes().ToArray();
- foreach (MemberTypes memberType in GetMemberTypeValues())
- {
- if (!validMemberTypes.Contains(memberType))
- {
- ExceptionAssert.ThrowsArgument<ArgumentException>("memberType", () =>
- {
- LazyMemberInfo lazy = new LazyMemberInfo(memberType, () => new MemberInfo[] { typeof(LazyMemberTestClass) });
- });
- }
- }
- }
-
- [TestMethod]
- public void Constructor_PassNullAccessorCreators()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("accessorsCreator", () =>
- {
- LazyMemberInfo lazy = new LazyMemberInfo(MemberTypes.Field, (Func<MemberInfo[]>)null);
- });
- }
-
-
- private static IEnumerable<Tuple<MemberInfo, Tuple<MemberTypes, MemberInfo[]>>> GetMembersAndAccessors(Type type)
- {
- yield return new Tuple<MemberInfo, Tuple<MemberTypes, MemberInfo[]>>(
- type, new Tuple<MemberTypes, MemberInfo[]>(type.MemberType, new MemberInfo[] { type }));
-
- foreach (MemberInfo member in type.GetMembers())
- {
- MemberInfo[] accessors = null;
- if (member.MemberType == MemberTypes.Property)
- {
- PropertyInfo property = (PropertyInfo)member;
- accessors = new MemberInfo[] { property.GetGetMethod(true), property.GetSetMethod(true) };
- }
- else if (member.MemberType == MemberTypes.Event)
- {
- EventInfo event_ = (EventInfo)member;
- accessors = new MemberInfo[] { event_.GetRaiseMethod(true), event_.GetAddMethod(true), event_.GetRemoveMethod(true) };
- }
- else
- {
- accessors = new MemberInfo[] { member };
- }
-
- yield return new Tuple<MemberInfo, Tuple<MemberTypes, MemberInfo[]>>(
- member, new Tuple<MemberTypes, MemberInfo[]>(member.MemberType, accessors));
- }
- }
-
- private static IEnumerable<MemberTypes> GetMemberTypeValues()
- {
- yield return MemberTypes.All;
- yield return MemberTypes.Constructor;
- yield return MemberTypes.Custom;
- yield return MemberTypes.Event;
- yield return MemberTypes.Field;
- yield return MemberTypes.Method;
- yield return MemberTypes.NestedType;
- yield return MemberTypes.Property;
- yield return MemberTypes.TypeInfo;
- }
-
- private static IEnumerable<MemberTypes> GetValidMemberTypes()
- {
- yield return MemberTypes.TypeInfo;
- yield return MemberTypes.NestedType;
- yield return MemberTypes.Constructor;
- yield return MemberTypes.Field;
- yield return MemberTypes.Method;
- yield return MemberTypes.Property;
- yield return MemberTypes.Event;
- }
-
- public class LazyMemberTestClass
- {
- public LazyMemberTestClass() { }
- public string Property { get; set; }
- public string SetProperty { set { } }
- public string GetProperty { get { return null; } }
- public string Field;
- public void Method() { this.Event(this, new EventArgs()); }
- public event EventHandler Event;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ReflectionModel/ReflectionComposablePartDefinitionTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ReflectionModel/ReflectionComposablePartDefinitionTests.cs deleted file mode 100644 index 778ded44a1f..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ReflectionModel/ReflectionComposablePartDefinitionTests.cs +++ /dev/null @@ -1,353 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Reflection;
-using Microsoft.Internal;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.Collections.Generic;
-using System.Linq;
-using System.UnitTesting;
-using System.Threading;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- [TestClass]
- public class ReflectionComposablePartDefinitionTests
- {
- private ReflectionComposablePartDefinition CreateReflectionPartDefinition(
- Lazy<Type> partType,
- bool requiresDisposal,
- Func<IEnumerable<ImportDefinition>> imports,
- Func<IEnumerable<ExportDefinition>>exports,
- IDictionary<string, object> metadata,
- ICompositionElement origin)
- {
- return (ReflectionComposablePartDefinition)ReflectionModelServices.CreatePartDefinition(partType, requiresDisposal,
- new Lazy<IEnumerable<ImportDefinition>>(imports, false),
- new Lazy<IEnumerable<ExportDefinition>>(exports, false),
- metadata.AsLazy(), origin);
- }
-
- [TestMethod]
- public void Constructor()
- {
- Type expectedType = typeof(TestPart);
- Lazy<Type> expectedLazyType = expectedType.AsLazy();
- IDictionary<string, object> expectedMetadata = new Dictionary<string, object>();
- expectedMetadata["Key1"] = 1;
- expectedMetadata["Key2"] = "Value2";
-
- IEnumerable<ImportDefinition> expectedImports = CreateImports(expectedType);
- IEnumerable<ExportDefinition> expectedExports = CreateExports(expectedType);
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ReflectionComposablePartDefinition definition = CreateReflectionPartDefinition(
- expectedLazyType,
- false,
- () => expectedImports,
- () => expectedExports,
- expectedMetadata,
- expectedOrigin);
-
- Assert.AreSame(expectedType, definition.GetPartType());
- Assert.IsTrue(definition.Metadata.Keys.SequenceEqual(expectedMetadata.Keys));
- Assert.IsTrue(definition.Metadata.Values.SequenceEqual(expectedMetadata.Values));
- Assert.IsTrue(definition.ExportDefinitions.SequenceEqual(expectedExports.Cast<ExportDefinition>()));
- Assert.IsTrue(definition.ImportDefinitions.SequenceEqual(expectedImports.Cast<ImportDefinition>()));
- Assert.AreSame(expectedOrigin, ((ICompositionElement)definition).Origin);
- Assert.IsNotNull(((ICompositionElement)definition).DisplayName);
- Assert.IsFalse(definition.IsDisposalRequired);
- }
-
- [TestMethod]
- public void Constructor_DisposablePart()
- {
- Type expectedType = typeof(TestPart);
- Lazy<Type> expectedLazyType = expectedType.AsLazy();
- IDictionary<string, object> expectedMetadata = new Dictionary<string, object>();
- expectedMetadata["Key1"] = 1;
- expectedMetadata["Key2"] = "Value2";
-
- IEnumerable<ImportDefinition> expectedImports = CreateImports(expectedType);
- IEnumerable<ExportDefinition> expectedExports = CreateExports(expectedType);
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ReflectionComposablePartDefinition definition = CreateReflectionPartDefinition(
- expectedLazyType,
- true,
- () => expectedImports,
- () => expectedExports,
- expectedMetadata,
- expectedOrigin);
-
- Assert.AreSame(expectedType, definition.GetPartType());
- Assert.IsTrue(definition.Metadata.Keys.SequenceEqual(expectedMetadata.Keys));
- Assert.IsTrue(definition.Metadata.Values.SequenceEqual(expectedMetadata.Values));
- Assert.IsTrue(definition.ExportDefinitions.SequenceEqual(expectedExports.Cast<ExportDefinition>()));
- Assert.IsTrue(definition.ImportDefinitions.SequenceEqual(expectedImports.Cast<ImportDefinition>()));
- Assert.AreSame(expectedOrigin, ((ICompositionElement)definition).Origin);
- Assert.IsNotNull(((ICompositionElement)definition).DisplayName);
- Assert.IsTrue(definition.IsDisposalRequired);
- }
-
- [TestMethod]
- public void CreatePart()
- {
- Type expectedType = typeof(TestPart);
- Lazy<Type> expectedLazyType = expectedType.AsLazy();
- IDictionary<string, object> expectedMetadata = new Dictionary<string, object>();
- expectedMetadata["Key1"] = 1;
- expectedMetadata["Key2"] = "Value2";
-
- IEnumerable<ImportDefinition> expectedImports = CreateImports(expectedType);
- IEnumerable<ExportDefinition> expectedExports = CreateExports(expectedType);
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ReflectionComposablePartDefinition definition = CreateReflectionPartDefinition(
- expectedLazyType,
- false,
- () => expectedImports,
- () => expectedExports,
- expectedMetadata,
- expectedOrigin);
-
- var part = definition.CreatePart();
- Assert.IsNotNull(part);
- Assert.IsFalse(part is IDisposable);
- }
-
- [TestMethod]
- public void CreatePart_Disposable()
- {
- Type expectedType = typeof(TestPart);
- Lazy<Type> expectedLazyType = expectedType.AsLazy();
- IDictionary<string, object> expectedMetadata = new Dictionary<string, object>();
- expectedMetadata["Key1"] = 1;
- expectedMetadata["Key2"] = "Value2";
-
- IEnumerable<ImportDefinition> expectedImports = CreateImports(expectedType);
- IEnumerable<ExportDefinition> expectedExports = CreateExports(expectedType);
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ReflectionComposablePartDefinition definition = CreateReflectionPartDefinition(
- expectedLazyType,
- true,
- () => expectedImports,
- () => expectedExports,
- expectedMetadata,
- expectedOrigin);
-
- var part = definition.CreatePart();
- Assert.IsNotNull(part);
- Assert.IsTrue(part is IDisposable);
- }
-
- [TestMethod]
- public void CreatePart_DoesntLoadType()
- {
- Type expectedType = typeof(TestPart);
- Lazy<Type> expectedLazyType = new Lazy<Type>(() => { Assert.Fail("Part should not be loaded"); return null; });
- IDictionary<string, object> expectedMetadata = new Dictionary<string, object>();
- expectedMetadata["Key1"] = 1;
- expectedMetadata["Key2"] = "Value2";
-
- IEnumerable<ImportDefinition> expectedImports = CreateImports(expectedType);
- IEnumerable<ExportDefinition> expectedExports = CreateExports(expectedType);
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ReflectionComposablePartDefinition definition = CreateReflectionPartDefinition(
- expectedLazyType,
- true,
- () => expectedImports,
- () => expectedExports,
- expectedMetadata,
- expectedOrigin);
-
- var part = definition.CreatePart();
- Assert.IsNotNull(part);
- Assert.IsTrue(part is IDisposable);
- }
-
- [TestMethod]
- public void Constructor_NullMetadata_ShouldSetMetadataPropertyToEmpty()
- {
- ReflectionComposablePartDefinition definition = CreateEmptyDefinition(typeof(object), typeof(object).GetConstructors().First(), null, new MockOrigin());
- Assert.IsNotNull(definition.Metadata);
- Assert.AreEqual(0, definition.Metadata.Count);
- }
-
- [TestMethod]
- public void Constructor_NullOrigin_ShouldSetOriginPropertyToNull()
- {
- ReflectionComposablePartDefinition definition = CreateEmptyDefinition(typeof(object), typeof(object).GetConstructors().First(), MetadataServices.EmptyMetadata, null);
- Assert.IsNotNull(((ICompositionElement)definition).DisplayName);
- Assert.IsNull(((ICompositionElement)definition).Origin);
- }
-
- [TestMethod]
- public void ImportaAndExports_CreatorsShouldBeCalledLazilyAndOnce()
- {
- Type expectedType = typeof(TestPart);
-
- IEnumerable<ImportDefinition> expectedImports = CreateImports(expectedType);
- IEnumerable<ExportDefinition> expectedExports = CreateExports(expectedType);
-
- bool importsCreatorCalled = false;
- Func<IEnumerable<ImportDefinition>> importsCreator = () =>
- {
- Assert.IsFalse(importsCreatorCalled);
- importsCreatorCalled = true;
- return expectedImports.Cast<ImportDefinition>();
- };
-
- bool exportsCreatorCalled = false;
- Func<IEnumerable<ExportDefinition>> exportsCreator = () =>
- {
- Assert.IsFalse(exportsCreatorCalled);
- exportsCreatorCalled = true;
- return expectedExports.Cast<ExportDefinition>();
- };
-
- ReflectionComposablePartDefinition definition = CreateReflectionPartDefinition(
- expectedType.AsLazy(),
- false,
- importsCreator,
- exportsCreator,
- null,
- null);
-
- IEnumerable<ExportDefinition> exports;
- Assert.IsFalse(exportsCreatorCalled);
- exports = definition.ExportDefinitions;
- Assert.IsTrue(exportsCreatorCalled);
- exports = definition.ExportDefinitions;
-
-
- IEnumerable<ImportDefinition> imports;
- Assert.IsFalse(importsCreatorCalled);
- imports = definition.ImportDefinitions;
- Assert.IsTrue(importsCreatorCalled);
- imports = definition.ImportDefinitions;
- }
-
- [TestMethod]
- public void ICompositionElementDisplayName_ShouldReturnTypeDisplayName()
- {
- var expectations = Expectations.GetAttributedTypes();
- foreach (var e in expectations)
- {
- var definition = (ICompositionElement)CreateEmptyDefinition(e, null, null, null);
-
- Assert.AreEqual(e.GetDisplayName(), definition.DisplayName);
- }
- }
-
- [TestMethod]
- public void ToString_ShouldReturnICompositionElementDisplayName()
- {
- var expectations = Expectations.GetAttributedTypes();
- foreach (var e in expectations)
- {
- var definition = (ICompositionElement)CreateEmptyDefinition(e, null, null, null);
-
- Assert.AreEqual(definition.DisplayName, definition.ToString());
- }
- }
-
- private ReflectionComposablePartDefinition CreateEmptyDefinition(Type type, ConstructorInfo constructor, IDictionary<string, object> metadata, ICompositionElement origin)
- {
- return (ReflectionComposablePartDefinition)ReflectionModelServices.CreatePartDefinition(
- (type != null) ? type.AsLazy() : null,
- false,
- Enumerable.Empty<ImportDefinition>().AsLazy(),
- Enumerable.Empty<ExportDefinition>().AsLazy(),
- metadata.AsLazy(),
- origin);
- }
-
- private static List<ImportDefinition> CreateImports(Type type)
- {
- List<ImportDefinition> imports = new List<ImportDefinition>();
- foreach (PropertyInfo property in type.GetProperties())
- {
- imports.Add(new ReflectionMemberImportDefinition(new LazyMemberInfo(property), "Contract", (string)null, new KeyValuePair<string, Type>[] { new KeyValuePair<string, Type>("Key1", typeof(object)) }, ImportCardinality.ZeroOrOne, true, CreationPolicy.Any, new TypeOrigin(type)));
- }
-
- return imports;
- }
-
- private static List<ExportDefinition> CreateExports(Type type)
- {
- List<ExportDefinition> exports = new List<ExportDefinition>();
- foreach (PropertyInfo property in type.GetProperties())
- {
- exports.Add(ReflectionModelServices.CreateExportDefinition(new LazyMemberInfo(property), "Contract", new Lazy<IDictionary<string, object>>(() => null, false), new TypeOrigin(type)));
- }
-
- return exports;
- }
-
- public class TestPart
- {
- public int field1;
- public string field2;
- public int Property1 { get; set; }
- public string Property2 { get; set; }
- }
-
- private class TypeOrigin : ICompositionElement
- {
- private readonly Type _type;
- private readonly ICompositionElement _orgin;
-
- public TypeOrigin(Type type)
- : this(type, null)
- {
- }
-
- public TypeOrigin(Type type, ICompositionElement origin)
- {
- this._type = type;
- this._orgin = origin;
- }
-
- public string DisplayName
- {
- get
- {
- return this._type.GetDisplayName();
- }
- }
-
- public ICompositionElement Origin
- {
- get
- {
- return this._orgin;
- }
- }
- }
-
- private class MockOrigin : ICompositionElement
- {
- public string DisplayName
- {
- get { throw new NotImplementedException(); }
- }
-
- public ICompositionElement Origin
- {
- get { throw new NotImplementedException(); }
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ReflectionModel/ReflectionComposablePartTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ReflectionModel/ReflectionComposablePartTests.cs deleted file mode 100644 index 9a7c6ed6109..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ReflectionModel/ReflectionComposablePartTests.cs +++ /dev/null @@ -1,932 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition;
-using System.Linq;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.UnitTesting;
-using System.ComponentModel.Composition.UnitTesting;
-using System.ComponentModel.Composition.Factories;
-using System.Collections.Generic;
-using Microsoft.Internal;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.AttributedModel;
-using System.ComponentModel.Composition.Diagnostics;
-using System.Diagnostics;
-using System.ComponentModel.Composition.Extensibility;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- [TestClass]
- public class ReflectionComposablePartTests
- {
- [TestMethod]
- public void Constructor1_DefinitionAsDefinitionArgument_ShouldSetOriginProperty()
- {
- var expectations = Expectations.GetAttributedDefinitions();
-
- foreach (var e in expectations)
- {
- var definition = (ICompositionElement)new ReflectionComposablePart(e);
-
- Assert.AreSame(e, definition.Origin);
- }
- }
-
- [TestMethod]
- public void Constructor1_NullAsDefinitionArgument_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("definition", () =>
- {
- new ReflectionComposablePart((ReflectionComposablePartDefinition)null);
- });
- }
-
- [TestMethod]
- public void Constructor2_NullAsAttributedPartArgument_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("attributedPart", () =>
- {
- new ReflectionComposablePart(PartDefinitionFactory.CreateAttributed(), (object)null);
- });
- }
-
- [TestMethod]
- public void Constructor2_ValueTypeAsAttributedPartArgument_ShouldThrowArgument()
- {
- ExceptionAssert.ThrowsArgument<ArgumentException>("attributedPart", () =>
- {
- new ReflectionComposablePart(PartDefinitionFactory.CreateAttributed(), 42);
- });
- }
-
-
- [TestMethod]
- public void Constructor1_AttributedComposablePartDefintion_ShouldProduceValidObject()
- {
- var definition = PartDefinitionFactory.CreateAttributed(typeof(MyExport));
- var part = new ReflectionComposablePart(definition);
-
- Assert.AreEqual(definition, part.Definition);
- Assert.IsNotNull(part.Metadata);
-
- Assert.IsFalse(part is IDisposable);
- }
-
- [TestMethod]
- public void Constructor1_AttributedComposablePartDefintion_Disposable_ShouldProduceValidObject()
- {
- var definition = PartDefinitionFactory.CreateAttributed(typeof(DisposablePart));
- var part = new DisposableReflectionComposablePart(definition);
-
- Assert.AreEqual(definition, part.Definition);
- Assert.IsNotNull(part.Metadata);
-
- Assert.IsTrue(part is IDisposable);
- }
-
- [TestMethod]
- public void Constructor1_Type_ShouldProduceValidObject()
- {
- var part = new ReflectionComposablePart(PartDefinitionFactory.CreateAttributed(typeof(MyExport)));
- }
-
- [TestMethod]
- public void Constructor1_Object_ShouldProduceValidObject()
- {
- var part = new ReflectionComposablePart(PartDefinitionFactory.CreateAttributed(typeof(MyExport)), new MyExport());
- }
-
- [TestMethod]
- public void Metadata_WhenDisposed_ShouldThrowObjectDisposed()
- {
- var part = CreateDefaultDisposablePart();
- ((IDisposable)part).Dispose();
-
- ExceptionAssert.ThrowsDisposed(part, () =>
- {
- var metadata = part.Metadata;
- });
- }
-
- [TestMethod]
- public void ImportDefinitions_WhenDisposed_ShouldThrowObjectDisposed()
- {
- var part = CreateDefaultDisposablePart();
- ((IDisposable)part).Dispose();
-
- ExceptionAssert.ThrowsDisposed(part, () =>
- {
- var definitions = part.ImportDefinitions;
- });
- }
-
- [TestMethod]
- public void ExportDefinitions_WhenDisposed_ShouldThrowObjectDisposed()
- {
- var part = CreateDefaultDisposablePart();
- ((IDisposable)part).Dispose();
-
- ExceptionAssert.ThrowsDisposed(part, () =>
- {
- var definitions = part.ExportDefinitions;
- });
- }
- [TestMethod]
- public void OnComposed_WhenDisposed_ShouldThrowObjectDisposed()
- {
- var part = CreateDefaultDisposablePart();
- ((IDisposable)part).Dispose();
-
- ExceptionAssert.ThrowsDisposed(part, () =>
- {
- part.Activate();
- });
- }
-
- [TestMethod]
- public void OnComposed_MissingPostImportsOnInstance_ShouldThrowComposition()
- {
- var part = CreatePart(new MySharedPartExport());
-
- // Dev10:484204 - This used to cause a failure but after we made
- // ReflectionComposablePart internal we needed to back remove this
- // validation for post imports to make declarative composition work.
- //part.Activate().VerifyFailure(CompositionIssueId.ImportNotSetOnPart);
- part.Activate();
- }
-
- [TestMethod]
- public void OnComposed_ProperlyComposed_ShouldSucceed()
- {
- var import = new TrivialImporter();
- var export = new TrivialExporter();
-
- var part = CreatePart(import);
-
- var importDef = part.ImportDefinitions.First();
- part.SetImport(importDef, CreateSimpleExports(export));
- part.Activate();
- Assert.IsTrue(export.done, "OnImportsSatisfied should have been called");
- }
-
- [TestMethod]
- public void OnComposed_UnhandledExceptionThrowInOnImportsSatisfied_ShouldThrowComposablePart()
- {
- var part = CreatePart(typeof(ExceptionDuringINotifyImport));
- var definition = part.ImportDefinitions.First();
- part.SetImport(definition, CreateSimpleExports(21));
-
- CompositionAssert.ThrowsPart<NotImplementedException>(ErrorId.ReflectionModel_PartOnImportsSatisfiedThrewException, RetryMode.DoNotRetry, () =>
- {
- part.Activate();
- });
- }
-
- [TestMethod]
- public void SetImport_WhenDisposed_ShouldThrowObjectDisposed()
- {
- var part = CreateDefaultDisposablePart();
- var definition = part.ImportDefinitions.First();
-
- ((IDisposable)part).Dispose();
-
- ExceptionAssert.ThrowsDisposed(part, () =>
- {
- part.SetImport(definition, Enumerable.Empty<Export>());
- });
- }
-
- [TestMethod]
- public void SetImport_NullAsImportDefinitionArgument_ShouldThrowArgumentNull()
- {
- var part = CreateDefaultPart();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("definition", () =>
- {
- part.SetImport((ImportDefinition)null, Enumerable.Empty<Export>());
- });
- }
-
- [TestMethod]
- public void SetImport_NullAsExportsArgument_ShouldThrowArgumentNull()
- {
- var part = CreatePart(typeof(MySharedPartExport));
- var import = part.ImportDefinitions.First();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("exports", () =>
- {
- part.SetImport(import, (IEnumerable<Export>)null);
- });
- }
-
- [TestMethod]
- public void SetImport_ExportsArrayWithNullElementAsExportsArgument_ShouldThrowArgument()
- {
- var part = CreatePart(typeof(MySharedPartExport));
- var definition = part.ImportDefinitions.First();
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("exports", () =>
- {
- part.SetImport(definition, new Export[] { null });
- });
- }
-
- [TestMethod]
- public void SetImport_WrongDefinitionAsDefinitionArgument_ShouldThrowArgument()
- {
- var part = CreateDefaultPart();
-
- var definition = ImportDefinitionFactory.Create();
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("definition", () =>
- {
- part.SetImport(definition, Enumerable.Empty<Export>());
- });
- }
-
- [TestMethod]
- public void SetImport_SetNonRecomposableDefinitionAsDefinitionArgumentAfterOnComposed_ShouldThrowInvalidOperation()
- {
- var part = CreatePartWithNonRecomposableImport();
- var definition = part.ImportDefinitions.First();
-
- part.SetImport(definition, Enumerable.Empty<Export>());
- part.Activate();
-
- ExceptionAssert.Throws<InvalidOperationException>(() =>
- {
- part.SetImport(definition, Enumerable.Empty<Export>());
- });
- }
-
- [TestMethod]
- public void SetImport_ZeroOrOneDefinitionAsDefinitionArgumentAndTwoExportsAsExportsArgument_ShouldThrowArgument()
- {
- var part = CreatePartWithZeroOrOneImport();
- var definition = part.ImportDefinitions.First();
-
- var exports = ExportFactory.Create("Import", 2);
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("exports", () =>
- {
- part.SetImport(definition, exports);
- });
- }
-
- [TestMethod]
- public void SetImport_ExactlyOneDefinitionAsDefinitionArgumentAndTwoExportsAsExportsArgument_ShouldThrowArgument()
- {
- var part = CreatePartWithExactlyOneImport();
- var definition = part.ImportDefinitions.First();
-
- var exports = ExportFactory.Create("Import", 2);
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("exports", () =>
- {
- part.SetImport(definition, exports);
- });
- }
-
- [TestMethod]
- public void SetImport_ExactlyOneDefinitionAsDefinitionArgumentAndEmptyExportsAsExportsArgument_ShouldThrowArgument()
- {
- var part = CreatePartWithExactlyOneImport();
- var definition = part.ImportDefinitions.First();
-
- var exports = Enumerable.Empty<Export>();
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("exports", () =>
- {
- part.SetImport(definition, exports);
- });
- }
-
- [TestMethod]
- public void SetImport_WrongTypeExportGiven_ShouldThrowComposablePart()
- {
- var part = CreatePart(new MySharedPartExport());
- var import = part.ImportDefinitions.First();
-
- CompositionAssert.ThrowsPart(ErrorId.ReflectionModel_ImportNotAssignableFromExport, () =>
- {
- part.SetImport(import, CreateSimpleExports("21"));
- });
- }
-
- [TestMethod]
- public void SetImport_SetPostValueAndSetAgainOnInstance_ShouldSetProperty()
- {
- var import = new MySharedPartExport();
- var part = CreatePart(import);
- var importDef = part.ImportDefinitions.First();
-
- part.SetImport(importDef, CreateSimpleExports(21));
-
- Assert.AreNotEqual(import.Value, 21, "Value should NOT be set on live object until OnComposed");
- part.Activate();
-
- Assert.AreEqual(import.Value, 21, "Value should be set on live object now");
-
- part.SetImport(importDef, CreateSimpleExports(42));
-
- Assert.AreNotEqual(import.Value, 42, "Value should NOT be rebound on live object");
-
- part.Activate();
-
- Assert.AreEqual(import.Value, 42, "Value should be set on live object now");
- }
-
- [TestMethod]
- public void GetExportedValue_WhenDisposed_ShouldThrowObjectDisposed()
- {
- var part = CreateDefaultDisposablePart();
- var definition = part.ExportDefinitions.First();
-
- ((IDisposable)part).Dispose();
-
- ExceptionAssert.ThrowsDisposed(part, () =>
- {
- part.GetExportedValue(definition);
- });
- }
-
- [TestMethod]
- public void GetExportedValue_NullAsDefinitionArgument_ShouldThrowArgumentNull()
- {
- var part = CreateDefaultPart();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("definition", () =>
- {
- part.GetExportedValue((ExportDefinition)null);
- });
- }
-
- [TestMethod]
- public void GetExportedValue_WrongDefinitionAsDefinitionArgument_ShouldThrowArgument()
- {
- var part = CreateDefaultPart();
- var definition = ExportDefinitionFactory.Create();
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("definition", () =>
- {
- part.GetExportedValue(definition);
- });
- }
-
- [TestMethod]
- public void GetExportedValue_MissingPrerequisiteImport_ShouldThrowInvalidOperation()
- {
- var part = CreatePart(typeof(SimpleConstructorInjectedObject));
- var definition = part.ExportDefinitions.First();
-
- ExceptionAssert.Throws<InvalidOperationException>(() =>
- {
- part.GetExportedValue(definition);
- });
- }
-
- [Ignore]
- [TestMethod]
- [WorkItem(484204)]
- public void GetExportedValue_MissingPostImports_ShouldThrowComposition()
- {
- var part = CreatePart(typeof(MySharedPartExport));
-
- // Signal that the composition should be finished
- part.Activate();
-
- var definition = part.ExportDefinitions.First();
-
- // Dev10:484204 - This used to cause a failure but after we made
- // ReflectionComposablePart internal we needed to back remove this
- // validation for post imports to make declarative composition work.
- CompositionAssert.ThrowsError(ErrorId.ImportNotSetOnPart, () =>
- {
- part.GetExportedValue(definition);
- });
- }
-
- [TestMethod]
- public void GetExportedValue_NoConstructorOnDefinition_ShouldThrowComposablePart()
- {
- var part = CreatePart(typeof(ClassWithNoMarkedOrDefaultConstructor));
-
- var definition = part.ExportDefinitions.First();
-
- CompositionAssert.ThrowsPart(ErrorId.ReflectionModel_PartConstructorMissing, () =>
- {
- part.GetExportedValue(definition);
- });
- }
-
- [TestMethod]
- public void GetExportedValue_UnhandledExceptionThrowInConstructor_ShouldThrowComposablePart()
- {
- var part = CreatePart(typeof(ExportWithExceptionDuringConstruction));
-
- var definition = part.ExportDefinitions.First();
-
- CompositionAssert.ThrowsPart<NotImplementedException>(ErrorId.ReflectionModel_PartConstructorThrewException, () =>
- {
- part.GetExportedValue(definition);
- });
- }
-
- [TestMethod]
- public void GetExportedValue_GetObjectAfterSetPreImport_ShouldGetValue()
- {
- var part = CreatePart(typeof(SimpleConstructorInjectedObject));
-
- var import = part.ImportDefinitions.First();
- part.SetImport(import, CreateSimpleExports(21));
-
- part.Activate();
-
- var definition = part.ExportDefinitions.First();
- var exportObject = (SimpleConstructorInjectedObject)part.GetExportedValue(definition);
-
- Assert.AreEqual(21, exportObject.CISimpleValue);
- }
-
- [TestMethod]
- public void GetExportedValue_GetObjectAfterSetPostImport_ShouldGetValue()
- {
- var part = CreatePart(typeof(MySharedPartExport));
-
- var import = part.ImportDefinitions.First();
- part.SetImport(import, CreateSimpleExports(21));
-
- part.Activate();
-
- var definition = part.ExportDefinitions.First();
- var exportObject = (MySharedPartExport)part.GetExportedValue(definition);
-
- Assert.IsNotNull(exportObject);
- Assert.AreEqual(21, exportObject.Value);
- }
-
- [TestMethod]
- public void GetExportedValue_CallMultipleTimes_ShouldReturnSame()
- {
- var part = CreatePart(typeof(MySharedPartExport));
-
- var import = part.ImportDefinitions.First();
- part.SetImport(import, CreateSimpleExports(21));
-
- part.Activate();
-
- var definition = part.ExportDefinitions.First();
- var exportedValue1 = part.GetExportedValue(definition);
- var exportedValue2 = part.GetExportedValue(definition);
-
- Assert.AreSame(exportedValue1, exportedValue2);
- }
-
- [TestMethod]
- public void GetExportedValue_FromStaticClass_ShouldReturnExport()
- {
- var part = CreatePart(typeof(StaticExportClass));
-
- var definition = part.ExportDefinitions.First();
-
- var exportObject = (string)part.GetExportedValue(definition);
-
- Assert.AreEqual("StaticString", exportObject);
- }
-
- [TestMethod]
- public void GetExportedValue_OptionalPostNotGiven_ShouldReturnValidObject()
- {
- var part = CreatePart(typeof(ClassWithOptionalPostImport));
- part.Activate();
-
- var definition = part.ExportDefinitions.First();
- var exportObject = (ClassWithOptionalPostImport)part.GetExportedValue(definition);
-
- Assert.IsNull(exportObject.Formatter);
- }
-
- [TestMethod]
- public void GetExportedValue_OptionalPreNotGiven_ShouldReturnValidObject()
- {
- var part = CreatePart(typeof(ClassWithOptionalPreImport));
- part.Activate();
-
- var definition = part.ExportDefinitions.First();
-
- var exportedValue = (ClassWithOptionalPreImport)part.GetExportedValue(definition);
- Assert.IsNull(exportedValue.Formatter);
- }
-
- [TestMethod]
- public void ICompositionElementDisplayName_ShouldReturnTypeDisplayName()
- {
- var expectations = Expectations.GetAttributedTypes();
- foreach (var e in expectations)
- {
- var part = (ICompositionElement)CreatePart(e);
-
- Assert.AreEqual(e.GetDisplayName(), part.DisplayName);
- }
- }
-
- [TestMethod]
- public void ToString_ShouldReturnICompositionElementDisplayName()
- {
- var expectations = Expectations.GetAttributedTypes();
- foreach (var e in expectations)
- {
- var part = (ICompositionElement)CreatePart(e);
-
- Assert.AreEqual(part.DisplayName, part.ToString());
- }
- }
-
- [PartNotDiscoverable]
- public class PropertyExporter
- {
- [Export]
- public object Property { get { return new object(); } }
- }
-
- [PartNotDiscoverable]
- public class FieldExporter
- {
- [Export]
- public object Field = null;
- }
-
- [PartNotDiscoverable]
- public class MethodExporter
- {
- [Export("Method")]
- public void Method() { }
- }
-
- [PartNotDiscoverable]
- [Export]
- public class TypeExporter
- {
- }
-
- [TestMethod]
- public void GetExportedObjectAlwaysReturnsSameReference_ForProperty()
- {
- var cp = CreatePart(new PropertyExporter());
- var ed = cp.ExportDefinitions.Single();
- var eo1 = cp.GetExportedValue(ed);
- var eo2 = cp.GetExportedValue(ed);
- Assert.AreSame(eo1, eo2);
- }
-
- [TestMethod]
- public void GetExportedObjectAlwaysReturnsSameReference_ForField()
- {
- var exporter = new FieldExporter();
- var cp = CreatePart(new FieldExporter());
- var ed = cp.ExportDefinitions.Single();
-
- exporter.Field = new object();
- var eo1 = cp.GetExportedValue(ed);
- exporter.Field = new object();
- var eo2 = cp.GetExportedValue(ed);
- Assert.AreSame(eo1, eo2);
- }
-
- [TestMethod]
- public void GetExportedObjectAlwaysReturnsSameReference_ForMethod()
- {
- var cp = CreatePart(new MethodExporter());
- var ed = cp.ExportDefinitions.Single();
- var eo1 = cp.GetExportedValue(ed);
- var eo2 = cp.GetExportedValue(ed);
- Assert.AreSame(eo1, eo2);
- }
-
- [TestMethod]
- public void GetExportedObjectAlwaysReturnsSameReference_ForType()
- {
- var cp = CreatePart(new TypeExporter());
- var ed = cp.ExportDefinitions.Single();
- var eo1 = cp.GetExportedValue(ed);
- var eo2 = cp.GetExportedValue(ed);
- Assert.AreSame(eo1, eo2);
- }
-
-
- [PartNotDiscoverable]
- public class MethodWithoutContractName
- {
- [Export]
- public void MethodWithoutContractNameNotAllowed()
- {
- }
- }
-
- public interface IContract
- {
- }
-
-
- [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
- public class CustomImportAttributeInvalidTarget : ImportAttribute
- {
- public CustomImportAttributeInvalidTarget()
- : base(typeof(IContract))
- {
- }
- }
-
- [PartNotDiscoverable]
- public class ImportWithCustomImport
- {
- [CustomImport]
- IContract ImportWithCustomAttributeImport { get; set; }
- }
-
- [PartNotDiscoverable]
- public class ImportWithCustomImportInvalidTarget
- {
- [CustomImportAttributeInvalidTarget]
- void InvalidImport() { }
- }
-
- [TestMethod]
- public void ImportDefinitions_ImportWithCustomAttributeImports()
- {
- var part = CreatePart(typeof(ImportWithCustomImport));
- Assert.AreEqual(part.ImportDefinitions.Count(), 1);
- ContractBasedImportDefinition import = part.ImportDefinitions.First() as ContractBasedImportDefinition;
- Assert.IsNotNull(import);
-
- Assert.AreEqual(AttributedModelServices.GetContractName(typeof(IContract)), import.ContractName);
- Assert.AreEqual(AttributedModelServices.GetTypeIdentity(typeof(IContract)), import.RequiredTypeIdentity);
- }
-
- [TestMethod]
- public void ImportDefinitions_ImportWithCustomImportInvalidTarget_ShouldbeIgnored()
- {
- var part = CreatePart(typeof(ImportWithCustomImportInvalidTarget));
- Assert.AreEqual(part.ImportDefinitions.Count(), 0);
- }
-
- [PartNotDiscoverable]
- public class ImportManyWithCustomImportMany
- {
- [CustomImportMany]
- IContract ImportManyWithCustomAttributeImportMany { get; set; }
- }
-
- [PartNotDiscoverable]
- public class ImportManyWithCustomImportManyInvalidTarget
- {
- [CustomImportMany]
- void InvalidImportMany() { }
- }
-
- [TestMethod]
- public void ImportDefinitions_ImportManyWithCustomAttributeImportManys()
- {
- var part = CreatePart(typeof(ImportManyWithCustomImportMany));
- Assert.AreEqual(part.ImportDefinitions.Count(), 1);
- ContractBasedImportDefinition import = part.ImportDefinitions.First() as ContractBasedImportDefinition;
- Assert.IsNotNull(import);
-
- Assert.AreEqual(AttributedModelServices.GetContractName(typeof(IContract)), import.ContractName);
- Assert.AreEqual(AttributedModelServices.GetTypeIdentity(typeof(IContract)), import.RequiredTypeIdentity);
- }
-
- [TestMethod]
- public void ImportDefinitions_ImportManyWithCustomImportManyInvalidTarget_ShouldbeIgnored()
- {
- var part = CreatePart(typeof(ImportManyWithCustomImportManyInvalidTarget));
- Assert.AreEqual(part.ImportDefinitions.Count(), 0);
- }
-
- [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
- public class CustomImportingConstructorAttribute : ImportingConstructorAttribute
- {
- public CustomImportingConstructorAttribute()
- : base()
- {
- }
- }
-
- [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = true, Inherited = false)]
- public class CustomImportingConstructorAllowMultipleAttribute : ImportingConstructorAttribute
- {
- public CustomImportingConstructorAllowMultipleAttribute()
- : base()
- {
- }
- }
-
- [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
- public class CustomImportingConstructorInvalidTargetAttribute : ImportingConstructorAttribute
- {
- public CustomImportingConstructorInvalidTargetAttribute()
- : base()
- {
- }
- }
-
- [PartNotDiscoverable]
- public class ImportingConstructorWithCustomImportingConstructor
- {
- [CustomImportingConstructor]
- ImportingConstructorWithCustomImportingConstructor([Import] IContract argument) {}
- }
-
- [PartNotDiscoverable]
- public class ImportingConstructorWithCustomImportingConstructorAllowMultiple
- {
- [CustomImportingConstructorAllowMultiple]
- [CustomImportingConstructorAllowMultiple]
- ImportingConstructorWithCustomImportingConstructorAllowMultiple([Import] IContract argument) { }
- }
-
- [PartNotDiscoverable]
- public class ImportingConstructorWithCustomImportingConstructorInvalidTarget
- {
- [CustomImportingConstructorInvalidTarget]
- void InvalidImportingConstructor() { }
- }
-
- [TestMethod]
- public void ImportDefinitions_ImportingConstructorWithCustomAttributeImportingConstructors()
- {
- var part = CreatePart(typeof(ImportingConstructorWithCustomImportingConstructor));
- Assert.AreEqual(part.ImportDefinitions.Count(), 1);
- ContractBasedImportDefinition import = part.ImportDefinitions.First() as ContractBasedImportDefinition;
- Assert.IsNotNull(import);
-
- Assert.AreEqual(AttributedModelServices.GetContractName(typeof(IContract)), import.ContractName);
- Assert.AreEqual(AttributedModelServices.GetTypeIdentity(typeof(IContract)), import.RequiredTypeIdentity);
- }
-
- [TestMethod]
- public void ImportDefinitions_ImportingConstructorWithCustomAttributeImportingConstructorsWithAllowMultiple_ShouldNotThrowInvalidOperation()
- {
- var part = CreatePart(typeof(ImportingConstructorWithCustomImportingConstructorAllowMultiple));
-
- Assert.AreEqual(part.ImportDefinitions.Count(), 1);
- ContractBasedImportDefinition import = part.ImportDefinitions.First() as ContractBasedImportDefinition;
- Assert.IsNotNull(import);
-
- Assert.AreEqual(AttributedModelServices.GetContractName(typeof(IContract)), import.ContractName);
- Assert.AreEqual(AttributedModelServices.GetTypeIdentity(typeof(IContract)), import.RequiredTypeIdentity);
- }
-
- [TestMethod]
- public void ImportDefinitions_ImportingConstructorWithCustomImportingConstructorInvalidTarget_ShouldbeIgnored()
- {
- var part = CreatePart(typeof(ImportingConstructorWithCustomImportingConstructorInvalidTarget));
- Assert.AreEqual(part.ImportDefinitions.Count(), 0);
- }
-#if !SILVERLIGHT
-
- [Export]
- public class ClassWithMultipleParameterImports
- {
- [ImportingConstructor]
- public ClassWithMultipleParameterImports([Import][ImportMany]string parameter)
- {
- }
- }
-
- [Export]
- public class ClassWithMultipleFieldImports
- {
- [Import]
- [ImportMany]
- public string Field;
- }
-
- [Export]
- public class ClassWithMultiplePropertyImports
- {
- [Import]
- [ImportMany]
- public string Property
- {
- get;
- set;
- }
- }
-
- [Export]
- public class ClassWithMultipleCustomPropertyImports
- {
- [CustomImport]
- [CustomImport]
- string Property { get; set; }
- }
-
- [Export]
- public class ClassWithMultipleCustomPropertyImportManys
- {
- [CustomImportMany]
- [CustomImportMany]
- string Property { get; set; }
- }
-
- [Export]
- public class ClassWithMultipleCustomPropertyImportAndImportManys
- {
- [CustomImport]
- [CustomImportMany]
- string Property { get; set; }
- }
-
- [TestMethod]
- public void ImportDefinitions_TypeWithMemberMarkedWithMultipleImports_ShouldTraceError()
- {
- var types = new Type[] { typeof(ClassWithMultipleParameterImports),
- typeof(ClassWithMultipleFieldImports),
- typeof(ClassWithMultiplePropertyImports),
- typeof(ClassWithMultipleCustomPropertyImports),
- typeof(ClassWithMultipleCustomPropertyImportManys),
- typeof(ClassWithMultipleCustomPropertyImportAndImportManys)};
-
- foreach (Type type in types)
- {
- using (TraceContext context = new TraceContext(SourceLevels.Error))
- {
- var definition = AttributedModelServices.CreatePartDefinition(type, null, true);
- definition.ImportDefinitions.Count();
-
- Assert.IsNotNull(context.LastTraceEvent);
- Assert.AreEqual(context.LastTraceEvent.EventType, TraceEventType.Error);
- Assert.AreEqual(context.LastTraceEvent.Id, TraceId.Discovery_MemberMarkedWithMultipleImportAndImportMany);
- }
- }
- }
-#endif
-
- private Export[] CreateSimpleExports(object value)
- {
- var export = ExportFactory.Create("NoContract", () => value);
-
- return new Export[] { export };
- }
-
- private ReflectionComposablePart CreatePartWithExport()
- {
- return CreatePart(typeof(StaticExportClass));
- }
-
- private ReflectionComposablePart CreatePartWithNonRecomposableImport()
- {
- return CreatePart(typeof(SingleImportWithAllowDefault));
- }
-
- private ReflectionComposablePart CreatePartWithZeroOrOneImport()
- {
- return CreatePart(typeof(SingleImportWithAllowDefault));
- }
-
- private ReflectionComposablePart CreatePartWithExactlyOneImport()
- {
- return CreatePart(typeof(SingleImport));
- }
-
- private ReflectionComposablePart CreateDefaultPart()
- {
- return CreatePart(new object());
- }
-
- [PartNotDiscoverable]
- [Export]
- public class DisposablePart : IDisposable
- {
- [Import(AllowDefault = true)]
- public int Foo { get; set; }
-
- public void Dispose() { }
- }
-
- private ReflectionComposablePart CreateDefaultDisposablePart()
- {
- return CreatePart(typeof(DisposablePart));
- }
-
- private ReflectionComposablePart CreatePart(object instance)
- {
- if (instance is Type)
- {
- var definition = PartDefinitionFactory.CreateAttributed((Type)instance);
-
- return (ReflectionComposablePart)definition.CreatePart();
- }
- else
- {
- var definition = PartDefinitionFactory.CreateAttributed(instance.GetType());
-
- return new ReflectionComposablePart(definition, instance);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ReflectionModel/ReflectionMemberExportDefinitionTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ReflectionModel/ReflectionMemberExportDefinitionTests.cs deleted file mode 100644 index cad1f40d5cc..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ReflectionModel/ReflectionMemberExportDefinitionTests.cs +++ /dev/null @@ -1,172 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Reflection;
-using Microsoft.Internal;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- [TestClass]
- public class ReflectionMemberExportDefinitionTests
- {
- private static ReflectionMemberExportDefinition CreateReflectionExportDefinition(LazyMemberInfo exportMember, string contractname, IDictionary<string, object> metadata)
- {
- return CreateReflectionExportDefinition(exportMember, contractname, metadata, null);
- }
-
- private static ReflectionMemberExportDefinition CreateReflectionExportDefinition(LazyMemberInfo exportMember, string contractname, IDictionary<string, object> metadata, ICompositionElement origin)
- {
- return (ReflectionMemberExportDefinition)ReflectionModelServices.CreateExportDefinition(
- exportMember, contractname, CreateLazyMetadata(metadata), origin);
- }
-
- private static Lazy<IDictionary<string, object>> CreateLazyMetadata(IDictionary<string, object> metadata)
- {
- return new Lazy<IDictionary<string, object>>(() => metadata, false);
- }
-
- [TestMethod]
- public void Constructor()
- {
- MemberInfo expectedMember = this.GetType();
- LazyMemberInfo expectedExportingMemberInfo = new LazyMemberInfo(expectedMember);
-
- string expectedContractName = "Contract";
- IDictionary<string, object> expectedMetadata = new Dictionary<string, object>();
- expectedMetadata["Key1"] = 1;
- expectedMetadata["Key2"] = "Value2";
-
- ReflectionMemberExportDefinition definition = CreateReflectionExportDefinition(expectedExportingMemberInfo, expectedContractName, expectedMetadata);
-
- Assert.AreEqual(expectedExportingMemberInfo, definition.ExportingLazyMember);
- Assert.AreSame(expectedMember, definition.ExportingLazyMember.GetAccessors()[0]);
- Assert.AreEqual(MemberTypes.TypeInfo, definition.ExportingLazyMember.MemberType);
-
- Assert.AreSame(expectedContractName, definition.ContractName);
-
- Assert.IsNotNull(definition.Metadata);
- Assert.IsTrue(definition.Metadata.Keys.SequenceEqual(expectedMetadata.Keys));
- Assert.IsTrue(definition.Metadata.Values.SequenceEqual(expectedMetadata.Values));
-
- Assert.IsNull(((ICompositionElement)definition).Origin);
- }
-
- [TestMethod]
- public void Constructor_NullMetadata()
- {
- MemberInfo expectedMember = this.GetType();
- LazyMemberInfo expectedExportingMemberInfo = new LazyMemberInfo(expectedMember);
-
- string expectedContractName = "Contract";
-
- ReflectionMemberExportDefinition definition = CreateReflectionExportDefinition(expectedExportingMemberInfo, expectedContractName, null);
-
- Assert.AreEqual(expectedExportingMemberInfo, definition.ExportingLazyMember);
- Assert.AreSame(expectedMember, definition.ExportingLazyMember.GetAccessors()[0]);
- Assert.AreEqual(MemberTypes.TypeInfo, definition.ExportingLazyMember.MemberType);
-
- Assert.AreSame(expectedContractName, definition.ContractName);
-
- Assert.IsNotNull(definition.Metadata);
- Assert.AreEqual(0, definition.Metadata.Count);
-
- Assert.IsNull(((ICompositionElement)definition).Origin);
- }
-
- [TestMethod]
- public void SetDefinition_OriginIsSet()
- {
- var expectedPartDefinition = PartDefinitionFactory.CreateAttributed(typeof(object));
- var exportDefinition = CreateReflectionExportDefinition(new LazyMemberInfo(this.GetType()), "ContractName", null, expectedPartDefinition);
-
- Assert.AreSame(expectedPartDefinition, ((ICompositionElement)exportDefinition).Origin);
- }
-
- [TestMethod]
- public void SetDefinition_PartDefinitionDoesNotContainCreationPolicy_CreationPolicyShouldNotBeInMetadata()
- {
- var expectedPartDefinition = PartDefinitionFactory.CreateAttributed(typeof(object));
- var exportDefinition = CreateReflectionExportDefinition(new LazyMemberInfo(this.GetType()), "ContractName", null);
-
- Assert.IsFalse(exportDefinition.Metadata.ContainsKey(CompositionConstants.PartCreationPolicyMetadataName));
- }
-
- [TestMethod]
- public void ICompositionElementDisplayName_ValueAsContractName_ShouldIncludeContractName()
- {
- var contractNames = Expectations.GetContractNamesWithEmpty();
-
- foreach (var contractName in contractNames)
- {
- if (string.IsNullOrEmpty(contractName)) continue;
- var definition = (ICompositionElement)CreateReflectionExportDefinition(new LazyMemberInfo(typeof(string)), contractName, null);
-
- var e = CreateDisplayNameExpectation(contractName);
-
- Assert.AreEqual(e, definition.DisplayName);
- }
- }
-
- [TestMethod]
- public void ICompositionElementDisplayName_TypeAsMember_ShouldIncludeMemberDisplayName()
- {
- var types = Expectations.GetTypes();
-
- foreach (var type in types)
- {
- var definition = (ICompositionElement)CreateReflectionExportDefinition(new LazyMemberInfo(type), "Contract", null);
-
- var e = CreateDisplayNameExpectation(type);
-
- Assert.AreEqual(e, definition.DisplayName);
- }
- }
-
- [TestMethod]
- public void ICompositionElementDisplayName_ValueAsMember_ShouldIncludeMemberDisplayName()
- {
- var members = Expectations.GetMembers();
-
- foreach (var member in members)
- {
- var definition = (ICompositionElement)CreateReflectionExportDefinition(new LazyMemberInfo(member), "Contract", null);
-
- var e = CreateDisplayNameExpectation(member);
-
- Assert.AreEqual(e, definition.DisplayName);
- }
- }
-
- [TestMethod]
- public void ToString_ShouldReturnDisplayName()
- {
- var members = Expectations.GetMembers();
-
- foreach (var member in members)
- {
- var definition = (ICompositionElement)CreateReflectionExportDefinition(new LazyMemberInfo(member), "Contract", null);
-
- Assert.AreEqual(definition.DisplayName, definition.ToString());
- }
- }
-
- private static string CreateDisplayNameExpectation(string contractName)
- {
- return String.Format("System.String (ContractName=\"{0}\")", contractName);
- }
-
- private static string CreateDisplayNameExpectation(MemberInfo member)
- {
- return String.Format("{0} (ContractName=\"Contract\")", member.GetDisplayName());
- }
-
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ReflectionModel/ReflectionMemberImportDefinitionTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ReflectionModel/ReflectionMemberImportDefinitionTests.cs deleted file mode 100644 index 5705310c7d9..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ReflectionModel/ReflectionMemberImportDefinitionTests.cs +++ /dev/null @@ -1,85 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Reflection;
-using Microsoft.Internal;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- [TestClass]
- public class ReflectionMemberImportDefinitionTests
- {
- [TestMethod]
- public void Constructor()
- {
- PropertyInfo expectedMember = typeof(PublicImportsExpectingPublicExports).GetProperty("PublicImportPublicProperty");
- LazyMemberInfo expectedImportingMemberInfo = new LazyMemberInfo(expectedMember);
- IEnumerable<KeyValuePair<string, Type>> requiredMetadata = new KeyValuePair<string, Type>[] { new KeyValuePair<string, Type>("Foo", typeof(object)) };
-
- ReflectionMemberImportDefinition definition = new ReflectionMemberImportDefinition(
- expectedImportingMemberInfo, "Contract", (string)null, requiredMetadata, ImportCardinality.ZeroOrMore, true, CreationPolicy.NonShared, null);
-
- Assert.AreEqual(expectedImportingMemberInfo, definition.ImportingLazyMember);
-
- Assert.AreEqual("Contract", definition.ContractName);
- Assert.AreSame(requiredMetadata, definition.RequiredMetadata);
- Assert.AreEqual(CreationPolicy.NonShared, definition.RequiredCreationPolicy);
- Assert.AreEqual(true, definition.IsRecomposable);
- Assert.AreEqual(false, definition.IsPrerequisite);
- Assert.IsNull(((ICompositionElement)definition).Origin);
- Assert.IsNotNull(((ICompositionElement)definition).DisplayName);
- Assert.IsTrue(((ICompositionElement)definition).DisplayName.Contains(expectedMember.GetDisplayName()));
- }
-
- [TestMethod]
- public void Constructor_WithNullRequiredMetadata()
- {
- LazyMemberInfo member = CreateLazyMemberInfo();
-
- ReflectionMemberImportDefinition definition = new ReflectionMemberImportDefinition(
- member, "Contract", (string)null, null, ImportCardinality.ZeroOrMore, true, CreationPolicy.NonShared, null);
-
- Assert.IsNotNull(definition.RequiredMetadata);
- Assert.AreEqual(0, definition.RequiredMetadata.Count());
- }
-
- [TestMethod]
- public void SetDefinition_OriginIsSet()
- {
- LazyMemberInfo member = CreateLazyMemberInfo();
- var expectedPartDefinition = PartDefinitionFactory.CreateAttributed(typeof(object));
- ReflectionMemberImportDefinition definition = new ReflectionMemberImportDefinition(
- member, "Contract", (string)null, null, ImportCardinality.ZeroOrMore, true, CreationPolicy.NonShared, expectedPartDefinition);
-
- Assert.AreSame(expectedPartDefinition, ((ICompositionElement)definition).Origin);
- }
-
- [TestMethod]
- public void ToString_ShouldReturnDisplayName()
- {
- var members = Expectations.GetMembers();
-
- foreach (var member in members)
- {
- var definition = (ICompositionElement)new ReflectionMemberImportDefinition(
- new LazyMemberInfo(member), "Contract", (string)null, null, ImportCardinality.ZeroOrMore, true, CreationPolicy.NonShared, null);
-
- Assert.AreEqual(definition.DisplayName, definition.ToString());
- }
- }
-
- private static LazyMemberInfo CreateLazyMemberInfo()
- {
- PropertyInfo expectedMember = typeof(PublicImportsExpectingPublicExports).GetProperty("PublicImportPublicProperty");
- return new LazyMemberInfo(expectedMember);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ReflectionModel/ReflectionModelServicesTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ReflectionModel/ReflectionModelServicesTests.cs deleted file mode 100644 index 4cf4d95b94e..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ReflectionModel/ReflectionModelServicesTests.cs +++ /dev/null @@ -1,1098 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Reflection;
-using Microsoft.Internal;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.Collections.Generic;
-using System.Linq;
-using System.UnitTesting;
-using System.Threading;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- [TestClass]
- public class ReflectionModelServicesTests
- {
- [TestMethod]
- public void CreatePartDefinition()
- {
- Type expectedType = typeof(TestPart);
- Lazy<Type> expectedLazyType = expectedType.AsLazy();
- IDictionary<string, object> expectedMetadata = new Dictionary<string, object>();
- expectedMetadata["Key1"] = 1;
- expectedMetadata["Key2"] = "Value2";
-
- IEnumerable<ImportDefinition> expectedImports = CreateImports(expectedType);
- IEnumerable<ExportDefinition> expectedExports = CreateExports(expectedType);
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ComposablePartDefinition partDefinition = ReflectionModelServices.CreatePartDefinition(expectedLazyType, false,
- new Lazy<IEnumerable<ImportDefinition>>(() => expectedImports),
- new Lazy<IEnumerable<ExportDefinition>>(() => expectedExports),
- expectedMetadata.AsLazy(), expectedOrigin);
- Assert.IsNotNull(partDefinition);
-
- ReflectionComposablePartDefinition definition = partDefinition as ReflectionComposablePartDefinition;
- Assert.IsNotNull(definition);
-
- Assert.AreSame(expectedType, definition.GetPartType());
- Assert.IsTrue(definition.Metadata.Keys.SequenceEqual(expectedMetadata.Keys));
- Assert.IsTrue(definition.Metadata.Values.SequenceEqual(expectedMetadata.Values));
- Assert.IsTrue(definition.ExportDefinitions.SequenceEqual(expectedExports.Cast<ExportDefinition>()));
- Assert.IsTrue(definition.ImportDefinitions.SequenceEqual(expectedImports.Cast<ImportDefinition>()));
- Assert.AreSame(expectedOrigin, ((ICompositionElement)definition).Origin);
- Assert.IsNotNull(((ICompositionElement)definition).DisplayName);
- Assert.IsFalse(definition.IsDisposalRequired);
- }
-
- [TestMethod]
- public void CreatePartDefinition_Disposable()
- {
- Type expectedType = typeof(TestPart);
- Lazy<Type> expectedLazyType = expectedType.AsLazy();
- IDictionary<string, object> expectedMetadata = new Dictionary<string, object>();
- expectedMetadata["Key1"] = 1;
- expectedMetadata["Key2"] = "Value2";
-
- IEnumerable<ImportDefinition> expectedImports = CreateImports(expectedType);
- IEnumerable<ExportDefinition> expectedExports = CreateExports(expectedType);
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ComposablePartDefinition partDefinition = ReflectionModelServices.CreatePartDefinition(expectedLazyType, true,
- new Lazy<IEnumerable<ImportDefinition>>(() => expectedImports),
- new Lazy<IEnumerable<ExportDefinition>>(() => expectedExports),
- expectedMetadata.AsLazy(), expectedOrigin);
- Assert.IsNotNull(partDefinition);
-
- ReflectionComposablePartDefinition definition = partDefinition as ReflectionComposablePartDefinition;
- Assert.IsNotNull(definition);
-
- Assert.AreSame(expectedType, definition.GetPartType());
- Assert.IsTrue(definition.Metadata.Keys.SequenceEqual(expectedMetadata.Keys));
- Assert.IsTrue(definition.Metadata.Values.SequenceEqual(expectedMetadata.Values));
- Assert.IsTrue(definition.ExportDefinitions.SequenceEqual(expectedExports.Cast<ExportDefinition>()));
- Assert.IsTrue(definition.ImportDefinitions.SequenceEqual(expectedImports.Cast<ImportDefinition>()));
- Assert.AreSame(expectedOrigin, ((ICompositionElement)definition).Origin);
- Assert.IsNotNull(((ICompositionElement)definition).DisplayName);
- Assert.IsTrue(definition.IsDisposalRequired);
- }
-
- [TestMethod]
- public void CreatePartDefinition_NullMetadataAllowed()
- {
- Type expectedType = typeof(TestPart);
- Lazy<Type> expectedLazyType = expectedType.AsLazy();
-
- IEnumerable<ImportDefinition> expectedImports = CreateImports(expectedType);
- IEnumerable<ExportDefinition> expectedExports = CreateExports(expectedType);
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ComposablePartDefinition partDefinition = ReflectionModelServices.CreatePartDefinition(expectedLazyType, false,
- new Lazy<IEnumerable<ImportDefinition>>(() => expectedImports),
- new Lazy<IEnumerable<ExportDefinition>>(() => expectedExports),
- null, expectedOrigin);
- Assert.IsNotNull(partDefinition);
-
- ReflectionComposablePartDefinition definition = partDefinition as ReflectionComposablePartDefinition;
- Assert.IsNotNull(definition);
- Assert.IsNotNull(definition.Metadata);
- Assert.AreEqual(0, definition.Metadata.Count);
- }
-
- [TestMethod]
- public void CreatePartDefinition_EvaluatedNullMetadataAllowed()
- {
- Type expectedType = typeof(TestPart);
- Lazy<Type> expectedLazyType = expectedType.AsLazy();
- IDictionary<string, object> expectedMetadata = null;
-
- IEnumerable<ImportDefinition> expectedImports = CreateImports(expectedType);
- IEnumerable<ExportDefinition> expectedExports = CreateExports(expectedType);
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ComposablePartDefinition partDefinition = ReflectionModelServices.CreatePartDefinition(expectedLazyType, false,
- new Lazy<IEnumerable<ImportDefinition>>(() => expectedImports),
- new Lazy<IEnumerable<ExportDefinition>>(() => expectedExports),
- expectedMetadata.AsLazy(), expectedOrigin);
- Assert.IsNotNull(partDefinition);
-
- ReflectionComposablePartDefinition definition = partDefinition as ReflectionComposablePartDefinition;
- Assert.IsNotNull(definition);
- Assert.IsNotNull(definition.Metadata);
- Assert.AreEqual(0, definition.Metadata.Count);
- }
-
-
- [TestMethod]
- public void CreatePartDefinition_NullExportsAllowed()
- {
- Type expectedType = typeof(TestPart);
- Lazy<Type> expectedLazyType = expectedType.AsLazy();
-
- IEnumerable<ImportDefinition> expectedImports = CreateImports(expectedType);
- IEnumerable<ExportDefinition> expectedExports = CreateExports(expectedType);
- IDictionary<string, object> expectedMetadata = new Dictionary<string, object>();
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ComposablePartDefinition partDefinition = ReflectionModelServices.CreatePartDefinition(expectedLazyType, false,
- new Lazy<IEnumerable<ImportDefinition>>(() => expectedImports),
- null,
- expectedMetadata.AsLazy(), expectedOrigin);
- Assert.IsNotNull(partDefinition);
-
- ReflectionComposablePartDefinition definition = partDefinition as ReflectionComposablePartDefinition;
- Assert.IsNotNull(definition);
- Assert.IsNotNull(definition.ExportDefinitions);
- Assert.AreEqual(0, definition.ExportDefinitions.Count());
- }
-
- [TestMethod]
- public void CreatePartDefinition_EvaluatedNullExportsAllowed()
- {
- Type expectedType = typeof(TestPart);
- Lazy<Type> expectedLazyType = expectedType.AsLazy();
-
- IEnumerable<ImportDefinition> expectedImports = CreateImports(expectedType);
- IEnumerable<ExportDefinition> expectedExports = CreateExports(expectedType);
- IDictionary<string, object> expectedMetadata = new Dictionary<string, object>();
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ComposablePartDefinition partDefinition = ReflectionModelServices.CreatePartDefinition(expectedLazyType, false,
- new Lazy<IEnumerable<ImportDefinition>>(() => expectedImports),
- new Lazy<IEnumerable<ExportDefinition>>(() => null),
- expectedMetadata.AsLazy(), expectedOrigin);
- Assert.IsNotNull(partDefinition);
-
- ReflectionComposablePartDefinition definition = partDefinition as ReflectionComposablePartDefinition;
- Assert.IsNotNull(definition);
- Assert.IsNotNull(definition.ExportDefinitions);
- Assert.AreEqual(0, definition.ExportDefinitions.Count());
- }
-
- [TestMethod]
- public void CreatePartDefinition_ExportsMustBeOfRightType()
- {
- Type expectedType = typeof(TestPart);
- Lazy<Type> expectedLazyType = expectedType.AsLazy();
-
- IEnumerable<ImportDefinition> expectedImports = CreateImports(expectedType);
- IEnumerable<ExportDefinition> expectedExports = CreateExports(expectedType);
- IDictionary<string, object> expectedMetadata = new Dictionary<string, object>();
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ComposablePartDefinition partDefinition = ReflectionModelServices.CreatePartDefinition(expectedLazyType, false,
- new Lazy<IEnumerable<ImportDefinition>>(() => expectedImports),
- new Lazy<IEnumerable<ExportDefinition>>(() => CreateInvalidExports()),
- expectedMetadata.AsLazy(), expectedOrigin);
- Assert.IsNotNull(partDefinition);
-
- ReflectionComposablePartDefinition definition = partDefinition as ReflectionComposablePartDefinition;
- Assert.IsNotNull(definition);
-
- ExceptionAssert.Throws<InvalidOperationException>(() =>
- {
- definition.ExportDefinitions.Count();
- });
- }
-
- [TestMethod]
- public void CreatePartDefinition_NullImportsAllowed()
- {
- Type expectedType = typeof(TestPart);
- Lazy<Type> expectedLazyType = expectedType.AsLazy();
-
- IEnumerable<ImportDefinition> expectedImports = CreateImports(expectedType);
- IEnumerable<ExportDefinition> expectedExports = CreateExports(expectedType);
- IDictionary<string, object> expectedMetadata = new Dictionary<string, object>();
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ComposablePartDefinition partDefinition = ReflectionModelServices.CreatePartDefinition(expectedLazyType, false,
- null,
- new Lazy<IEnumerable<ExportDefinition>>(() => expectedExports),
- expectedMetadata.AsLazy(), expectedOrigin);
- Assert.IsNotNull(partDefinition);
-
- ReflectionComposablePartDefinition definition = partDefinition as ReflectionComposablePartDefinition;
- Assert.IsNotNull(definition);
- Assert.IsNotNull(definition.ImportDefinitions);
- Assert.AreEqual(0, definition.ImportDefinitions.Count());
- }
-
- [TestMethod]
- public void CreatePartDefinition_EvaluatedNullImportsAllowed()
- {
- Type expectedType = typeof(TestPart);
- Lazy<Type> expectedLazyType = expectedType.AsLazy();
-
- IEnumerable<ImportDefinition> expectedImports = CreateImports(expectedType);
- IEnumerable<ExportDefinition> expectedExports = CreateExports(expectedType);
- IDictionary<string, object> expectedMetadata = new Dictionary<string, object>();
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ComposablePartDefinition partDefinition = ReflectionModelServices.CreatePartDefinition(expectedLazyType, false,
- new Lazy<IEnumerable<ImportDefinition>>(() => null),
- new Lazy<IEnumerable<ExportDefinition>>(() => expectedExports),
- expectedMetadata.AsLazy(), expectedOrigin);
- Assert.IsNotNull(partDefinition);
-
- ReflectionComposablePartDefinition definition = partDefinition as ReflectionComposablePartDefinition;
- Assert.IsNotNull(definition);
- Assert.IsNotNull(definition.ImportDefinitions);
- Assert.AreEqual(0, definition.ImportDefinitions.Count());
- }
-
- [TestMethod]
- public void CreatePartDefinition_ImportsMustBeOfRightType()
- {
- Type expectedType = typeof(TestPart);
- Lazy<Type> expectedLazyType = expectedType.AsLazy();
-
- IEnumerable<ImportDefinition> expectedImports = CreateImports(expectedType);
- IEnumerable<ExportDefinition> expectedExports = CreateExports(expectedType);
- IDictionary<string, object> expectedMetadata = new Dictionary<string, object>();
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ComposablePartDefinition partDefinition = ReflectionModelServices.CreatePartDefinition(expectedLazyType, false,
- new Lazy<IEnumerable<ImportDefinition>>(() => CreateInvalidImports()),
- new Lazy<IEnumerable<ExportDefinition>>(() => expectedExports),
- expectedMetadata.AsLazy(), expectedOrigin);
- Assert.IsNotNull(partDefinition);
-
- ReflectionComposablePartDefinition definition = partDefinition as ReflectionComposablePartDefinition;
- Assert.IsNotNull(definition);
- ExceptionAssert.Throws<InvalidOperationException>(() =>
- {
- definition.ImportDefinitions.Count();
- });
-
- }
-
- [TestMethod]
- public void CreatePartDefinition_NullTypeNotAllowed()
- {
- Type expectedType = typeof(TestPart);
- Lazy<Type> expectedLazyType = expectedType.AsLazy();
- IDictionary<string, object> expectedMetadata = new Dictionary<string, object>();
- expectedMetadata["Key1"] = 1;
- expectedMetadata["Key2"] = "Value2";
-
- IEnumerable<ImportDefinition> expectedImports = CreateImports(expectedType);
- IEnumerable<ExportDefinition> expectedExports = CreateExports(expectedType);
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("partType", () =>
- {
- ComposablePartDefinition partDefinition = ReflectionModelServices.CreatePartDefinition(null, false,
- new Lazy<IEnumerable<ImportDefinition>>(() => expectedImports),
- new Lazy<IEnumerable<ExportDefinition>>(() => expectedExports),
- expectedMetadata.AsLazy(), expectedOrigin);
- });
- }
-
-
- [TestMethod]
- public void CreatePartDefinition_NullEvaluatedTypeNotAllowed()
- {
- Type expectedType = typeof(TestPart);
- Lazy<Type> expectedLazyType = expectedType.AsLazy();
-
- IDictionary<string, object> expectedMetadata = new Dictionary<string, object>();
- expectedMetadata["Key1"] = 1;
- expectedMetadata["Key2"] = "Value2";
-
- IEnumerable<ImportDefinition> expectedImports = CreateImports(expectedType);
- IEnumerable<ExportDefinition> expectedExports = CreateExports(expectedType);
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ComposablePartDefinition partDefinition = ReflectionModelServices.CreatePartDefinition(new Lazy<Type>(() => null), false,
- new Lazy<IEnumerable<ImportDefinition>>(() => expectedImports),
- new Lazy<IEnumerable<ExportDefinition>>(() => expectedExports),
- expectedMetadata.AsLazy(), expectedOrigin);
-
- ReflectionComposablePartDefinition definition = partDefinition as ReflectionComposablePartDefinition;
- Assert.IsNotNull(definition);
-
- ExceptionAssert.Throws<InvalidOperationException>(() =>
- {
- definition.GetPartType();
- });
- }
-
- [TestMethod]
- public void GetPartType()
- {
- Type expectedType = typeof(TestPart);
- Lazy<Type> expectedLazyType = expectedType.AsLazy();
- IDictionary<string, object> expectedMetadata = new Dictionary<string, object>();
- expectedMetadata["Key1"] = 1;
- expectedMetadata["Key2"] = "Value2";
-
- IEnumerable<ImportDefinition> expectedImports = CreateImports(expectedType);
- IEnumerable<ExportDefinition> expectedExports = CreateExports(expectedType);
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ComposablePartDefinition partDefinition = ReflectionModelServices.CreatePartDefinition(expectedLazyType, false,
- new Lazy<IEnumerable<ImportDefinition>>(() => expectedImports),
- new Lazy<IEnumerable<ExportDefinition>>(() => expectedExports),
- expectedMetadata.AsLazy(), expectedOrigin);
- Assert.IsNotNull(partDefinition);
-
- Lazy<Type> lazyPartType = ReflectionModelServices.GetPartType(partDefinition);
- Assert.AreEqual(expectedLazyType, lazyPartType);
- }
-
- [TestMethod]
- public void GetPartType_NullAsPart_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("partDefinition", () =>
- {
- ReflectionModelServices.GetPartType(null);
- });
- }
-
- [TestMethod]
- public void GetPartType_InvalidPart_ShouldThrowArgument()
- {
- ExceptionAssert.ThrowsArgument<ArgumentException>("partDefinition", () =>
- {
- ReflectionModelServices.GetPartType(new InvalidPartDefinition());
- });
- }
-
-
- [TestMethod]
- public void IsDisposalRequired_ForNonDisposable()
- {
- Type expectedType = typeof(TestPart);
- Lazy<Type> expectedLazyType = expectedType.AsLazy();
- IDictionary<string, object> expectedMetadata = new Dictionary<string, object>();
- expectedMetadata["Key1"] = 1;
- expectedMetadata["Key2"] = "Value2";
-
- IEnumerable<ImportDefinition> expectedImports = CreateImports(expectedType);
- IEnumerable<ExportDefinition> expectedExports = CreateExports(expectedType);
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ComposablePartDefinition partDefinition = ReflectionModelServices.CreatePartDefinition(expectedLazyType, false,
- new Lazy<IEnumerable<ImportDefinition>>(() => expectedImports),
- new Lazy<IEnumerable<ExportDefinition>>(() => expectedExports),
- expectedMetadata.AsLazy(), expectedOrigin);
- Assert.IsNotNull(partDefinition);
-
- bool isDisposalRequired = ReflectionModelServices.IsDisposalRequired(partDefinition);
- Assert.IsFalse(isDisposalRequired);
- }
-
- [TestMethod]
- public void IsDisposalRequired_ForDisposable()
- {
- Type expectedType = typeof(TestPart);
- Lazy<Type> expectedLazyType = expectedType.AsLazy();
- IDictionary<string, object> expectedMetadata = new Dictionary<string, object>();
- expectedMetadata["Key1"] = 1;
- expectedMetadata["Key2"] = "Value2";
-
- IEnumerable<ImportDefinition> expectedImports = CreateImports(expectedType);
- IEnumerable<ExportDefinition> expectedExports = CreateExports(expectedType);
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ComposablePartDefinition partDefinition = ReflectionModelServices.CreatePartDefinition(expectedLazyType, true,
- new Lazy<IEnumerable<ImportDefinition>>(() => expectedImports),
- new Lazy<IEnumerable<ExportDefinition>>(() => expectedExports),
- expectedMetadata.AsLazy(), expectedOrigin);
- Assert.IsNotNull(partDefinition);
-
- bool isDisposalRequired = ReflectionModelServices.IsDisposalRequired(partDefinition);
- Assert.IsTrue(isDisposalRequired);
- }
-
-
- [TestMethod]
- public void IsDisposalRequired_NullAsPart_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("partDefinition", () =>
- {
- ReflectionModelServices.IsDisposalRequired(null);
- });
- }
-
- [TestMethod]
- public void IsDisposalRequired_InvalidPart_ShouldThrowArgument()
- {
- ExceptionAssert.ThrowsArgument<ArgumentException>("partDefinition", () =>
- {
- ReflectionModelServices.IsDisposalRequired(new InvalidPartDefinition());
- });
- }
-
- [TestMethod]
- public void CreateExportDefinition()
- {
- PropertyInfo property = typeof(TestPart).GetProperties().First();
- LazyMemberInfo expectedLazyMember = new LazyMemberInfo(property);
-
- IDictionary<string, object> expectedMetadata = new Dictionary<string, object>();
- expectedMetadata["Key1"] = 1;
- expectedMetadata["Key2"] = "Value2";
-
- string expectedContractName = "Foo";
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ExportDefinition exportDefinition = ReflectionModelServices.CreateExportDefinition(expectedLazyMember, expectedContractName, expectedMetadata.AsLazy(), expectedOrigin);
- Assert.IsNotNull(exportDefinition);
- ReflectionMemberExportDefinition definition = exportDefinition as ReflectionMemberExportDefinition;
- Assert.IsNotNull(definition);
-
- Assert.AreEqual(expectedContractName, definition.ContractName);
- Assert.IsTrue(definition.Metadata.Keys.SequenceEqual(expectedMetadata.Keys));
- Assert.IsTrue(definition.Metadata.Values.SequenceEqual(expectedMetadata.Values));
- Assert.AreEqual(expectedOrigin, ((ICompositionElement)definition).Origin);
- Assert.AreEqual(expectedLazyMember, definition.ExportingLazyMember);
- }
-
- [TestMethod]
- public void CreateExportDefinition_NullAsContractName_ThrowsNullArgument()
- {
- PropertyInfo property = typeof(TestPart).GetProperties().First();
- LazyMemberInfo expectedLazyMember = new LazyMemberInfo(property);
-
- IDictionary<string, object> expectedMetadata = new Dictionary<string, object>();
- expectedMetadata["Key1"] = 1;
- expectedMetadata["Key2"] = "Value2";
-
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("contractName", () =>
- {
- ReflectionModelServices.CreateExportDefinition(expectedLazyMember, null, expectedMetadata.AsLazy(), expectedOrigin);
- });
- }
-
- public void CreateExportDefinition_NullAsMetadata_Allowed()
- {
- PropertyInfo property = typeof(TestPart).GetProperties().First();
- LazyMemberInfo expectedLazyMember = new LazyMemberInfo(property);
-
- IDictionary<string, object> expectedMetadata = new Dictionary<string, object>();
- expectedMetadata["Key1"] = 1;
- expectedMetadata["Key2"] = "Value2";
-
- string expectedContractName = "Foo";
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ExportDefinition definition = ReflectionModelServices.CreateExportDefinition(expectedLazyMember, expectedContractName, expectedMetadata.AsLazy(), expectedOrigin);
- Assert.IsNotNull(definition.Metadata);
- Assert.AreEqual(0, definition.Metadata.Count);
- }
-
- [TestMethod]
- public void CreateExportDefinition_InvalidLazymemberInfo_ShouldThrowArtument()
- {
- EventInfo _event = typeof(TestPart).GetEvents().First();
- LazyMemberInfo expectedLazyMember = new LazyMemberInfo(_event);
-
- IDictionary<string, object> expectedMetadata = new Dictionary<string, object>();
- expectedMetadata["Key1"] = 1;
- expectedMetadata["Key2"] = "Value2";
-
- string expectedContractName = "Foo";
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("exportingMember", () =>
- {
- ReflectionModelServices.CreateExportDefinition(expectedLazyMember, expectedContractName, expectedMetadata.AsLazy(), expectedOrigin);
- });
- }
-
- [TestMethod]
- public void GetExportingMember()
- {
- PropertyInfo property = typeof(TestPart).GetProperties().First();
- LazyMemberInfo expectedLazyMember = new LazyMemberInfo(property);
-
- IDictionary<string, object> expectedMetadata = new Dictionary<string, object>();
- expectedMetadata["Key1"] = 1;
- expectedMetadata["Key2"] = "Value2";
-
- string expectedContractName = "Foo";
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ExportDefinition exportDefinition = ReflectionModelServices.CreateExportDefinition(expectedLazyMember, expectedContractName, expectedMetadata.AsLazy(), expectedOrigin);
- Assert.IsNotNull(exportDefinition);
-
- LazyMemberInfo lazyMember = ReflectionModelServices.GetExportingMember(exportDefinition);
- Assert.AreEqual(expectedLazyMember, lazyMember);
- }
-
- [TestMethod]
- public void GetExportingMember_NullAsExportDefinition_ShouldThrowArhumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("exportDefinition", () =>
- {
- ReflectionModelServices.GetExportingMember(null);
- });
- }
-
- [TestMethod]
- public void GetExportingMember_InvalidExportDefinition_ShouldThrowArhumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentException>("exportDefinition", () =>
- {
- ReflectionModelServices.GetExportingMember(new ExportDefinition("Foo", null));
- });
- }
-
- [TestMethod]
- public void CreateImportDefinition_Member()
- {
- PropertyInfo property = typeof(TestPart).GetProperties().First();
- LazyMemberInfo expectedLazyMember = new LazyMemberInfo(property);
-
- string expectedContractName = "Foo";
- string expectedRequiredTypeIdentity = "Bar";
- KeyValuePair<string, Type>[] expectedRequiredMetadata = new KeyValuePair<string, Type>[] { new KeyValuePair<string, Type>("Key1", typeof(string)), new KeyValuePair<string, Type>("Key2", typeof(int)) };
- ImportCardinality expectedCardinality = ImportCardinality.ExactlyOne;
- CreationPolicy expectedCreationPolicy = CreationPolicy.NonShared;
- bool expectedRecomposable = true;
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ImportDefinition importDefinition = ReflectionModelServices.CreateImportDefinition(
- expectedLazyMember,
- expectedContractName,
- expectedRequiredTypeIdentity,
- expectedRequiredMetadata,
- expectedCardinality,
- expectedRecomposable,
- expectedCreationPolicy,
- expectedOrigin);
- Assert.IsNotNull(importDefinition);
-
- ReflectionMemberImportDefinition definition = importDefinition as ReflectionMemberImportDefinition;
- Assert.IsNotNull(definition);
-
- Assert.AreEqual(expectedLazyMember, definition.ImportingLazyMember);
- Assert.AreEqual(definition.ContractName, expectedContractName);
- Assert.AreEqual(definition.RequiredTypeIdentity, expectedRequiredTypeIdentity);
- Assert.IsTrue(definition.RequiredMetadata.SequenceEqual(expectedRequiredMetadata));
- Assert.AreEqual(definition.Cardinality, expectedCardinality);
- Assert.AreEqual(definition.RequiredCreationPolicy, expectedCreationPolicy);
- Assert.AreEqual(definition.IsRecomposable, expectedRecomposable);
- Assert.AreSame(expectedOrigin, ((ICompositionElement)definition).Origin);
- Assert.IsFalse(definition.IsPrerequisite);
- }
-
- [TestMethod]
- public void CreateImportDefinition_Member_InvalidMember_ShouldThrowArgument()
- {
- MethodInfo method = typeof(TestPart).GetMethods().First();
- LazyMemberInfo expectedLazyMember = new LazyMemberInfo(method);
-
- string expectedContractName = "Foo";
- string expectedRequiredTypeIdentity = "Bar";
- KeyValuePair<string, Type>[] expectedRequiredMetadata = new KeyValuePair<string, Type>[] { new KeyValuePair<string, Type>("Key1", typeof(string)), new KeyValuePair<string, Type>("Key2", typeof(int)) };
- ImportCardinality expectedCardinality = ImportCardinality.ExactlyOne;
- CreationPolicy expectedCreationPolicy = CreationPolicy.NonShared;
- bool expectedRecomposable = true;
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ExceptionAssert.ThrowsArgument<ArgumentException>("importingMember", () =>
- {
- ReflectionModelServices.CreateImportDefinition(
- expectedLazyMember,
- expectedContractName,
- expectedRequiredTypeIdentity,
- expectedRequiredMetadata,
- expectedCardinality,
- expectedRecomposable,
- expectedCreationPolicy,
- expectedOrigin);
- });
- }
-
- [TestMethod]
- public void GetImporingMember()
- {
- PropertyInfo property = typeof(TestPart).GetProperties().First();
- LazyMemberInfo expectedLazyMember = new LazyMemberInfo(property);
-
- string expectedContractName = "Foo";
- string expectedRequiredTypeIdentity = "Bar";
- KeyValuePair<string, Type>[] expectedRequiredMetadata = new KeyValuePair<string, Type>[] { new KeyValuePair<string, Type>("Key1", typeof(string)), new KeyValuePair<string, Type>("Key2", typeof(int)) };
- ImportCardinality expectedCardinality = ImportCardinality.ExactlyOne;
- CreationPolicy expectedCreationPolicy = CreationPolicy.NonShared;
- bool expectedRecomposable = true;
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ImportDefinition importDefinition = ReflectionModelServices.CreateImportDefinition(
- expectedLazyMember,
- expectedContractName,
- expectedRequiredTypeIdentity,
- expectedRequiredMetadata,
- expectedCardinality,
- expectedRecomposable,
- expectedCreationPolicy,
- expectedOrigin);
- Assert.IsNotNull(importDefinition);
-
- LazyMemberInfo lazyMember = ReflectionModelServices.GetImportingMember(importDefinition);
- Assert.AreEqual(expectedLazyMember, lazyMember);
- }
-
- [TestMethod]
- public void GetImporingMember_NullAsImport_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("importDefinition", () =>
- {
- ReflectionModelServices.GetImportingMember(null);
- });
- }
-
- [TestMethod]
- public void GetImporingMember_InvalidImport_ShouldThrowArgument()
- {
- ExceptionAssert.ThrowsArgument<ArgumentException>("importDefinition", () =>
- {
- ReflectionModelServices.GetImportingMember(new ContractBasedImportDefinition("Foo", "Foo", null, ImportCardinality.ZeroOrMore, false, false, CreationPolicy.Any));
- });
- }
-
-
-
- [TestMethod]
- public void CreateImportDefinition_Parameter()
- {
-
- ParameterInfo parameter = typeof(TestPart).GetConstructor(new Type[] { typeof(int) }).GetParameters()[0];
- Lazy<ParameterInfo> expectedLazyParameter = parameter.AsLazy();
-
- string expectedContractName = "Foo";
- string expectedRequiredTypeIdentity = "Bar";
- KeyValuePair<string, Type>[] expectedRequiredMetadata = new KeyValuePair<string, Type>[] { new KeyValuePair<string, Type>("Key1", typeof(string)), new KeyValuePair<string, Type>("Key2", typeof(int)) };
- ImportCardinality expectedCardinality = ImportCardinality.ExactlyOne;
- CreationPolicy expectedCreationPolicy = CreationPolicy.NonShared;
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ImportDefinition importDefinition = ReflectionModelServices.CreateImportDefinition(
- expectedLazyParameter,
- expectedContractName,
- expectedRequiredTypeIdentity,
- expectedRequiredMetadata,
- expectedCardinality,
- expectedCreationPolicy,
- expectedOrigin);
- Assert.IsNotNull(importDefinition);
-
- ReflectionParameterImportDefinition definition = importDefinition as ReflectionParameterImportDefinition;
- Assert.IsNotNull(definition);
-
- Assert.AreEqual(expectedLazyParameter, definition.ImportingLazyParameter);
- Assert.AreEqual(definition.ContractName, expectedContractName);
- Assert.AreEqual(definition.RequiredTypeIdentity, expectedRequiredTypeIdentity);
- Assert.IsTrue(definition.RequiredMetadata.SequenceEqual(expectedRequiredMetadata));
- Assert.AreEqual(definition.Cardinality, expectedCardinality);
- Assert.AreEqual(definition.RequiredCreationPolicy, expectedCreationPolicy);
- Assert.IsFalse(definition.IsRecomposable);
- Assert.AreSame(expectedOrigin, ((ICompositionElement)definition).Origin);
- Assert.IsTrue(definition.IsPrerequisite);
- }
-
- [TestMethod]
- public void CreateImportDefinition_Parameter_NullAsParamater_ShouldThrowArgumentNull()
- {
- ParameterInfo parameter = typeof(TestPart).GetConstructor(new Type[] { typeof(int) }).GetParameters()[0];
- Lazy<ParameterInfo> expectedLazyParameter = parameter.AsLazy();
-
- string expectedContractName = "Foo";
- string expectedRequiredTypeIdentity = "Bar";
- KeyValuePair<string, Type>[] expectedRequiredMetadata = new KeyValuePair<string, Type>[] { new KeyValuePair<string, Type>("Key1", typeof(string)), new KeyValuePair<string, Type>("Key2", typeof(int)) };
- ImportCardinality expectedCardinality = ImportCardinality.ExactlyOne;
- CreationPolicy expectedCreationPolicy = CreationPolicy.NonShared;
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("parameter", () =>
- {
- ReflectionModelServices.CreateImportDefinition(
- null,
- expectedContractName,
- expectedRequiredTypeIdentity,
- expectedRequiredMetadata,
- expectedCardinality,
- expectedCreationPolicy,
- expectedOrigin);
- });
- }
-
- [TestMethod]
- public void GetImportingParameter()
- {
- ParameterInfo parameter = typeof(TestPart).GetConstructor(new Type[] { typeof(int) }).GetParameters()[0];
- Lazy<ParameterInfo> expectedLazyParameter = parameter.AsLazy();
-
- string expectedContractName = "Foo";
- string expectedRequiredTypeIdentity = "Bar";
- KeyValuePair<string, Type>[] expectedRequiredMetadata = new KeyValuePair<string, Type>[] { new KeyValuePair<string, Type>("Key1", typeof(string)), new KeyValuePair<string, Type>("Key2", typeof(int)) };
- ImportCardinality expectedCardinality = ImportCardinality.ExactlyOne;
- CreationPolicy expectedCreationPolicy = CreationPolicy.NonShared;
-
- ICompositionElement expectedOrigin = new MockOrigin();
- ImportDefinition importDefinition = ReflectionModelServices.CreateImportDefinition(
- expectedLazyParameter,
- expectedContractName,
- expectedRequiredTypeIdentity,
- expectedRequiredMetadata,
- expectedCardinality,
- expectedCreationPolicy,
- expectedOrigin);
- Assert.IsNotNull(importDefinition);
-
- Lazy<ParameterInfo> lazyParameter = ReflectionModelServices.GetImportingParameter(importDefinition);
- Assert.AreEqual(expectedLazyParameter, lazyParameter);
- }
-
- [TestMethod]
- public void GetImportingParameter_NullAsImport_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("importDefinition", () =>
- {
- ReflectionModelServices.GetImportingParameter(null);
- });
- }
-
- [TestMethod]
- public void GetImportingParameter_InvalidImport_ShouldThrowArgument()
- {
- ExceptionAssert.ThrowsArgument<ArgumentException>("importDefinition", () =>
- {
- ReflectionModelServices.GetImportingParameter(new ContractBasedImportDefinition("Foo", "Foo", null, ImportCardinality.ZeroOrMore, false, false, CreationPolicy.Any));
- });
- }
-
- [TestMethod]
- public void IsImportingParameter_OnParameterImport()
- {
- ParameterInfo parameter = typeof(TestPart).GetConstructor(new Type[] { typeof(int) }).GetParameters()[0];
- Lazy<ParameterInfo> expectedLazyParameter = parameter.AsLazy();
-
- string expectedContractName = "Foo";
- string expectedRequiredTypeIdentity = "Bar";
- KeyValuePair<string, Type>[] expectedRequiredMetadata = new KeyValuePair<string, Type>[] { new KeyValuePair<string, Type>("Key1", typeof(string)), new KeyValuePair<string, Type>("Key2", typeof(int)) };
- ImportCardinality expectedCardinality = ImportCardinality.ExactlyOne;
- CreationPolicy expectedCreationPolicy = CreationPolicy.NonShared;
-
- ICompositionElement expectedOrigin = new MockOrigin();
- ImportDefinition importDefinition = ReflectionModelServices.CreateImportDefinition(
- expectedLazyParameter,
- expectedContractName,
- expectedRequiredTypeIdentity,
- expectedRequiredMetadata,
- expectedCardinality,
- expectedCreationPolicy,
- expectedOrigin);
- Assert.IsNotNull(importDefinition);
-
- Assert.IsTrue(ReflectionModelServices.IsImportingParameter(importDefinition));
- }
-
- [TestMethod]
- public void IsImportingParameter_OnMemberImport()
- {
- PropertyInfo property = typeof(TestPart).GetProperties().First();
- LazyMemberInfo expectedLazyMember = new LazyMemberInfo(property);
-
- string expectedContractName = "Foo";
- string expectedRequiredTypeIdentity = "Bar";
- KeyValuePair<string, Type>[] expectedRequiredMetadata = new KeyValuePair<string, Type>[] { new KeyValuePair<string, Type>("Key1", typeof(string)), new KeyValuePair<string, Type>("Key2", typeof(int)) };
- ImportCardinality expectedCardinality = ImportCardinality.ExactlyOne;
- CreationPolicy expectedCreationPolicy = CreationPolicy.NonShared;
- bool expectedRecomposable = true;
-
- ICompositionElement expectedOrigin = new MockOrigin();
-
- ImportDefinition importDefinition = ReflectionModelServices.CreateImportDefinition(
- expectedLazyMember,
- expectedContractName,
- expectedRequiredTypeIdentity,
- expectedRequiredMetadata,
- expectedCardinality,
- expectedRecomposable,
- expectedCreationPolicy,
- expectedOrigin);
- Assert.IsNotNull(importDefinition);
-
- Assert.IsFalse(ReflectionModelServices.IsImportingParameter(importDefinition));
- }
-
- [TestMethod]
- public void IsImportingParameter_NullAsImport_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("importDefinition", () =>
- {
- ReflectionModelServices.IsImportingParameter(null);
- });
- }
-
- [TestMethod]
- public void IsImportingParameter_InvalidImport_ShouldThrowArgument()
- {
- ExceptionAssert.ThrowsArgument<ArgumentException>("importDefinition", () =>
- {
- ReflectionModelServices.IsImportingParameter(new ContractBasedImportDefinition("Foo", "Foo", null, ImportCardinality.ZeroOrMore, false, false, CreationPolicy.Any));
- });
- }
-
- [TestMethod]
- public void IsExportFactoryImportDefinition_NullImport_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgumentNull("importDefinition", () =>
- ReflectionModelServices.IsExportFactoryImportDefinition(null));
- }
-
- [TestMethod]
- public void IsExportFactoryImportDefinition_InvalidImport_ShouldThrowArgument()
- {
- ExceptionAssert.ThrowsArgument("importDefinition", () =>
- ReflectionModelServices.IsExportFactoryImportDefinition(CreateInvalidImport()));
- }
-
- [TestMethod]
- public void IsExportFactoryImportDefinition_NonPartCreatorImport_ShouldReturnFalse()
- {
- var import = ReflectionModelServices.CreateImportDefinition(
- new LazyMemberInfo(MemberTypes.Field, () => new MemberInfo[] { typeof(ReflectionModelServicesTests) }), // bogus member
- "Foo",
- "Foo",
- Enumerable.Empty<KeyValuePair<string, Type>>(),
- ImportCardinality.ZeroOrMore,
- false,
- CreationPolicy.Any,
- null);
-
- Assert.IsFalse(ReflectionModelServices.IsExportFactoryImportDefinition(import));
- }
-
- [TestMethod]
- public void IsExportFactoryImportDefinition_PartCreatorImport_ShouldReturnTrue()
- {
- var import = ReflectionModelServices.CreateImportDefinition(
- new LazyMemberInfo(MemberTypes.Field, () => new MemberInfo[] { typeof(ReflectionModelServicesTests) }), // bogus member
- "Foo",
- "Foo",
- Enumerable.Empty<KeyValuePair<string, Type>>(),
- ImportCardinality.ZeroOrMore,
- false,
- CreationPolicy.Any,
- true, //isPartCreator
- null);
-
- Assert.IsTrue(ReflectionModelServices.IsExportFactoryImportDefinition(import));
- }
-
- [TestMethod]
- public void GetPartCreatorProductImportDefinition_NullImport_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgumentNull("importDefinition", () =>
- ReflectionModelServices.GetPartCreatorProductImportDefinition(null));
- }
-
- [TestMethod]
- public void GetPartCreatorProductImportDefinition_InvalidImport_ShouldThrowArgument()
- {
- ExceptionAssert.ThrowsArgument("importDefinition", () =>
- ReflectionModelServices.GetPartCreatorProductImportDefinition(CreateInvalidImport()));
- }
-
- [TestMethod]
- public void GetPartCreatorProductImportDefinition_()
- {
-
- }
-
- [TestMethod]
- public void GetPartCreatorProductImportDefinition_PartCreatorImport_()
- {
- LazyMemberInfo bogusMember = new LazyMemberInfo(MemberTypes.Field, () => new MemberInfo[] { typeof(ReflectionModelServicesTests) });
- var import = ReflectionModelServices.CreateImportDefinition(
- bogusMember,
- "Foo",
- "Foo",
- Enumerable.Empty<KeyValuePair<string, Type>>(),
- ImportCardinality.ZeroOrMore,
- false,
- CreationPolicy.Any,
- true, //isPartCreator
- null);
-
- var productImport = ReflectionModelServices.GetPartCreatorProductImportDefinition(import);
-
- var import2 = ReflectionModelServices.CreateImportDefinition(
- bogusMember,
- productImport.ContractName,
- productImport.RequiredTypeIdentity,
- productImport.RequiredMetadata,
- productImport.Cardinality,
- productImport.IsRecomposable,
- productImport.RequiredCreationPolicy,
- true, //isPartCreator
- null);
-
- Assert.AreEqual(import.ContractName, import2.ContractName);
- Assert.AreEqual(import.Cardinality, import2.Cardinality);
- Assert.AreEqual(import.IsRecomposable, import2.IsRecomposable);
- Assert.AreEqual(import.RequiredCreationPolicy, import2.RequiredCreationPolicy);
- Assert.AreEqual(import.RequiredTypeIdentity, import2.RequiredTypeIdentity);
- EnumerableAssert.AreEqual(import.RequiredMetadata, import2.RequiredMetadata);
- }
-
- private static IEnumerable<ImportDefinition> CreateInvalidImports()
- {
- yield return new ContractBasedImportDefinition("Foo", "Foo", null, ImportCardinality.ZeroOrMore, false, false, CreationPolicy.Any);
- }
-
- private static ImportDefinition CreateInvalidImport()
- {
- return new ContractBasedImportDefinition("Foo", "Foo", null, ImportCardinality.ZeroOrMore, false, false, CreationPolicy.Any);
- }
-
- private static IEnumerable<ExportDefinition> CreateInvalidExports()
- {
- yield return new ExportDefinition("Foo", null);
- }
-
-
- class InvalidPartDefinition : ComposablePartDefinition
- {
- public override ComposablePart CreatePart()
- {
- throw new NotImplementedException();
- }
-
- public override IEnumerable<ExportDefinition> ExportDefinitions
- {
- get { throw new NotImplementedException(); }
- }
-
- public override IEnumerable<ImportDefinition> ImportDefinitions
- {
- get { throw new NotImplementedException(); }
- }
- }
-
- private static List<ImportDefinition> CreateImports(Type type)
- {
- List<ImportDefinition> imports = new List<ImportDefinition>();
- foreach (PropertyInfo property in type.GetProperties())
- {
- imports.Add(new ReflectionMemberImportDefinition(new LazyMemberInfo(property), "Contract", (string)null, new KeyValuePair<string, Type>[] { new KeyValuePair<string, Type>("Key1", typeof(string)), new KeyValuePair<string, Type>("Key2", typeof(int)) }, ImportCardinality.ZeroOrOne, true, CreationPolicy.Any, new TypeOrigin(type)));
- }
-
- return imports;
- }
-
- private static List<ExportDefinition> CreateExports(Type type)
- {
- List<ExportDefinition> exports = new List<ExportDefinition>();
- foreach (PropertyInfo property in type.GetProperties())
- {
- exports.Add(ReflectionModelServices.CreateExportDefinition(new LazyMemberInfo(property), "Contract", new Lazy<IDictionary<string, object>>(() => null), new TypeOrigin(type)));
- }
-
- return exports;
- }
-
- public class TestPart
- {
- public TestPart(int arg1)
- {
- }
-
- public int field1;
- public string field2;
- public int Property1 { get; set; }
- public string Property2
- {
- get { return null; }
- set
- {
- this.Event.Invoke(this, null);
- }
- }
- public event EventHandler Event;
- }
-
- private class TypeOrigin : ICompositionElement
- {
- private readonly Type _type;
- private readonly ICompositionElement _orgin;
-
- public TypeOrigin(Type type)
- : this(type, null)
- {
- }
-
- public TypeOrigin(Type type, ICompositionElement origin)
- {
- this._type = type;
- this._orgin = origin;
- }
-
- public string DisplayName
- {
- get
- {
- return this._type.GetDisplayName();
- }
- }
-
- public ICompositionElement Origin
- {
- get
- {
- return this._orgin;
- }
- }
- }
-
- private class MockOrigin : ICompositionElement
- {
- public string DisplayName
- {
- get { throw new NotImplementedException(); }
- }
-
- public ICompositionElement Origin
- {
- get { throw new NotImplementedException(); }
- }
- }
-
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ReflectionModel/ReflectionParameterImportDefinitionTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ReflectionModel/ReflectionParameterImportDefinitionTests.cs deleted file mode 100644 index 5016f9aea34..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ReflectionModel/ReflectionParameterImportDefinitionTests.cs +++ /dev/null @@ -1,147 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.AttributedModel;
-using System.Reflection;
-using Microsoft.Internal;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- [TestClass]
- public class ReflectionParameterImportDefinitionTests
- {
- [TestMethod]
- public void Constructor()
- {
- Lazy<ParameterInfo> parameter = CreateLazyParameter();
- IEnumerable<KeyValuePair<string, Type>> requiredMetadata = new KeyValuePair<string, Type>[] { new KeyValuePair<string, Type>("Foo", typeof(object)) };
-
- ReflectionParameterImportDefinition definition = new ReflectionParameterImportDefinition(
- parameter, "Contract", (string)null, requiredMetadata, ImportCardinality.ZeroOrMore, CreationPolicy.NonShared, null);
-
- Assert.AreSame(parameter, definition.ImportingLazyParameter);
- Assert.AreEqual("Contract", definition.ContractName);
- Assert.AreSame(requiredMetadata, definition.RequiredMetadata);
- Assert.AreEqual(CreationPolicy.NonShared, definition.RequiredCreationPolicy);
- Assert.AreEqual(false, definition.IsRecomposable);
- Assert.AreEqual(true, definition.IsPrerequisite);
- Assert.IsNull(((ICompositionElement)definition).Origin);
- Assert.IsNotNull(((ICompositionElement)definition).DisplayName);
- }
-
- [TestMethod]
- public void Constructor_WithNullRequiredMetadata()
- {
- Lazy<ParameterInfo> parameter = CreateLazyParameter();
-
- ReflectionParameterImportDefinition definition = new ReflectionParameterImportDefinition(
- parameter, "Contract", (string)null, null, ImportCardinality.ZeroOrMore, CreationPolicy.NonShared, null);
-
-
- Assert.IsNotNull(definition.RequiredMetadata);
- Assert.AreEqual(0, definition.RequiredMetadata.Count());
- }
-
- [TestMethod]
- public void SetDefinition_OriginIsSet()
- {
- Lazy<ParameterInfo> parameter = CreateLazyParameter();
- var expectedPartDefinition = PartDefinitionFactory.CreateAttributed(typeof(object));
-
- ReflectionParameterImportDefinition definition = new ReflectionParameterImportDefinition(
- parameter, "Contract", (string)null, null, ImportCardinality.ZeroOrMore, CreationPolicy.NonShared, expectedPartDefinition);
-
- Assert.AreSame(expectedPartDefinition, ((ICompositionElement)definition).Origin);
- }
-
-
- [TestMethod]
- public void ICompositionElementDisplayName_ValueAsParameter_ShouldIncludeParameterName()
- {
- var names = Expectations.GetContractNamesWithEmpty();
-
- foreach (var name in names)
- {
- var definition = CreateReflectionParameterImportDefinition(name);
-
- var e = CreateDisplayNameExpectationFromParameterName(definition, name);
-
- Assert.AreEqual(e, ((ICompositionElement)definition).DisplayName);
- }
- }
-
- [TestMethod]
- public void ICompositionElementDisplayName_ValueAsParameter_ShouldIncludeContractName()
- {
- var types = Expectations.GetTypes();
-
- foreach (var type in types)
- {
- var definition = CreateReflectionParameterImportDefinition(type);
-
- var e = CreateDisplayNameExpectationFromContractName(definition, type);
-
- Assert.AreEqual(e, ((ICompositionElement)definition).DisplayName);
- }
- }
-
- [TestMethod]
- public void ToString_ShouldReturnICompositionElementDisplayName()
- {
- var types = Expectations.GetTypes();
-
- foreach (var type in types)
- {
- var definition = CreateReflectionParameterImportDefinition(type);
-
- Assert.AreEqual(((ICompositionElement)definition).DisplayName, definition.ToString());
- }
- }
-
-
- private Lazy<ParameterInfo> CreateLazyParameter()
- {
- return typeof(SimpleConstructorInjectedObject).GetConstructors().First().GetParameters().First().AsLazy();
- }
-
- private static string CreateDisplayNameExpectationFromContractName(ReflectionParameterImportDefinition definition, Type type)
- {
- string contractName = AttributedModelServices.GetContractName(type);
-
- return String.Format("{0} (Parameter=\"\", ContractName=\"{1}\")", definition.ImportingLazyParameter.Value.Member.GetDisplayName(), contractName);
- }
-
- private static string CreateDisplayNameExpectationFromParameterName(ReflectionParameterImportDefinition definition, string name)
- {
- return String.Format("{0} (Parameter=\"{1}\", ContractName=\"System.String\")", definition.ImportingLazyParameter.Value.Member.GetDisplayName(), name);
- }
-
- private static ReflectionParameterImportDefinition CreateReflectionParameterImportDefinition(Type parameterType)
- {
- var parameter = ReflectionFactory.CreateParameter(parameterType);
-
- return CreateReflectionParameterImportDefinition(parameter);
- }
-
- private static ReflectionParameterImportDefinition CreateReflectionParameterImportDefinition(string name)
- {
- var parameter = ReflectionFactory.CreateParameter(name);
-
- return CreateReflectionParameterImportDefinition(parameter);
- }
-
- private static ReflectionParameterImportDefinition CreateReflectionParameterImportDefinition(ParameterInfo parameter)
- {
- return new ReflectionParameterImportDefinition(
- parameter.AsLazy(), AttributedModelServices.GetContractName(parameter.ParameterType), (string)null, null, ImportCardinality.ZeroOrMore, CreationPolicy.NonShared, null);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/SampleComponents.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/SampleComponents.cs deleted file mode 100644 index f82d9eabf36..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/SampleComponents.cs +++ /dev/null @@ -1,1023 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition
-{
- public interface IGetString
- {
- string GetString();
- }
- public class PublicComponentWithPublicExports
- {
- public const string PublicFieldExpectedValue = "PublicField";
- [Export("PublicField")]
- public string PublicField = PublicFieldExpectedValue;
- public const string PublicPropertyExpectedValue = "PublicProperty";
- [Export("PublicProperty")]
- public string PublicProperty { get { return PublicPropertyExpectedValue; } }
- public const string PublicMethodExpectedValue = "PublicMethod";
- [Export("PublicDelegate")]
- public string PublicMethod() { return PublicMethodExpectedValue; }
- public const string PublicNestedClassExpectedValue = "PublicNestedClass";
- [Export("PublicIGetString", typeof(IGetString))]
- public class PublicNestedClass : IGetString
- {
- public string GetString() { return PublicNestedClassExpectedValue; }
- }
- }
- [Export]
- public class PublicImportsExpectingPublicExports
- {
- [Import("PublicField")]
- public string PublicImportPublicField { get; set; }
- [Import("PublicProperty")]
- public string PublicImportPublicProperty { get; set; }
- [Import("PublicDelegate")]
- public Func<string> PublicImportPublicMethod { get; set; }
- [Import("PublicIGetString")]
- public IGetString PublicImportPublicNestedClass { get; set; }
-
- public void VerifyIsBound()
- {
- Assert.AreEqual(PublicComponentWithPublicExports.PublicFieldExpectedValue, PublicImportPublicField, "PublicImportPublicField should be bound.");
- Assert.AreEqual(PublicComponentWithPublicExports.PublicPropertyExpectedValue, PublicImportPublicProperty, "PublicImportPublicProperty should be bound.");
- Assert.AreEqual(PublicComponentWithPublicExports.PublicMethodExpectedValue, PublicImportPublicMethod(), "PublicImportPublicMethod should be bound.");
- Assert.AreEqual(PublicComponentWithPublicExports.PublicNestedClassExpectedValue, PublicImportPublicNestedClass.GetString(), "PublicImportPublicNestedClass should be bound and have a method GetString.");
- }
- }
- [Export]
- internal class InternalImportsExpectingPublicExports
- {
- [Import("PublicField")]
- internal string InternalImportPublicField { get; set; }
- [Import("PublicProperty")]
- internal string InternalImportPublicProperty { get; set; }
- [Import("PublicDelegate")]
- internal Func<string> InternalImportPublicMethod { get; set; }
- [Import("PublicIGetString")]
- internal IGetString InternalImportPublicNestedClass { get; set; }
-
- public void VerifyIsBound()
- {
- Assert.AreEqual(PublicComponentWithPublicExports.PublicFieldExpectedValue, InternalImportPublicField, "InternalImportPublicField should be bound.");
- Assert.AreEqual(PublicComponentWithPublicExports.PublicPropertyExpectedValue, InternalImportPublicProperty, "InternalImportPublicProperty should be bound.");
- Assert.AreEqual(PublicComponentWithPublicExports.PublicMethodExpectedValue, InternalImportPublicMethod(), "InternalImportPublicMethod should be bound.");
- Assert.AreEqual(PublicComponentWithPublicExports.PublicNestedClassExpectedValue, InternalImportPublicNestedClass.GetString(), "InternalImportPublicNestedClass should be bound and have a method GetString.");
- }
- }
- public class PublicComponentWithInternalExports
- {
- public const string InternalFieldExpectedValue = "InternalField";
- [Export("InternalField")]
- internal string InternalField = InternalFieldExpectedValue;
- public const string InternalPropertyExpectedValue = "InternalProperty";
- [Export("InternalProperty")]
- internal string InternalProperty { get { return InternalPropertyExpectedValue; } }
- public const string InternalMethodExpectedValue = "InternalMethod";
- [Export("InternalDelegate")]
- internal string InternalMethod() { return InternalMethodExpectedValue; }
- public const string InternalNestedClassExpectedValue = "InternalNestedClass";
- [Export("InternalIGetString", typeof(IGetString))]
- internal class InternalNestedClass : IGetString
- {
- public string GetString() { return InternalNestedClassExpectedValue; }
- }
- }
- [Export]
- public class PublicImportsExpectingInternalExports
- {
- [Import("InternalField")]
- public string PublicImportInternalField { get; set; }
- [Import("InternalProperty")]
- public string PublicImportInternalProperty { get; set; }
- [Import("InternalDelegate")]
- public Func<string> PublicImportInternalMethod { get; set; }
- [Import("InternalIGetString", typeof(IGetString))]
- public IGetString PublicImportInternalNestedClass { get; set; }
-
- public void VerifyIsBound()
- {
- Assert.AreEqual(PublicComponentWithInternalExports.InternalFieldExpectedValue, PublicImportInternalField, "PublicImportInternalField should be bound.");
- Assert.AreEqual(PublicComponentWithInternalExports.InternalPropertyExpectedValue, PublicImportInternalProperty, "PublicImportInternalProperty should be bound.");
- Assert.AreEqual(PublicComponentWithInternalExports.InternalMethodExpectedValue, PublicImportInternalMethod(), "PublicImportInternalMethod should be bound.");
- Assert.AreEqual(PublicComponentWithInternalExports.InternalNestedClassExpectedValue, PublicImportInternalNestedClass.GetString(), "PublicImportInternalNestedClass should be bound and have a method GetString.");
- }
- }
- [Export]
- internal class InternalImportsExpectingInternalExports
- {
- [Import("InternalField")]
- internal string InternalImportInternalField { get; set; }
- [Import("InternalProperty")]
- internal string InternalImportInternalProperty { get; set; }
- [Import("InternalDelegate")]
- internal Func<string> InternalImportInternalMethod { get; set; }
- [Import("InternalIGetString")]
- internal IGetString InternalImportInternalNestedClass { get; set; }
-
- public void VerifyIsBound()
- {
- Assert.AreEqual(PublicComponentWithInternalExports.InternalFieldExpectedValue, InternalImportInternalField, "InternalImportInternalField should be bound.");
- Assert.AreEqual(PublicComponentWithInternalExports.InternalPropertyExpectedValue, InternalImportInternalProperty, "InternalImportInternalProperty should be bound.");
- Assert.AreEqual(PublicComponentWithInternalExports.InternalMethodExpectedValue, InternalImportInternalMethod(), "InternalImportInternalMethod should be bound.");
- Assert.AreEqual(PublicComponentWithInternalExports.InternalNestedClassExpectedValue, InternalImportInternalNestedClass.GetString(), "InternalImportInternalNestedClass should be bound and have a method GetString.");
- }
- }
- public class PublicComponentWithProtectedExports
- {
- public const string ProtectedFieldExpectedValue = "ProtectedField";
- [Export("ProtectedField")]
- protected string ProtectedField = ProtectedFieldExpectedValue;
- public const string ProtectedPropertyExpectedValue = "ProtectedProperty";
- [Export("ProtectedProperty")]
- protected string ProtectedProperty { get { return ProtectedPropertyExpectedValue; } }
- public const string ProtectedMethodExpectedValue = "ProtectedMethod";
- [Export("ProtectedDelegate")]
- protected string ProtectedMethod() { return ProtectedMethodExpectedValue; }
- public const string ProtectedNestedClassExpectedValue = "ProtectedNestedClass";
- [Export("ProtectedIGetString", typeof(IGetString))]
- protected class ProtectedNestedClass : IGetString
- {
- public string GetString() { return ProtectedNestedClassExpectedValue; }
- }
- }
- [Export]
- public class PublicImportsExpectingProtectedExports
- {
- [Import("ProtectedField")]
- public string PublicImportProtectedField { get; set; }
- [Import("ProtectedProperty")]
- public string PublicImportProtectedProperty { get; set; }
- [Import("ProtectedDelegate")]
- public Func<string> PublicImportProtectedMethod { get; set; }
- [Import("ProtectedIGetString")]
- public IGetString PublicImportProtectedNestedClass { get; set; }
-
- public void VerifyIsBound()
- {
- Assert.AreEqual(PublicComponentWithProtectedExports.ProtectedFieldExpectedValue, PublicImportProtectedField, "PublicImportProtectedField should be bound.");
- Assert.AreEqual(PublicComponentWithProtectedExports.ProtectedPropertyExpectedValue, PublicImportProtectedProperty, "PublicImportProtectedProperty should be bound.");
- Assert.AreEqual(PublicComponentWithProtectedExports.ProtectedMethodExpectedValue, PublicImportProtectedMethod(), "PublicImportProtectedMethod should be bound.");
- Assert.AreEqual(PublicComponentWithProtectedExports.ProtectedNestedClassExpectedValue, PublicImportProtectedNestedClass.GetString(), "PublicImportProtectedNestedClass should be bound and have a method GetString.");
- }
- }
- [Export]
- internal class InternalImportsExpectingProtectedExports
- {
- [Import("ProtectedField")]
- internal string InternalImportProtectedField { get; set; }
- [Import("ProtectedProperty")]
- internal string InternalImportProtectedProperty { get; set; }
- [Import("ProtectedDelegate")]
- internal Func<string> InternalImportProtectedMethod { get; set; }
- [Import("ProtectedIGetString")]
- internal IGetString InternalImportProtectedNestedClass { get; set; }
-
- public void VerifyIsBound()
- {
- Assert.AreEqual(PublicComponentWithProtectedExports.ProtectedFieldExpectedValue, InternalImportProtectedField, "InternalImportProtectedField should be bound.");
- Assert.AreEqual(PublicComponentWithProtectedExports.ProtectedPropertyExpectedValue, InternalImportProtectedProperty, "InternalImportProtectedProperty should be bound.");
- Assert.AreEqual(PublicComponentWithProtectedExports.ProtectedMethodExpectedValue, InternalImportProtectedMethod(), "InternalImportProtectedMethod should be bound.");
- Assert.AreEqual(PublicComponentWithProtectedExports.ProtectedNestedClassExpectedValue, InternalImportProtectedNestedClass.GetString(), "InternalImportProtectedNestedClass should be bound and have a method GetString.");
- }
- }
- public class PublicComponentWithProtectedInternalExports
- {
- public const string ProtectedInternalFieldExpectedValue = "ProtectedInternalField";
- [Export("ProtectedInternalField")]
- protected internal string ProtectedInternalField = ProtectedInternalFieldExpectedValue;
- public const string ProtectedInternalPropertyExpectedValue = "ProtectedInternalProperty";
- [Export("ProtectedInternalProperty")]
- protected internal string ProtectedInternalProperty { get { return ProtectedInternalPropertyExpectedValue; } }
- public const string ProtectedInternalMethodExpectedValue = "ProtectedInternalMethod";
- [Export("ProtectedInternalDelegate")]
- protected internal string ProtectedInternalMethod() { return ProtectedInternalMethodExpectedValue; }
- public const string ProtectedInternalNestedClassExpectedValue = "ProtectedInternalNestedClass";
- [Export("ProtectedInternalIGetString", typeof(IGetString))]
- protected internal class ProtectedInternalNestedClass : IGetString
- {
- public string GetString() { return ProtectedInternalNestedClassExpectedValue; }
- }
- }
- [Export]
- public class PublicImportsExpectingProtectedInternalExports
- {
- [Import("ProtectedInternalField")]
- public string PublicImportProtectedInternalField { get; set; }
- [Import("ProtectedInternalProperty")]
- public string PublicImportProtectedInternalProperty { get; set; }
- [Import("ProtectedInternalDelegate")]
- public Func<string> PublicImportProtectedInternalMethod { get; set; }
- [Import("ProtectedInternalIGetString")]
- public IGetString PublicImportProtectedInternalNestedClass { get; set; }
-
- public void VerifyIsBound()
- {
- Assert.AreEqual(PublicComponentWithProtectedInternalExports.ProtectedInternalFieldExpectedValue, PublicImportProtectedInternalField, "PublicImportProtectedInternalField should be bound.");
- Assert.AreEqual(PublicComponentWithProtectedInternalExports.ProtectedInternalPropertyExpectedValue, PublicImportProtectedInternalProperty, "PublicImportProtectedInternalProperty should be bound.");
- Assert.AreEqual(PublicComponentWithProtectedInternalExports.ProtectedInternalMethodExpectedValue, PublicImportProtectedInternalMethod(), "PublicImportProtectedInternalMethod should be bound.");
- Assert.AreEqual(PublicComponentWithProtectedInternalExports.ProtectedInternalNestedClassExpectedValue, PublicImportProtectedInternalNestedClass.GetString(), "PublicImportProtectedInternalNestedClass should be bound and have a method GetString.");
- }
- }
- [Export]
- internal class InternalImportsExpectingProtectedInternalExports
- {
- [Import("ProtectedInternalField")]
- internal string InternalImportProtectedInternalField { get; set; }
- [Import("ProtectedInternalProperty")]
- internal string InternalImportProtectedInternalProperty { get; set; }
- [Import("ProtectedInternalDelegate")]
- internal Func<string> InternalImportProtectedInternalMethod { get; set; }
- [Import("ProtectedInternalIGetString")]
- internal IGetString InternalImportProtectedInternalNestedClass { get; set; }
-
- public void VerifyIsBound()
- {
- Assert.AreEqual(PublicComponentWithProtectedInternalExports.ProtectedInternalFieldExpectedValue, InternalImportProtectedInternalField, "InternalImportProtectedInternalField should be bound.");
- Assert.AreEqual(PublicComponentWithProtectedInternalExports.ProtectedInternalPropertyExpectedValue, InternalImportProtectedInternalProperty, "InternalImportProtectedInternalProperty should be bound.");
- Assert.AreEqual(PublicComponentWithProtectedInternalExports.ProtectedInternalMethodExpectedValue, InternalImportProtectedInternalMethod(), "InternalImportProtectedInternalMethod should be bound.");
- Assert.AreEqual(PublicComponentWithProtectedInternalExports.ProtectedInternalNestedClassExpectedValue, InternalImportProtectedInternalNestedClass.GetString(), "InternalImportProtectedInternalNestedClass should be bound and have a method GetString.");
- }
- }
- public class PublicComponentWithPrivateExports
- {
- public const string PrivateFieldExpectedValue = "PrivateField";
- [Export("PrivateField")]
- private string PrivateField = PrivateFieldExpectedValue;
- public const string PrivatePropertyExpectedValue = "PrivateProperty";
- [Export("PrivateProperty")]
- private string PrivateProperty { get { return PrivatePropertyExpectedValue; } }
- public const string PrivateMethodExpectedValue = "PrivateMethod";
- [Export("PrivateDelegate")]
- private string PrivateMethod() { return PrivateMethodExpectedValue; }
- public const string PrivateNestedClassExpectedValue = "PrivateNestedClass";
- [Export("PrivateIGetString", typeof(IGetString))]
- private class PrivateNestedClass : IGetString
- {
- public string GetString() { return PrivateNestedClassExpectedValue; }
- }
- }
- [Export]
- public class PublicImportsExpectingPrivateExports
- {
- [Import("PrivateField")]
- public string PublicImportPrivateField { get; set; }
- [Import("PrivateProperty")]
- public string PublicImportPrivateProperty { get; set; }
- [Import("PrivateDelegate")]
- public Func<string> PublicImportPrivateMethod { get; set; }
- [Import("PrivateIGetString")]
- public IGetString PublicImportPrivateNestedClass { get; set; }
-
- public void VerifyIsBound()
- {
- Assert.AreEqual(PublicComponentWithPrivateExports.PrivateFieldExpectedValue, PublicImportPrivateField, "PublicImportPrivateField should be bound.");
- Assert.AreEqual(PublicComponentWithPrivateExports.PrivatePropertyExpectedValue, PublicImportPrivateProperty, "PublicImportPrivateProperty should be bound.");
- Assert.AreEqual(PublicComponentWithPrivateExports.PrivateMethodExpectedValue, PublicImportPrivateMethod(), "PublicImportPrivateMethod should be bound.");
- Assert.AreEqual(PublicComponentWithPrivateExports.PrivateNestedClassExpectedValue, PublicImportPrivateNestedClass.GetString(), "PublicImportPrivateNestedClass should be bound and have a method GetString.");
- }
- }
- [Export]
- internal class InternalImportsExpectingPrivateExports
- {
- [Import("PrivateField")]
- internal string InternalImportPrivateField { get; set; }
- [Import("PrivateProperty")]
- internal string InternalImportPrivateProperty { get; set; }
- [Import("PrivateDelegate")]
- internal Func<string> InternalImportPrivateMethod { get; set; }
- [Import("PrivateIGetString")]
- internal IGetString InternalImportPrivateNestedClass { get; set; }
-
- public void VerifyIsBound()
- {
- Assert.AreEqual(PublicComponentWithPrivateExports.PrivateFieldExpectedValue, InternalImportPrivateField, "InternalImportPrivateField should be bound.");
- Assert.AreEqual(PublicComponentWithPrivateExports.PrivatePropertyExpectedValue, InternalImportPrivateProperty, "InternalImportPrivateProperty should be bound.");
- Assert.AreEqual(PublicComponentWithPrivateExports.PrivateMethodExpectedValue, InternalImportPrivateMethod(), "InternalImportPrivateMethod should be bound.");
- Assert.AreEqual(PublicComponentWithPrivateExports.PrivateNestedClassExpectedValue, InternalImportPrivateNestedClass.GetString(), "InternalImportPrivateNestedClass should be bound and have a method GetString.");
- }
- }
-
- [Export("ImportDefaultFunctions")]
- public class ImportDefaultFunctions
- {
- [Import("FunctionWith0Args")]
- public Func<int> MyFunction0;
-
- [Import("FunctionWith1Arg")]
- public Func<int, int> MyFunction1;
-
- [Import("FunctionWith2Args")]
- public Func<int, int, int> MyFunction2;
-
- [Import("FunctionWith3Args")]
- public Func<int, int, int, int> MyFunction3;
-
- [Import("FunctionWith4Args")]
- public Func<int, int, int, int, int> MyFunction4;
-
- [Import("ActionWith0Args")]
- public Action MyAction0;
-
- [Import("ActionWith1Arg")]
- public Action<int> MyAction1;
-
- [Import("ActionWith2Args")]
- public Action<int, int> MyAction2;
-
- [Import("ActionWith3Args")]
- public Action<int, int, int> MyAction3;
-
- [Import("ActionWith4Args")]
- public Action<int, int, int, int> MyAction4;
-
- public void VerifyIsBound()
- {
- Assert.AreEqual(0, MyFunction0.Invoke());
- Assert.AreEqual(1, MyFunction1.Invoke(1));
- Assert.AreEqual(3, MyFunction2.Invoke(1, 2));
- Assert.AreEqual(6, MyFunction3.Invoke(1, 2, 3));
- Assert.AreEqual(10, MyFunction4.Invoke(1, 2, 3, 4));
-
- MyAction0.Invoke();
- MyAction1.Invoke(1);
- MyAction2.Invoke(1, 2);
- MyAction3.Invoke(1, 2, 3);
- MyAction4.Invoke(1, 2, 3, 4);
- }
- }
-
- public class ExportDefaultFunctions
- {
- [Export("FunctionWith0Args")]
- public int MyFunction0()
- {
- return 0;
- }
-
- [Export("FunctionWith1Arg")]
- public int MyFunction1(int i1)
- {
- return i1;
- }
-
- [Export("FunctionWith2Args")]
- public int MyFunction2(int i1, int i2)
- {
- return i1 + i2;
- }
-
- [Export("FunctionWith3Args")]
- public int MyFunction3(int i1, int i2, int i3)
- {
- return i1 + i2 + i3;
- }
-
- [Export("FunctionWith4Args")]
- public int MyFunction4(int i1, int i2, int i3, int i4)
- {
- return i1 + i2 + i3 + i4;
- }
-
-
-
- [Export("ActionWith0Args")]
- public void MyAction0()
- {
- }
-
- [Export("ActionWith1Arg")]
- public void MyAction1(int i1)
- {
- Assert.AreEqual(i1, 1);
- }
-
- [Export("ActionWith2Args")]
- public void MyAction2(int i1, int i2)
- {
- Assert.AreEqual(i1, 1);
- Assert.AreEqual(i2, 2);
- }
-
- [Export("ActionWith3Args")]
- public void MyAction3(int i1, int i2, int i3)
- {
- Assert.AreEqual(i1, 1);
- Assert.AreEqual(i2, 2);
- Assert.AreEqual(i3, 3);
- }
-
- [Export("ActionWith4Args")]
- public void MyAction4(int i1, int i2, int i3, int i4)
- {
- Assert.AreEqual(i1, 1);
- Assert.AreEqual(i2, 2);
- Assert.AreEqual(i3, 3);
- Assert.AreEqual(i4, 4);
- }
- }
-
- [Export]
- public class CatalogComponentTest
- {
- }
-
- [Export]
- [PartNotDiscoverable]
- public class CatalogComponentTestNonComponentPart
- {
- }
-
- public interface ICatalogComponentTest
- {
- }
-
- [Export(typeof(ICatalogComponentTest))]
- public class CatalogComponentInterfaceTest1 : ICatalogComponentTest
- {
- }
-
- public class CatalogComponentInterfaceTest2
- {
- [Export]
- public ICatalogComponentTest ExportedInterface
- {
- get { return new CatalogComponentInterfaceTest1(); }
- }
- }
-
- public static class StaticExportClass
- {
- [Export("StaticString")]
- public static string StaticString { get { return "StaticString"; } }
- }
-
- [Export]
- public class DisposableExportClass : IDisposable
- {
- public bool IsDisposed { get; set; }
- public void Dispose()
- {
- Assert.IsFalse(IsDisposed);
- IsDisposed = true;
- }
- }
-
- public interface IServiceView
- {
- int GetSomeInt();
- }
-
- [Export("service1")]
- public class Service
- {
- public int GetSomeInt()
- {
- return 5;
- }
- }
-
- public class Client
- {
- private IServiceView mySerivce;
-
- [Import("service1")]
- public IServiceView MyService
- {
- get { return mySerivce; }
- set { mySerivce = value; }
- }
- public int GetSomeValue()
- {
- return MyService.GetSomeInt() * 2;
- }
- }
-
- [Export]
- public class TrivialExporter
- {
- public bool done = false;
- }
-
- [Export]
- public class TrivialImporter : IPartImportsSatisfiedNotification
- {
- [Import]
- public TrivialExporter checker;
-
- public void OnImportsSatisfied()
- {
- checker.done = true;
- }
- }
-
- [Export]
- public class UnnamedImportAndExport
- {
- [Import]
- public IUnnamedExport ImportedValue;
- }
-
- [Export]
- public class StaticExport
- {
- }
-
- [Export]
- [PartCreationPolicy(CreationPolicy.NonShared)]
- public class NonStaticExport
- {
- }
-
- public interface IUnnamedExport
- {
- }
-
- [Export(typeof(IUnnamedExport))]
- public class UnnamedExport : IUnnamedExport
- {
- }
-
- public interface IExportableTest
- {
- string Var1 { get; }
- }
-
- [AttributeUsage(AttributeTargets.All)]
- [MetadataAttribute]
- public class ExportableTestAttribute : Attribute
- {
- private string var1;
-
- public string Var1
- {
- get { return var1; }
- set { var1 = value; }
- }
- }
-
- [AttributeUsage(AttributeTargets.All)]
- [MetadataAttribute]
- [CLSCompliant(false)]
- public class MetadataWithCollectionPropertyAttribute : Attribute
- {
- private string[] values;
-
- public string[] Values
- {
- get { return values; }
- }
-
- public MetadataWithCollectionPropertyAttribute(params string[] values)
- {
- this.values = values;
- }
- }
-
- [Export]
- [MetadataWithCollectionProperty("One", "two", "3")]
- [CLSCompliant(false)]
- public class ComponentWithCollectionProperty
- {
- }
-
- public interface ICollectionOfStrings
- {
- IEnumerable<string> Values { get; }
- }
-
- public class SubtractProvider
- {
- [Export("One")]
- public int One = 1;
-
- [Export("Two")]
- public int Two { get { return 2; } }
-
- [Export("Add")]
- [ExportableTest(Var1 = "sub")]
- public Func<int, int, int> Subtract = (x, y) => x - y;
- }
- public class RealAddProvider
- {
- [Export("One")]
- public int One = 1;
-
- [Export("Two")]
- public int Two { get { return 2; } }
-
- [Export("Add")]
- [ExportMetadata("Var1", "add")]
- public int Add(int x, int y)
- {
- return x + y;
- }
- }
- public class Consumer
- {
- [Import("One")]
- public int a;
- [Import("Two")]
- public int b;
- [Import("Add")]
- public Func<int, int, int> op;
- [Import("Add", AllowDefault = true)]
- public Lazy<Func<int, int, int>> opInfo;
- }
-
- public class ConsumerOfMultiple
- {
- [ImportMany("Add")]
- public IEnumerable<Lazy<Func<int, int, int>, IDictionary<string, object>>> opInfo;
- }
-
- public interface IStrongValueMetadata
- {
- int value { get; set; }
- }
-
- public class UntypedExportImporter
- {
- [Import("untyped")]
- public Lazy<object> Export;
- }
-
- public class UntypedExportsImporter
- {
- [ImportMany("untyped")]
- public IEnumerable<Lazy<object>> Exports;
- }
-
- public class DerivedExport : Export
- {
- }
-
- public class DerivedExportImporter
- {
- [Import("derived")]
- public DerivedExport Export;
-
- }
-
- public class DerivedExportsImporter
- {
- [ImportMany("derived")]
- public IEnumerable<DerivedExport> Exports;
- }
-
- [Export]
- public class NotSoUniqueName
- {
- public int MyIntProperty { get { return 23; } }
- }
-
- public class NotSoUniqueName2
- {
- [Export]
- public class NotSoUniqueName
- {
- public virtual string MyStringProperty { get { return "MyStringProperty"; } }
- }
- }
-
- [Export]
- public class MyExport
- {
- }
-
- [Export]
- public class MySharedPartExport
- {
- [Import("Value", AllowRecomposition = true)]
- public int Value { get; set; }
- }
-
- [Export]
- [PartCreationPolicy(CreationPolicy.NonShared)]
- public class MyNonSharedPartExport
- {
- [Import("Value")]
- public int Value { get; set; }
- }
-
- public class ExportThatCantBeActivated
- {
- [Export("ExportMyString")]
- public string MyString { get { return "MyString"; } }
-
- [Import("ContractThatShouldNotexist")]
- public string MissingImport { get; set; }
- }
-
- public class GenericContract1<T>
- {
- public class GenericContract2
- {
- public class GenericContract3<N>
- {
- }
- }
- }
-
- public class GenericContract4<T, K>
- {
- public class GenericContract5<A, B>
- {
- public class GenericContract6<N, M>
- {
- }
- }
- }
-
- public class OuterClassWithGenericNested
- {
- public class GenericNested<T>
- {
- }
- }
-
- public class GenericContract7 :
- GenericContract4<string, string>.GenericContract5<int, int>.GenericContract6<double, double> { }
-
- public class GenericContract8<T> : GenericContract1<string>.GenericContract2.GenericContract3<T> { }
-
- public class NestedParent
- {
- public class NestedChild { }
- }
-
- [Export]
- [PartCreationPolicy(CreationPolicy.NonShared)]
- public class DirectCycleNonSharedPart
- {
- [Import]
- public DirectCycleNonSharedPart NonSharedPart { get; set; }
- }
-
- [Export]
- [PartCreationPolicy(CreationPolicy.NonShared)]
- public class CycleNonSharedPart1
- {
- [Import]
- public CycleNonSharedPart2 NonSharedPart2 { get; set; }
- }
-
- [Export]
- [PartCreationPolicy(CreationPolicy.NonShared)]
- public class CycleNonSharedPart2
- {
- [Import]
- public CycleNonSharedPart1 NonSharedPart1 { get; set; }
- }
-
- [Export]
- public class CycleNonSharedPart
- {
- [Import]
- public CycleNonSharedPart1 NonSharedPart1 { get; set; }
- }
-
- [Export]
- public class CycleSharedPart1
- {
- [Import]
- public CycleSharedPart2 SharedPart2 { get; set; }
- }
-
- [Export]
- public class CycleSharedPart2
- {
- [Import]
- public CycleSharedPart1 SharedPart2 { get; set; }
- }
-
- [Export]
- public class CycleSharedPart
- {
- [Import]
- public CycleSharedPart1 SharedPart1 { get; set; }
-
- [Import]
- public CycleSharedPart2 SharedPart2 { get; set; }
- }
-
- [Export]
- [PartCreationPolicy(CreationPolicy.NonShared)]
- public class NoCycleNonSharedPart
- {
- [Import]
- public SharedPartWithNoCycleNonSharedPart SharedPart { get; set; }
- }
-
- [Export]
- public class SharedPartWithNoCycleNonSharedPart
- {
- [Import]
- public NoCycleNonSharedPart NonSharedPart { get; set; }
- }
-
- [Export]
- [PartCreationPolicy(CreationPolicy.NonShared)]
- public class CycleWithSharedPartAndNonSharedPart
- {
- [Import]
- public SharedPartWithNoCycleNonSharedPart BeforeNonSharedPart { get; set; }
-
- [Import]
- public CycleWithNonSharedPartOnly NonSharedPart { get; set; }
-
- [Import]
- public SharedPartWithNoCycleNonSharedPart SharedPart { get; set; }
- }
-
- [Export]
- [PartCreationPolicy(CreationPolicy.NonShared)]
- public class CycleWithNonSharedPartOnly
- {
- [Import]
- public CycleWithSharedPartAndNonSharedPart NonSharedPart { get; set; }
-
- }
-
- [InheritedExport]
- public class ExportWithGenericParameter<T>
- {
- }
-
- public class ExportWithGenericParameterOfInt
- {
- [Export]
- public ExportWithGenericParameter<int> GenericExport { get { return new ExportWithGenericParameter<int>(); } }
- }
-
- [Export]
- public static class StaticExportWithGenericParameter<T>
- {
- }
-
- [Export]
- public class ExportWhichInheritsFromGeneric : ExportWithGenericParameter<string>
- {
-
- }
-
- [Export]
- public class ExportWithExceptionDuringConstruction
- {
- public ExportWithExceptionDuringConstruction()
- {
- throw new NotImplementedException();
- }
- }
-
- [Export]
- public class SimpleConstructorInjectedObject
- {
- [ImportingConstructor]
- public SimpleConstructorInjectedObject([Import("CISimpleValue")]int value)
- {
- CISimpleValue = value;
- }
-
- public int CISimpleValue { get; private set; }
- }
-
- [Export]
- public class ClassWithNoMarkedOrDefaultConstructor
- {
- public ClassWithNoMarkedOrDefaultConstructor(int blah) { }
- }
-
- public class ClassWhichOnlyHasImportingConstructorWithOneArgument
- {
- [ImportingConstructor]
- public ClassWhichOnlyHasImportingConstructorWithOneArgument(int blah) { }
- }
-
- public class ClassWhichOnlyHasImportingConstructor
- {
- [ImportingConstructor]
- public ClassWhichOnlyHasImportingConstructor() { }
- }
-
- public class ClassWhichOnlyHasDefaultConstructor
- {
- public ClassWhichOnlyHasDefaultConstructor() { }
- }
-
- [Export]
- public class BaseExportForImportingConstructors
- {
-
- }
-
- [Export]
- public class ClassWithOnlyHasImportingConstructorButInherits : BaseExportForImportingConstructors
- {
- [ImportingConstructor]
- public ClassWithOnlyHasImportingConstructorButInherits(int blah) { }
- }
-
- [Export]
- public class ClassWithOnlyHasMultipleImportingConstructorButInherits : BaseExportForImportingConstructors
- {
- [ImportingConstructor]
- public ClassWithOnlyHasMultipleImportingConstructorButInherits(int blah) { }
-
- [ImportingConstructor]
- public ClassWithOnlyHasMultipleImportingConstructorButInherits(string blah) { }
- }
-
-
- [Export]
- public class ClassWithMultipleMarkedConstructors
- {
- [ImportingConstructor]
- public ClassWithMultipleMarkedConstructors(int i) { }
-
- [ImportingConstructor]
- public ClassWithMultipleMarkedConstructors(string s) { }
-
- public ClassWithMultipleMarkedConstructors() { }
- }
-
- [Export]
- public class ClassWithOneMarkedAndOneDefaultConstructor
- {
- [ImportingConstructor]
- public ClassWithOneMarkedAndOneDefaultConstructor(int i) { }
-
- public ClassWithOneMarkedAndOneDefaultConstructor() { }
- }
-
- [Export]
- public class ClassWithTwoZeroParameterConstructors
- {
- public ClassWithTwoZeroParameterConstructors() { }
-
- static ClassWithTwoZeroParameterConstructors() { }
- }
-
- [Export]
- public class ExceptionDuringINotifyImport : IPartImportsSatisfiedNotification
- {
- [ImportMany("Value")]
- public IEnumerable<int> ValuesJustUsedToGetImportCompletedCalled { get; set; }
-
- public void OnImportsSatisfied()
- {
- throw new NotImplementedException();
- }
- }
-
- [Export]
- public class ClassWithOptionalPostImport
- {
- [Import(AllowDefault = true)]
- public IFormattable Formatter { get; set; }
- }
-
- [Export]
- public class ClassWithOptionalPreImport
- {
- [ImportingConstructor]
- public ClassWithOptionalPreImport([Import(AllowDefault = true)] IFormattable formatter)
- {
- this.Formatter = formatter;
- }
-
- public IFormattable Formatter { get; private set; }
- }
-
- [MetadataAttribute]
- public class ThisIsMyMetadataMetadataAttribute : Attribute
- {
- public string Argument1 { get; set; }
- public int Argument2 { get; set; }
- public double Argument3 { get; set; }
- public string Argument4 { get; set; }
-
- public ThisIsMyMetadataMetadataAttribute()
- {
- }
-
- public ThisIsMyMetadataMetadataAttribute(string Argument1, int Argument2)
- {
- this.Argument1 = Argument1;
- this.Argument2 = Argument2;
- }
- }
-
- [Export]
- [ThisIsMyMetadataMetadataAttribute("One", 2, Argument3 = 3.0)]
- public class ExportedTypeWithConcreteMetadata
- {
- }
-
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/UnitTesting/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/UnitTesting/.gitattributes deleted file mode 100644 index bc32a4e52dd..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/UnitTesting/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -/ConstraintAssert.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/UnitTesting/ConstraintAssert.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/UnitTesting/ConstraintAssert.cs deleted file mode 100644 index 1266032df50..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/UnitTesting/ConstraintAssert.cs +++ /dev/null @@ -1,37 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Linq.Expressions;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.UnitTesting
-{
- internal static class ConstraintAssert
- {
- public static void Contains(Expression<Func<ExportDefinition, bool>> constraint, string contractName)
- {
- Contains(constraint, contractName, Enumerable.Empty<KeyValuePair<string, Type>>());
- }
-
- public static void Contains(Expression<Func<ExportDefinition, bool>> constraint, string contractName, IEnumerable<KeyValuePair<string, Type>> requiredMetadata)
- {
- string actualContractName;
- IEnumerable<KeyValuePair<string, Type>> actualRequiredMetadata;
- bool success = TryParseConstraint(constraint, out actualContractName, out actualRequiredMetadata);
-
- Assert.IsTrue(success);
- Assert.AreEqual(contractName, actualContractName);
- EnumerableAssert.AreEqual(requiredMetadata, actualRequiredMetadata);
- }
-
- private static bool TryParseConstraint(Expression<Func<ExportDefinition, bool>> constraint, out string contractName, out IEnumerable<KeyValuePair<string, Type>> requiredMetadata)
- {
- return ContraintParser.TryParseConstraint(constraint, out contractName, out requiredMetadata);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/.gitattributes deleted file mode 100644 index 2b2b014d535..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/.gitattributes +++ /dev/null @@ -1,13 +0,0 @@ -/AdaptingCollectionTests.cs -crlf -/CatalogFilteringTests.cs -crlf -/CompositionContainerAttributedModelCycleTests.cs -crlf -/ConstructorInjectionTests.cs -crlf -/DelayLoadingTests.cs -crlf -/DelegateCompositionTests.cs -crlf -/DiscoveryTests.cs -crlf -/ExportProviderEventTests.cs -crlf -/LifetimeTests.cs -crlf -/PartCreatorTests.cs -crlf -/RecompositionTests.cs -crlf -/RejectionTests.cs -crlf -/RequiredCreationPolicyTests.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/AdaptingCollectionTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/AdaptingCollectionTests.cs deleted file mode 100644 index 442cfd59688..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/AdaptingCollectionTests.cs +++ /dev/null @@ -1,405 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Linq;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Factories;
-
-namespace System.ComponentModel.Composition
-{
- public class FilteringCollection<T, M> : AdaptingCollection<T, M>
- {
- public FilteringCollection(Func<Lazy<T, M>, bool> filter)
- : base(e => e.Where(filter))
- {
- }
- }
-
- public class OrderingCollection<T, M> : AdaptingCollection<T, M>
- {
- public OrderingCollection(Func<Lazy<T, M>, object> keySelector)
- : this(keySelector, false)
- {
- }
-
- public OrderingCollection(Func<Lazy<T, M>, object> keySelector, bool descending)
- : base(e => descending ? e.OrderByDescending(keySelector) : e.OrderBy(keySelector))
- {
- }
- }
-
- public class AdaptingCollection<T> : AdaptingCollection<T, IDictionary<string, object>>
- {
- public AdaptingCollection(Func<IEnumerable<Lazy<T, IDictionary<string, object>>>,
- IEnumerable<Lazy<T, IDictionary<string, object>>>> adaptor)
- : base(adaptor)
- {
- }
- }
-
- public class AdaptingCollection<T, M> : ICollection<Lazy<T, M>>, INotifyCollectionChanged
- {
- private readonly List<Lazy<T, M>> _allItems = new List<Lazy<T, M>>();
- private readonly Func<IEnumerable<Lazy<T, M>>, IEnumerable<Lazy<T, M>>> _adaptor = null;
- private List<Lazy<T, M>> _adaptedItems = null;
-
- public AdaptingCollection() : this(null)
- {
- }
-
- public AdaptingCollection(Func<IEnumerable<Lazy<T, M>>, IEnumerable<Lazy<T, M>>> adaptor)
- {
- this._adaptor = adaptor;
- }
-
- public event NotifyCollectionChangedEventHandler CollectionChanged;
-
- public void ReapplyAdaptor()
- {
- if (this._adaptedItems != null)
- {
- this._adaptedItems = null;
- this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
- }
- }
-
- protected virtual IEnumerable<Lazy<T, M>> Adapt(IEnumerable<Lazy<T, M>> collection)
- {
- if (this._adaptor != null)
- {
- return this._adaptor.Invoke(collection);
- }
-
- return collection;
- }
-
- protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
- {
- NotifyCollectionChangedEventHandler collectionChanged = this.CollectionChanged;
-
- if (collectionChanged != null)
- {
- collectionChanged.Invoke(this, e);
- }
- }
-
- private List<Lazy<T, M>> AdaptedItems
- {
- get
- {
- if (this._adaptedItems == null)
- {
- this._adaptedItems = Adapt(this._allItems).ToList();
- }
-
- return this._adaptedItems;
- }
- }
-
- #region ICollection Implementation
- // Accessors work directly against adapted collection
- public bool Contains(Lazy<T, M> item)
- {
- return this.AdaptedItems.Contains(item);
- }
-
- public void CopyTo(Lazy<T, M>[] array, int arrayIndex)
- {
- this.AdaptedItems.CopyTo(array, arrayIndex);
- }
-
- public int Count
- {
- get { return this.AdaptedItems.Count; }
- }
-
- public bool IsReadOnly
- {
- get { return false; }
- }
-
- public IEnumerator<Lazy<T, M>> GetEnumerator()
- {
- return this.AdaptedItems.GetEnumerator();
- }
-
- Collections.IEnumerator Collections.IEnumerable.GetEnumerator()
- {
- return this.GetEnumerator();
- }
-
- // Mutation methods work against complete collection
- // and then force a reset of the adapted collection
- public void Add(Lazy<T, M> item)
- {
- this._allItems.Add(item);
- ReapplyAdaptor();
- }
-
- public void Clear()
- {
- this._allItems.Clear();
- ReapplyAdaptor();
- }
-
- public bool Remove(Lazy<T, M> item)
- {
- bool removed = this._allItems.Remove(item);
- ReapplyAdaptor();
- return removed;
- }
- #endregion
- }
-
- [TestClass]
- public class AdaptingCollectionTests
- {
- public interface IContract { }
- public interface INetworkAwareMetadata
- {
- [DefaultValue(false)]
- bool RequiresOnline { get; }
- }
-
- [Export(typeof(IContract))]
- [ExportMetadata("RequiresOnline", true)]
- public class NetworkExport : IContract { }
-
- [Export(typeof(IContract))]
- public class NonNetworkExport : IContract { }
-
- public class FilterExports
- {
- public FilterExports()
- {
- this.OnlineOnly = new AdaptingCollection<IContract, INetworkAwareMetadata>(e =>
- e.Where(p => p.Metadata.RequiresOnline));
-
- this.OnlineOnly2 = new FilteringCollection<IContract, INetworkAwareMetadata>(p => p.Metadata.RequiresOnline);
- }
-
- [ImportMany]
- public AdaptingCollection<IContract, INetworkAwareMetadata> OnlineOnly { get; set; }
-
- [ImportMany]
- public FilteringCollection<IContract, INetworkAwareMetadata> OnlineOnly2 { get; set; }
- }
-
- [TestMethod]
- public void TestFilteringImports()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(NetworkExport), typeof(NonNetworkExport));
-
- var filterExports = new FilterExports();
- container.ComposeParts(filterExports);
-
- Assert.AreEqual(1, filterExports.OnlineOnly.Count);
- Assert.AreEqual(1, filterExports.OnlineOnly2.Count);
- }
-
- public interface IOrderMetadata
- {
- [DefaultValue(Int32.MaxValue)]
- int Order { get; }
- }
-
- [Export(typeof(IContract))]
- [ExportMetadata("Order", 2)]
- public class BExport : IContract { }
-
- [Export(typeof(IContract))]
- [ExportMetadata("Order", 1)]
- public class AExport : IContract { }
-
- [Export(typeof(IContract))]
- public class CExport : IContract { }
-
- public class OrderExportsByMetadata
- {
- public OrderExportsByMetadata()
- {
- this.OrderedItems = new AdaptingCollection<IContract, IOrderMetadata>(e =>
- e.OrderBy(p => p.Metadata.Order));
-
- this.OrderedItems2 = new OrderingCollection<IContract, IOrderMetadata>(p => p.Metadata.Order);
- }
-
- [ImportMany]
- public AdaptingCollection<IContract, IOrderMetadata> OrderedItems { get; set; }
-
- [ImportMany]
- public OrderingCollection<IContract, IOrderMetadata> OrderedItems2 { get; set; }
- }
-
- [TestMethod]
- public void TestOrderingImportsByMetadata()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(BExport), typeof(AExport), typeof(CExport));
- var orderExports = new OrderExportsByMetadata();
-
- container.ComposeParts(orderExports);
-
- Assert.IsInstanceOfType(orderExports.OrderedItems.ElementAt(0).Value, typeof(AExport));
- Assert.IsInstanceOfType(orderExports.OrderedItems.ElementAt(1).Value, typeof(BExport));
- Assert.IsInstanceOfType(orderExports.OrderedItems.ElementAt(2).Value, typeof(CExport));
-
- Assert.IsInstanceOfType(orderExports.OrderedItems2.ElementAt(0).Value, typeof(AExport));
- Assert.IsInstanceOfType(orderExports.OrderedItems2.ElementAt(1).Value, typeof(BExport));
- Assert.IsInstanceOfType(orderExports.OrderedItems2.ElementAt(2).Value, typeof(CExport));
- }
-
- public class OrderExportsByName
- {
- public OrderExportsByName(bool descending)
- {
- if (descending)
- {
- this.OrderedItems = new AdaptingCollection<IContract>(e =>
- e.OrderByDescending(p => p.Value.GetType().FullName));
- }
- else
- {
- this.OrderedItems = new AdaptingCollection<IContract>(e =>
- e.OrderBy(p => p.Value.GetType().FullName));
- }
- }
-
- [ImportMany]
- public AdaptingCollection<IContract> OrderedItems { get; set; }
- }
-
-
- [TestMethod]
- public void TestOrderingImportsByTypeName()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(BExport), typeof(AExport), typeof(CExport));
- var orderExports = new OrderExportsByName(false);
-
- container.ComposeParts(orderExports);
-
- Assert.IsInstanceOfType(orderExports.OrderedItems.ElementAt(0).Value, typeof(AExport));
- Assert.IsInstanceOfType(orderExports.OrderedItems.ElementAt(1).Value, typeof(BExport));
- Assert.IsInstanceOfType(orderExports.OrderedItems.ElementAt(2).Value, typeof(CExport));
-
- orderExports = new OrderExportsByName(true);
-
- container.ComposeParts(orderExports);
-
- Assert.IsInstanceOfType(orderExports.OrderedItems.ElementAt(0).Value, typeof(CExport));
- Assert.IsInstanceOfType(orderExports.OrderedItems.ElementAt(1).Value, typeof(BExport));
- Assert.IsInstanceOfType(orderExports.OrderedItems.ElementAt(2).Value, typeof(AExport));
- }
-
- public interface IDynamicFilteredMetadata
- {
- bool Dynamic { get; }
- }
-
- [Export(typeof(IContract))]
- [ExportMetadata("Dynamic", true)]
- public class Dynamic1 : IContract { }
-
- [Export(typeof(IContract))]
- [ExportMetadata("Dynamic", true)]
- public class Dynamic2 : IContract { }
-
- [Export(typeof(IContract))]
- [ExportMetadata("Dynamic", false)]
- public class NonDynamic1 : IContract { }
-
- public class DynamicFilteredCollection<T, M> : AdaptingCollection<T, M> where M : IDynamicFilteredMetadata
- {
- public DynamicFilteredCollection()
- {
- }
-
- private bool _includeDynamic = false;
- public bool IncludeDynamic
- {
- get { return this._includeDynamic; }
- set
- {
- if (this._includeDynamic != value)
- {
- this.ReapplyAdaptor();
- }
-
- this._includeDynamic = value;
- }
- }
-
- protected override IEnumerable<Lazy<T, M>> Adapt(IEnumerable<Lazy<T, M>> collection)
- {
- return collection.Where(p => !p.Metadata.Dynamic || IncludeDynamic);
- }
- }
-
- public class DynamicExports
- {
- [ImportMany]
- public DynamicFilteredCollection<IContract, IDynamicFilteredMetadata> DynamicCollection { get; set; }
- }
-
- [TestMethod]
- public void TestDyamicallyFilteringImports()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(Dynamic1), typeof(Dynamic2), typeof(NonDynamic1));
- var dynamicExports = new DynamicExports();
-
- container.ComposeParts(dynamicExports);
-
- Assert.AreEqual(1, dynamicExports.DynamicCollection.Count);
-
- dynamicExports.DynamicCollection.IncludeDynamic = true;
-
- Assert.AreEqual(3, dynamicExports.DynamicCollection.Count);
- }
-
- public class DynamicExportsNoSubType
- {
- public DynamicExportsNoSubType()
- {
- this.DynamicCollection = new AdaptingCollection<IContract, IDynamicFilteredMetadata>(e =>
- e.Where(p => !p.Metadata.Dynamic || this.IncludeDynamic));
- }
-
- private bool _includeDynamic = false;
- public bool IncludeDynamic
- {
- get { return this._includeDynamic; }
- set
- {
- if (this._includeDynamic != value)
- {
- this.DynamicCollection.ReapplyAdaptor();
- }
-
- this._includeDynamic = value;
- }
- }
-
- [ImportMany]
- public AdaptingCollection<IContract, IDynamicFilteredMetadata> DynamicCollection { get; set; }
- }
-
- [TestMethod]
- public void TestDyamicallyFilteringNoSubTypeImports()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(Dynamic1), typeof(Dynamic2), typeof(NonDynamic1));
- var dynamicExports = new DynamicExportsNoSubType();
-
- container.ComposeParts(dynamicExports);
-
- Assert.AreEqual(1, dynamicExports.DynamicCollection.Count);
-
- dynamicExports.IncludeDynamic = true;
-
- Assert.AreEqual(3, dynamicExports.DynamicCollection.Count);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/CatalogFilteringTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/CatalogFilteringTests.cs deleted file mode 100644 index 0b11315804f..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/CatalogFilteringTests.cs +++ /dev/null @@ -1,129 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class CatalogFilteringTests
- {
- [TestMethod]
- public void FilteredCatalog_ScopeA()
- {
- var cat = GetCatalog();
- var contA = new CompositionContainer(ScopeCatalog(cat, "A"));
-
- Assert.IsTrue(contA.IsPresent<ScopeAComponent1>());
- Assert.IsTrue(contA.IsPresent<ScopeAComponent2>());
- Assert.IsFalse(contA.IsPresent<ScopeBComponent>());
- Assert.IsFalse(contA.IsPresent<ScopeCComponent>());
- }
-
- [TestMethod]
- public void FilteredCatalog_ScopeB()
- {
- var cat = GetCatalog();
- var contA = new CompositionContainer(ScopeCatalog(cat, "A"));
- var contB = new CompositionContainer(ScopeCatalog(cat, "B"), contA);
-
- Assert.IsTrue(contB.IsPresent<ScopeAComponent1>());
- Assert.IsTrue(contB.IsPresent<ScopeAComponent2>());
- Assert.IsTrue(contB.IsPresent<ScopeBComponent>());
- Assert.IsFalse(contB.IsPresent<ScopeCComponent>());
- }
-
- [TestMethod]
- public void FilteredCatalog_ScopeC()
- {
- var cat = GetCatalog();
- var contA = new CompositionContainer(ScopeCatalog(cat, "A"));
- var contB = new CompositionContainer(ScopeCatalog(cat, "B"), contA);
- var contC = new CompositionContainer(ScopeCatalog(cat, "C"), contB);
-
- Assert.IsTrue(contC.IsPresent<ScopeAComponent1>());
- Assert.IsTrue(contC.IsPresent<ScopeAComponent2>());
- Assert.IsTrue(contC.IsPresent<ScopeBComponent>());
- Assert.IsTrue(contC.IsPresent<ScopeCComponent>());
- }
-
- [TestMethod]
- [Ignore]
- [WorkItem(812029)]
- public void FilteredCatalog_EventsFired()
- {
- var aggCatalog = CatalogFactory.CreateAggregateCatalog();
- var cat1 = CatalogFactory.CreateAttributed(typeof(ScopeAComponent1), typeof(ScopeBComponent));
-
- var filteredCatalog = CatalogFactory.CreateFiltered(aggCatalog,
- partDef => partDef.Metadata.ContainsKey("Scope") &&
- partDef.Metadata["Scope"].ToString() == "A");
-
- var container = ContainerFactory.Create(filteredCatalog);
-
- Assert.IsFalse(container.IsPresent<ScopeAComponent1>(), "sa before add");
- Assert.IsFalse(container.IsPresent<ScopeBComponent>(), "sb before add");
-
- aggCatalog.Catalogs.Add(cat1);
-
- Assert.IsTrue(container.IsPresent<ScopeAComponent1>(), "sa after add");
- Assert.IsFalse(container.IsPresent<ScopeBComponent>(), "sb after add");
-
- aggCatalog.Catalogs.Remove(cat1);
-
- Assert.IsFalse(container.IsPresent<ScopeAComponent1>(), "sa after remove");
- Assert.IsFalse(container.IsPresent<ScopeBComponent>(), "sb after remove");
- }
-
- private ComposablePartCatalog GetCatalog()
- {
- return CatalogFactory.CreateAttributed(
- typeof(ScopeAComponent1),
- typeof(ScopeAComponent2),
- typeof(ScopeBComponent),
- typeof(ScopeCComponent));
- }
-
- private ComposablePartCatalog ScopeCatalog(ComposablePartCatalog catalog, string scope)
- {
- return CatalogFactory.CreateFiltered(catalog,
- partDef => partDef.Metadata.ContainsKey("Scope") &&
- partDef.Metadata["Scope"].ToString() == scope);
- }
-
- [Export]
- [PartMetadata("Scope", "A")]
- public class ScopeAComponent1
- {
- }
-
- [Export]
- [PartMetadata("Scope", "A")]
- public class ScopeAComponent2
- {
- [Import]
- public ScopeAComponent1 ScopeA { get; set; }
- }
-
- [Export]
- [PartMetadata("Scope", "B")]
- public class ScopeBComponent
- {
- [Import]
- public ScopeAComponent1 ScopeA { get; set; }
- }
-
- [Export]
- [PartMetadata("Scope", "C")]
- public class ScopeCComponent
- {
- [Import]
- public ScopeBComponent ScopeB { get; set; }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/CompositionContainerAttributedModelCycleTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/CompositionContainerAttributedModelCycleTests.cs deleted file mode 100644 index 952ef533ff2..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/CompositionContainerAttributedModelCycleTests.cs +++ /dev/null @@ -1,274 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Linq;
-using System.ComponentModel.Composition;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.UnitTesting;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Primitives;
-
-namespace Tests.Integration
-{
- [TestClass]
- public class CompositionContainerAttributedModelCycleTests
- {
- // There are nine possible scenarios that cause a part to have a dependency on another part, some of which
- // are legal and some not. For example, below, is not legal for a part, A, to have a prerequisite dependency
- // on a part, B, which has also has a prerequisite dependency on A. In contrast, however, it is legal for
- // part A and B to have a non-prerequisite (Post) dependency on each other.
- //
- // ------------------------------
- // | | B |
- // | | Pre | Post | None |
- // |--------|-----|------|------|
- // | Pre | X | X | √ |
- // | A Post | X | √ | √ |
- // | None | √ | √ | √ |
- // ------------------------------
- //
-
- [TestMethod]
- public void APrerequisiteDependsOnBPrerequisite_ShouldThrowComposition()
- {
- AssertCycle(typeof(APrerequisiteDependsOnBPrerequisite),
- typeof(BPrerequisiteDependsOnAPrerequisite));
- }
-
- [TestMethod]
- public void APrerequisiteDependsOnBPost_ShouldThrowComposition()
- {
- AssertCycle(typeof(APrerequisiteDependsOnBPost),
- typeof(BPostDependsOnAPrerequisite));
- }
-
- [TestMethod]
- public void APrerequisiteDependsOnBNone_ShouldNotThrow()
- {
- AssertNotCycle(typeof(APrerequisiteDependsOnBNone),
- typeof(BNone));
- }
-
- [TestMethod]
- public void APostDependsOnBPrerequisite_ShouldThrowComposition()
- {
- AssertCycle(typeof(APostDependsOnBPrerequisite),
- typeof(BPrerequisiteDependsOnAPost));
- }
-
- [TestMethod]
- public void APostDependsOnBPost_ShouldNotThrow()
- {
- AssertNotCycle(typeof(APostDependsOnBPost),
- typeof(BPostDependsOnAPost));
- }
-
- [TestMethod]
- public void APostDependsOnBNone_ShouldNotThrow()
- {
- AssertNotCycle(typeof(APostDependsOnBNone),
- typeof(BNone));
- }
-
- [TestMethod]
- public void BPrerequisiteDependsOnANone_ShouldNotThrow()
- {
- AssertNotCycle(typeof(ANone),
- typeof(BPrerequisiteDependsOnANone));
- }
-
- [TestMethod]
- public void BPostDependsOnANone_ShouldNotThrow()
- {
- AssertNotCycle(typeof(ANone),
- typeof(BPostDependsOnANone));
- }
-
- [TestMethod]
- public void ANoneWithBNone_ShouldNotThrow()
- {
- AssertNotCycle(typeof(ANone),
- typeof(BNone));
- }
-
- [TestMethod]
- public void PartWithHasPrerequisteImportThatIsInAPostCycle_ShouldNotThrow()
- {
- AssertNotCycle(typeof(PartWithHasPrerequisteImportThatIsInAPostCycle)
- , typeof(APostDependsOnBPost), typeof(BPostDependsOnAPost));
- }
-
- private static void AssertCycle(params Type[] types)
- {
- foreach (Type type in types)
- {
- var export = GetExport(type, types);
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotGetExportedValue, () =>
- {
- var value = export.Value;
- });
- }
- }
-
- private static void AssertNotCycle(params Type[] types)
- {
- foreach (Type type in types)
- {
- var export = GetExport(type, types);
-
- Assert.IsInstanceOfType(export.Value, type);
- }
- }
-
- private static Lazy<object, object> GetExport(Type type, Type[] partTypes)
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(partTypes);
-
- return container.GetExports(type, null, null).Single();
- }
-
- [Export]
- public class APrerequisiteDependsOnBPrerequisite
- {
- [ImportingConstructor]
- public APrerequisiteDependsOnBPrerequisite(BPrerequisiteDependsOnAPrerequisite b)
- {
- }
- }
-
- [Export]
- public class BPrerequisiteDependsOnAPrerequisite
- {
- [ImportingConstructor]
- public BPrerequisiteDependsOnAPrerequisite(APrerequisiteDependsOnBPrerequisite a)
- {
- }
- }
-
-
- [Export]
- public class APrerequisiteDependsOnBPost
- {
- [ImportingConstructor]
- public APrerequisiteDependsOnBPost(BPostDependsOnAPrerequisite b)
- {
- }
- }
-
- [Export]
- public class BPostDependsOnAPrerequisite
- {
- [Import]
- public APrerequisiteDependsOnBPost A
- {
- get;
- set;
- }
- }
-
- [Export]
- public class APrerequisiteDependsOnBNone
- {
- [ImportingConstructor]
- public APrerequisiteDependsOnBNone(BNone b)
- {
- }
- }
-
- [Export]
- public class BNone
- {
- }
-
-
- [Export]
- public class ANone
- {
- }
-
- [Export]
- public class APostDependsOnBPrerequisite
- {
- [Import]
- public BPrerequisiteDependsOnAPost B
- {
- get;
- set;
- }
- }
-
- [Export]
- public class BPrerequisiteDependsOnAPost
- {
- [ImportingConstructor]
- public BPrerequisiteDependsOnAPost(APostDependsOnBPrerequisite a)
- {
- }
- }
-
-
- [Export]
- public class APostDependsOnBPost
- {
- [Import]
- public BPostDependsOnAPost B
- {
- get;
- set;
- }
- }
-
- [Export]
- public class BPostDependsOnAPost
- {
- [Import]
- public APostDependsOnBPost A
- {
- get;
- set;
- }
- }
-
- [Export]
- public class APostDependsOnBNone
- {
- [Import]
- public BNone B
- {
- get;
- set;
- }
- }
-
- [Export]
- public class BPrerequisiteDependsOnANone
- {
- [ImportingConstructor]
- public BPrerequisiteDependsOnANone(ANone a)
- {
- }
- }
-
- [Export]
- public class BPostDependsOnANone
- {
- [Import]
- public ANone A
- {
- get;
- set;
- }
- }
-
- [Export]
- public class PartWithHasPrerequisteImportThatIsInAPostCycle
- {
- [ImportingConstructor]
- public PartWithHasPrerequisteImportThatIsInAPostCycle(APostDependsOnBPost a)
- {
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/ConstructorInjectionTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/ConstructorInjectionTests.cs deleted file mode 100644 index 099347e0fee..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/ConstructorInjectionTests.cs +++ /dev/null @@ -1,191 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.UnitTesting;
-using System.UnitTesting;
-using System.ComponentModel.Composition.AttributedModel;
-using System.ComponentModel.Composition.Hosting;
-
-namespace Tests.Integration
-{
- [TestClass]
- public class ConstructorInjectionTests
- {
- [TestMethod]
- public void SimpleConstructorInjection()
- {
- var container = ContainerFactory.Create();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(PartFactory.CreateAttributed(typeof(SimpleConstructorInjectedObject)));
- batch.AddExportedValue("CISimpleValue", 42);
- container.Compose(batch);
-
- SimpleConstructorInjectedObject simple = container.GetExportedValue<SimpleConstructorInjectedObject>();
-
- Assert.AreEqual(42, simple.CISimpleValue);
- }
-
- public interface IOptionalRef { }
-
- [Export]
- public class OptionalExportProvided { }
-
- [Export]
- public class AWithOptionalParameter
- {
- [ImportingConstructor]
- public AWithOptionalParameter([Import(AllowDefault = true)]IOptionalRef import,
- [Import("ContractThatShouldNotBeFound", AllowDefault = true)]int value,
- [Import(AllowDefault=true)]OptionalExportProvided provided)
- {
- Assert.IsNull(import);
- Assert.AreEqual(0, value);
- Assert.IsNotNull(provided);
- }
- }
-
- [TestMethod]
- public void OptionalConstructorArgument()
- {
- var container = GetContainerWithCatalog();
- var a = container.GetExportedValue<AWithOptionalParameter>();
-
- // A should verify that it receieved optional arugments properly
- Assert.IsNotNull(a);
- }
-
- [Export]
- public class AWithCollectionArgument
- {
- private IEnumerable<int> _values;
-
- [ImportingConstructor]
- public AWithCollectionArgument([ImportMany("MyConstructorCollectionItem")]IEnumerable<int> values)
- {
- this._values = values;
- }
-
- public IEnumerable<int> Values { get { return this._values; } }
- }
-
- [TestMethod]
- public void RebindingShouldNotHappenForConstructorArguments()
- {
- var container = GetContainerWithCatalog();
- CompositionBatch batch = new CompositionBatch();
-
- var p1 = batch.AddExportedValue("MyConstructorCollectionItem", 1);
- batch.AddExportedValue("MyConstructorCollectionItem", 2);
- batch.AddExportedValue("MyConstructorCollectionItem", 3);
- container.Compose(batch);
-
- var a = container.GetExportedValue<AWithCollectionArgument>();
-
- EnumerableAssert.AreEqual(a.Values, 1, 2, 3);
-
- batch = new CompositionBatch();
- batch.AddExportedValue("MyConstructorCollectionItem", 4);
- batch.AddExportedValue("MyConstructorCollectionItem", 5);
- batch.AddExportedValue("MyConstructorCollectionItem", 6);
- // After rejection changes that are incompatible with existing assumptions are no
- // longer silently ignored. The batch attempting to make this change is rejected
- // with a ChangeRejectedException
- CompositionAssert.ThrowsChangeRejectedError(ErrorId.ImportEngine_PreventedByExistingImport,() =>
- {
- container.Compose(batch);
- });
-
- // The collection which is a constructor import should not be rebound
- EnumerableAssert.AreEqual(a.Values, 1, 2, 3);
-
- batch.RemovePart(p1);
- // After rejection changes that are incompatible with existing assumptions are no
- // longer silently ignored. The batch attempting to make this change is rejected
- // with a ChangeRejectedException
- CompositionAssert.ThrowsChangeRejectedError(ErrorId.ImportEngine_PreventedByExistingImport, () =>
- {
- container.Compose(batch);
- });
-
- // The collection which is a constructor import should not be rebound
- EnumerableAssert.AreEqual(a.Values, 1, 2, 3);
- }
-
- [TestMethod]
- public void MissingConstructorArgsWithAlreadyCreatedInstance()
- {
- var container = GetContainerWithCatalog();
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(new ClassWithNotFoundConstructorArgs(21));
- container.Compose(batch);
- }
-
- [TestMethod]
- public void MissingConstructorArgsWithTypeFromCatalogMissingArg()
- {
- var container = GetContainerWithCatalog();
-
- // After rejection part definitions in catalogs whose dependencies cannot be
- // satisfied are now silently ignored, turning this into a cardinality
- // exception for the GetExportedValue call
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- {
- container.GetExportedValue<ClassWithNotFoundConstructorArgs>();
- });
- }
-
- [TestMethod]
- public void MissingConstructorArgsWithWithTypeFromCatalogWithArg()
- {
- var container = GetContainerWithCatalog();
- CompositionBatch batch = new CompositionBatch();
- batch.AddExportedValue("ContractThatDoesntExist", 21);
- container.Compose(batch);
-
- Assert.IsTrue(container.IsPresent<ClassWithNotFoundConstructorArgs>());
- }
-
- [Export]
- public class ClassWithNotFoundConstructorArgs
- {
- [ImportingConstructor]
- public ClassWithNotFoundConstructorArgs([Import("ContractThatDoesntExist")]int i)
- {
- }
- }
-
- private CompositionContainer GetContainerWithCatalog()
- {
- var catalog = new AssemblyCatalog(typeof(ConstructorInjectionTests).Assembly);
-
- return new CompositionContainer(catalog);
- }
-
- [Export]
- public class InvalidImportManyCI
- {
- [ImportingConstructor]
- public InvalidImportManyCI(
- [ImportMany]List<MyExport> exports)
- {
- }
- }
-
- [TestMethod]
- public void ImportMany_ConstructorParameter_OnNonAssiganbleType_ShouldThrowCompositionException()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(InvalidImportManyCI));
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotGetExportedValue,
- ErrorId.ImportEngine_PartCannotActivate,
- ErrorId.ReflectionModel_ImportManyOnParameterCanOnlyBeAssigned,
- () => container.GetExportedValue<InvalidImportManyCI>());
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/DelayLoadingTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/DelayLoadingTests.cs deleted file mode 100644 index 24afb6731be..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/DelayLoadingTests.cs +++ /dev/null @@ -1,309 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.UnitTesting;
-using System.UnitTesting;
-using System.ComponentModel.Composition.AttributedModel;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Linq;
-using System.ComponentModel.Composition.ReflectionModel;
-using Microsoft.Internal;
-
-namespace Tests.Integration
-{
- [TestClass]
- public class DelayLoadingTests
- {
- [TestMethod]
- public void PartTypeLoadedLazily()
- {
- var catalog = new TypeLoadNotifyingCatalog(typeof(ExportingPart));
- var container = new CompositionContainer(catalog);
- catalog.AssertNotLoaded(typeof(ExportingPart));
- Assert.AreEqual(0, catalog.LoadedTypes.Count());
-
- Lazy<IExporter> lazyContract = container.GetExport<IExporter>();
- Assert.IsNotNull(lazyContract);
- catalog.AssertNotLoaded(typeof(ExportingPart));
- Assert.AreEqual(0, catalog.LoadedTypes.Count());
-
- IExporter value = lazyContract.Value;
-
- catalog.AssertLoaded(typeof(ExportingPart));
- Assert.AreEqual(1, catalog.LoadedTypes.Count());
- }
-
- [TestMethod]
- public void PartTypeLoadedLazilyEagerDependeciesLoadEagerly()
- {
- var catalog = new TypeLoadNotifyingCatalog(typeof(ExportingPart), typeof(PartImportingEagerly));
- var container = new CompositionContainer(catalog);
- catalog.AssertNotLoaded(typeof(ExportingPart));
- catalog.AssertNotLoaded(typeof(PartImportingEagerly));
- Assert.AreEqual(0, catalog.LoadedTypes.Count());
-
- Lazy<IImporter> lazyContract = container.GetExport<IImporter>();
- Assert.IsNotNull(lazyContract);
- catalog.AssertNotLoaded(typeof(PartImportingEagerly));
- catalog.AssertNotLoaded(typeof(ExportingPart));
- Assert.AreEqual(0, catalog.LoadedTypes.Count());
-
- IImporter value = lazyContract.Value;
- catalog.AssertLoaded(typeof(PartImportingEagerly));
- catalog.AssertLoaded(typeof(ExportingPart));
- Assert.AreEqual(2, catalog.LoadedTypes.Count());
- }
-
- [TestMethod]
- public void PartTypeLoadedLazilyLazyDependeciesLoadLazily()
- {
- var catalog = new TypeLoadNotifyingCatalog(typeof(ExportingPart), typeof(PartImportingLazily));
- var container = new CompositionContainer(catalog);
- catalog.AssertNotLoaded(typeof(ExportingPart));
- catalog.AssertNotLoaded(typeof(PartImportingLazily));
- Assert.AreEqual(0, catalog.LoadedTypes.Count());
-
- Lazy<IImporter> lazyContract = container.GetExport<IImporter>();
- Assert.IsNotNull(lazyContract);
- catalog.AssertNotLoaded(typeof(PartImportingLazily));
- catalog.AssertNotLoaded(typeof(ExportingPart));
- Assert.AreEqual(0, catalog.LoadedTypes.Count());
-
- IImporter value = lazyContract.Value;
- catalog.AssertLoaded(typeof(PartImportingLazily));
- catalog.AssertNotLoaded(typeof(ExportingPart));
- Assert.AreEqual(1, catalog.LoadedTypes.Count());
- }
-
- [TestMethod]
- public void PartTypeLoadedLazilyEagerCollectionDependeciesLoadEagerly()
- {
- var catalog = new TypeLoadNotifyingCatalog(typeof(ExportingPart), typeof(PartImportingCollectionEagerly));
- var container = new CompositionContainer(catalog);
- catalog.AssertNotLoaded(typeof(ExportingPart));
- catalog.AssertNotLoaded(typeof(PartImportingCollectionEagerly));
- Assert.AreEqual(0, catalog.LoadedTypes.Count());
-
- Lazy<IImporter> lazyContract = container.GetExport<IImporter>();
- Assert.IsNotNull(lazyContract);
- catalog.AssertNotLoaded(typeof(PartImportingCollectionEagerly));
- catalog.AssertNotLoaded(typeof(ExportingPart));
- Assert.AreEqual(0, catalog.LoadedTypes.Count());
-
- IImporter value = lazyContract.Value;
- catalog.AssertLoaded(typeof(PartImportingCollectionEagerly));
- catalog.AssertLoaded(typeof(ExportingPart));
- Assert.AreEqual(2, catalog.LoadedTypes.Count());
- }
-
- [TestMethod]
- public void PartTypeLoadedLazilyLazyCollectionDependeciesLoadLazily()
- {
- var catalog = new TypeLoadNotifyingCatalog(typeof(ExportingPart), typeof(PartImportingCollectionLazily));
- var container = new CompositionContainer(catalog);
- catalog.AssertNotLoaded(typeof(ExportingPart));
- catalog.AssertNotLoaded(typeof(PartImportingCollectionLazily));
- Assert.AreEqual(0, catalog.LoadedTypes.Count());
-
- Lazy<IImporter> lazyContract = container.GetExport<IImporter>();
- Assert.IsNotNull(lazyContract);
- catalog.AssertNotLoaded(typeof(PartImportingCollectionLazily));
- catalog.AssertNotLoaded(typeof(ExportingPart));
- Assert.AreEqual(0, catalog.LoadedTypes.Count());
-
- IImporter value = lazyContract.Value;
- catalog.AssertLoaded(typeof(PartImportingCollectionLazily));
- catalog.AssertNotLoaded(typeof(ExportingPart));
- Assert.AreEqual(1, catalog.LoadedTypes.Count());
- }
-
-
- [TestMethod]
- public void PartTypeLoadedLazilyLazyLoopLoadsLazily()
- {
- var catalog = new TypeLoadNotifyingCatalog(typeof(LazyLoopImporter), typeof(LazyLoopExporter));
- var container = new CompositionContainer(catalog);
- catalog.AssertNotLoaded(typeof(LazyLoopImporter));
- catalog.AssertNotLoaded(typeof(LazyLoopExporter));
- Assert.AreEqual(0, catalog.LoadedTypes.Count());
-
- Lazy<IImporter> lazyContract = container.GetExport<IImporter>();
- Assert.IsNotNull(lazyContract);
- catalog.AssertNotLoaded(typeof(LazyLoopImporter));
- catalog.AssertNotLoaded(typeof(LazyLoopExporter));
- Assert.AreEqual(0, catalog.LoadedTypes.Count());
-
- IImporter value = lazyContract.Value;
- catalog.AssertLoaded(typeof(LazyLoopImporter));
- catalog.AssertNotLoaded(typeof(LazyLoopExporter));
- Assert.AreEqual(1, catalog.LoadedTypes.Count());
- }
-
- public class IExporter
- {
- }
-
- public class IImporter
- {
- }
-
- [Export(typeof(IExporter))]
- public class ExportingPart : IExporter
- {
- }
-
- [Export(typeof(IImporter))]
- public class PartImportingLazily : IImporter
- {
- [Import]
- public Lazy<IExporter> Exporter { get; set; }
- }
-
- [Export(typeof(IImporter))]
- public class PartImportingCollectionLazily : IImporter
- {
- [ImportMany]
- public IEnumerable<Lazy<IExporter>> Exporters { get; set; }
- }
-
- [Export(typeof(IImporter))]
- public class PartImportingEagerly : IImporter
- {
- [Import]
- public IExporter Exporter { get; set; }
- }
-
- [Export(typeof(IImporter))]
- public class PartImportingCollectionEagerly : IImporter
- {
- [ImportMany]
- public IEnumerable<IExporter> Exporters { get; set; }
- }
-
-
- [Export(typeof(IImporter))]
- public class LazyLoopImporter : IImporter
- {
- [Import]
- public Lazy<IExporter> Exporter { get; set; }
- }
-
- [Export(typeof(IExporter))]
- public class LazyLoopExporter : IExporter
- {
- [Import]
- public Lazy<IImporter> Importer { get; set; }
- }
-
-
- private class TypeLoadNotifyingCatalog : ComposablePartCatalog
- {
- ComposablePartDefinition[] _definitions;
- public HashSet<Type> LoadedTypes { get; private set; }
-
- public TypeLoadNotifyingCatalog(params Type[] types)
- {
- this._definitions = types.Select(type => this.CreatePartDefinition(type)).ToArray();
- this.LoadedTypes = new HashSet<Type>();
- }
-
- public override IQueryable<ComposablePartDefinition> Parts
- {
- get { return this._definitions.AsQueryable(); }
- }
-
- private ComposablePartDefinition CreatePartDefinition(Type type)
- {
- ComposablePartDefinition partDefinition = AttributedModelServices.CreatePartDefinition(type, null);
- return this.CreateWrapped(partDefinition, type);
- }
-
- private ComposablePartDefinition CreateWrapped(ComposablePartDefinition partDefinition, Type type)
- {
- IEnumerable<ExportDefinition> exports = partDefinition.ExportDefinitions.Select(e => this.CreateWrapped(e, type)).ToArray();
- IEnumerable<ImportDefinition> imports = partDefinition.ImportDefinitions.Cast<ContractBasedImportDefinition>().Select(i => this.CreateWrapped(i, type)).ToArray();
-
- return ReflectionModelServices.CreatePartDefinition(
- this.CreateWrapped(ReflectionModelServices.GetPartType(partDefinition), type),
- ReflectionModelServices.IsDisposalRequired(partDefinition),
- imports.AsLazy(),
- exports.AsLazy(),
- partDefinition.Metadata.AsLazy(),
- null);
- }
-
- private Lazy<T> CreateWrapped<T>(Lazy<T> lazy, Type type)
- {
- return new Lazy<T>(
- () => { this.OnTypeLoaded(type); return lazy.Value; });
- }
-
- private LazyMemberInfo CreateWrapped(LazyMemberInfo lazyMember, Type type)
- {
- return new LazyMemberInfo(
- lazyMember.MemberType,
- () => { this.OnTypeLoaded(type); return lazyMember.GetAccessors(); });
- }
-
- private ExportDefinition CreateWrapped(ExportDefinition export, Type type)
- {
- return ReflectionModelServices.CreateExportDefinition(
- this.CreateWrapped(ReflectionModelServices.GetExportingMember(export), type),
- export.ContractName,
- export.Metadata.AsLazy(),
- null);
- }
-
- private ImportDefinition CreateWrapped(ContractBasedImportDefinition import, Type type)
- {
- if (ReflectionModelServices.IsImportingParameter(import))
- {
- return ReflectionModelServices.CreateImportDefinition(
- this.CreateWrapped(ReflectionModelServices.GetImportingParameter(import), type),
- import.ContractName,
- import.RequiredTypeIdentity,
- import.RequiredMetadata,
- import.Cardinality,
- import.RequiredCreationPolicy,
- null);
- }
- else
- {
- return ReflectionModelServices.CreateImportDefinition(
- this.CreateWrapped(ReflectionModelServices.GetImportingMember(import), type),
- import.ContractName,
- import.RequiredTypeIdentity,
- import.RequiredMetadata,
- import.Cardinality,
- import.IsRecomposable,
- import.RequiredCreationPolicy,
- null);
- }
- }
-
-
-
- private void OnTypeLoaded(Type type)
- {
- this.LoadedTypes.Add(type);
- }
-
- public void AssertLoaded(Type type)
- {
- Assert.IsTrue(this.LoadedTypes.Contains(type));
- }
-
- public void AssertNotLoaded(Type type)
- {
- Assert.IsFalse(this.LoadedTypes.Contains(type));
- }
-
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/DelegateCompositionTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/DelegateCompositionTests.cs deleted file mode 100644 index d775424f592..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/DelegateCompositionTests.cs +++ /dev/null @@ -1,287 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Linq;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace Tests.Integration
-{
- [TestClass]
- public class DelegateCompositionTests
- {
- public delegate int SimpleDelegate();
- public delegate object DoWorkDelegate(int i, ref object o, out string s);
-
- public class MethodExporter
- {
- [Export]
- public int SimpleMethod()
- {
- return 1;
- }
-
- [Export(typeof(DoWorkDelegate))]
- public object DoWork(int i, ref object o, out string s)
- {
- s = "";
- return o;
- }
-
- [Export("ActionWith8Arguments")]
- [Export("ActionWith8Arguments", typeof(Delegate))]
- public void Action(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8)
- {
- }
-
- [Export("FunctionWith8Arguments")]
- [Export("FunctionWith8Arguments", typeof(Delegate))]
- public int Function(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8)
- {
- return i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8;
- }
-
- [Export("ActionWith9Arguments")]
- [Export("ActionWith9Arguments", typeof(Delegate))]
- public void Action(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9)
- {
- }
-
- [Export("FunctionWith9Arguments")]
- [Export("FunctionWith9Arguments", typeof(Delegate))]
- public int Function(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9)
- {
- return i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8 + i9;
- }
-
-#if CLR40 && !SILVERLIGHT
- [Export("FunctionWithDefaultValue")]
- public int FunctionWithDefaultValue(int i, string s = "")
- {
- return i;
- }
-#endif
- }
-
- [TestMethod]
- public void Export_SimpleCustomDelegate_ShouldWork()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(MethodExporter));
-
- var contractName = AttributedModelServices.GetContractName(typeof(SimpleDelegate));
-
- var export1 = container.GetExportedValue<SimpleDelegate>();
- Assert.AreEqual(1, export1());
-
- var export2 = container.GetExportedValue<Func<int>>();
- Assert.AreEqual(1, export1());
-
- var export3 = (ExportedDelegate)container.GetExportedValue<object>(contractName);
- var export4 = (SimpleDelegate)export3.CreateDelegate(typeof(SimpleDelegate));
- Assert.AreEqual(1, export4());
- }
-
- [TestMethod]
- public void Export_CustomDelegateWithOutRefParams_ShouldWork()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(MethodExporter));
-
- var export1 = container.GetExportedValue<DoWorkDelegate>();
-
- int i = 0;
- object o = new object();
- string s;
-
- export1(i, ref o, out s);
- }
-
- [TestMethod]
- public void Export_FunctionWith8Arguments_ShouldWorkFine()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(MethodExporter));
-
-#if CLR40 && !SILVERLIGHT
- Assert.IsNotNull(container.GetExportedValue<Delegate>("FunctionWith8Arguments"));
-#else
- ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- container.GetExportedValue<Delegate>("FunctionWith8Arguments"));
-#endif
- }
-
- public delegate int FuncWith9Args(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9);
-
- [TestMethod]
- public void Export_FuncWith9Arguments_ShouldThrowContractMismatch()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(MethodExporter));
-
- // Cannot Create a standard delegate that takes 9 arguments
- // so the generic Delegate type will not work
- ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- container.GetExportedValue<Delegate>("FunctionWith9Arguments"));
-
- // If a matching custom delegate type is used then it will work
- Assert.IsNotNull(container.GetExportedValue<FuncWith9Args>("FunctionWith9Arguments"));
- }
-
- [TestMethod]
- public void Export_ActionWith8Arguments_ShouldWorkFine()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(MethodExporter));
-
-#if CLR40 && !SILVERLIGHT
- Assert.IsNotNull(container.GetExportedValue<Delegate>("ActionWith8Arguments"));
-#else
- ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- container.GetExportedValue<Delegate>("ActionWith8Arguments"));
-#endif
- }
-
- public delegate void ActionWith9Args(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9);
-
- [TestMethod]
- public void Export_ActionWith9Arguments_ShouldThrowContractMismatch()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(MethodExporter));
-
- // Cannot Create a standard delegate that takes 9 arguments
- // so the generic Delegate type will not work
- ExceptionAssert.Throws<CompositionContractMismatchException>(() =>
- container.GetExportedValue<Delegate>("ActionWith9Arguments"));
-
- // If a matching custom delegate type is used then it will work
- Assert.IsNotNull(container.GetExportedValue<ActionWith9Args>("ActionWith9Arguments"));
- }
-
-#if CLR40 && !SILVERLIGHT
- [TestMethod]
- public void Export_FunctionWithDefaultValue_ShouldWorkFine()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(MethodExporter));
-
- var export = container.GetExportedValue<Func<int, string, int>>("FunctionWithDefaultValue");
- Assert.AreEqual(3, export(3, "a"));
-
- // Even though the string argument is optional it still cannot be cast to Func<int, int>.
- var export2 = (ExportedDelegate)container.GetExportedValue<object>("FunctionWithDefaultValue");
- var export3 = export2.CreateDelegate(typeof(Func<int, int>));
-
- Assert.IsNull(export3);
- }
-#endif
-
-
- public delegate int DelegateOneArg(int i);
- public delegate int DelegateTwoArgs(int i, int j);
-
- public class CustomExportedDelegate : ExportedDelegate
- {
- private Func<int, int, int> _func;
-
- public CustomExportedDelegate(Func<int, int, int> func)
- {
- this._func = func;
- }
-
- public override Delegate CreateDelegate(Type delegateType)
- {
- if (delegateType == typeof(DelegateOneArg))
- {
- return (DelegateOneArg)((i) => this._func(i, 0));
- }
- else if (delegateType == typeof(DelegateTwoArgs))
- {
- return (DelegateTwoArgs)((i, j) => this._func(i, j));
- }
-
- return null;
- }
- }
-
- public class ExportCustomExportedDelegates
- {
- [Export("CustomExportedDelegate", typeof(DelegateOneArg))]
- [Export("CustomExportedDelegate", typeof(DelegateTwoArgs))]
- public ExportedDelegate MyExportedDelegate
- {
- get
- {
- return new CustomExportedDelegate(DoWork);
- }
- }
-
- public int DoWork(int i, int j)
- {
- return i + j;
- }
- }
-
- [Export]
- public class ImportCustomExportedDelegates
- {
- [Import("CustomExportedDelegate")]
- public DelegateOneArg DelegateOneArg { get; set; }
-
- [Import("CustomExportedDelegate")]
- public DelegateTwoArgs DelegateTwoArgs { get; set; }
-
- }
-
- [TestMethod]
- public void CustomExportedDelegate_ShouldWork()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(ExportCustomExportedDelegates),
- typeof(ImportCustomExportedDelegates));
-
- var importer = container.GetExportedValue<ImportCustomExportedDelegates>();
-
- Assert.AreEqual(1, importer.DelegateOneArg(1));
- Assert.AreEqual(2, importer.DelegateTwoArgs(1, 1));
- }
-
- public delegate void GetRef(ref int i);
- public delegate void GetOut(out int i);
-
- public class RefOutMethodExporter
- {
- [Export]
- public void MyGetOut(out int i)
- {
- i = 29;
- }
- }
-
- [TestMethod]
- public void MethodWithOutParam_ShouldWorkWithRefParam()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(RefOutMethodExporter));
-
- int i = 0;
-
- var export1 = container.GetExportedValue<GetRef>();
-
- export1(ref i);
- Assert.AreEqual(29, i);
- i = 0;
-
- var export2 = container.GetExportedValue<GetOut>();
-
- export2(out i);
- Assert.AreEqual(29, i);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/DiscoveryTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/DiscoveryTests.cs deleted file mode 100644 index 32d2d5d197c..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/DiscoveryTests.cs +++ /dev/null @@ -1,874 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.AttributedModel;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.UnitTesting;
-using System.Linq;
-using System.Reflection;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace Tests.Integration
-{
- [TestClass]
- public class DiscoveryTests
- {
- public abstract class AbstractClassWithExports
- {
- [Export("StaticExport")]
- public static string StaticExport { get { return "ExportedValue"; } }
-
- [Export("InstanceExport")]
- public string InstanceExport { get { return "InstanceExportedValue"; } }
- }
-
- [TestMethod]
- public void Export_StaticOnAbstractClass_ShouldExist()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(AbstractClassWithExports));
-
- Assert.IsTrue(container.IsPresent("StaticExport"));
- Assert.IsFalse(container.IsPresent("InstanceExport"));
- }
-
- public class ClassWithStaticImport
- {
- [Import("StaticImport")]
- public static string MyImport
- {
- get; set;
- }
- }
-
- [TestMethod]
- public void Import_StaticImport_ShouldNotBeSet()
- {
- var container = ContainerFactory.Create();
- container.AddAndComposeExportedValue("StaticImport", "String that shouldn't be imported");
-
- var importer = new ClassWithStaticImport();
-
- container.SatisfyImportsOnce(importer);
-
- Assert.IsNull(ClassWithStaticImport.MyImport, "Static import should not have been set!");
- }
-
-#if !SILVERLIGHT
-// private imports don't work on SILVERLIGHT
- [Export]
- public class BaseWithNonPublicImportAndExport
- {
- [Import("BasePrivateImport")]
- private string _basePrivateImport = null;
-
- public string BasePrivateImport { get { return this._basePrivateImport; } }
- }
-
- [Export]
- public class DerivedBaseWithNonPublicImportAndExport : BaseWithNonPublicImportAndExport
- {
-
- }
-
- [TestMethod]
- public void Import_PrivateOnClass_ShouldSetImport()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(BaseWithNonPublicImportAndExport));
- container.AddAndComposeExportedValue("BasePrivateImport", "Imported String");
-
- var importer = container.GetExportedValue<BaseWithNonPublicImportAndExport>();
- Assert.AreEqual("Imported String", importer.BasePrivateImport);
- }
-
-
- [TestMethod]
- public void Import_PrivateOnBase_ShouldSetImport()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(DerivedBaseWithNonPublicImportAndExport));
- container.AddAndComposeExportedValue("BasePrivateImport", "Imported String");
-
- var importer = container.GetExportedValue<DerivedBaseWithNonPublicImportAndExport>();
- Assert.AreEqual("Imported String", importer.BasePrivateImport);
- }
-#endif // !SILVERLIGHT
-
- public interface InterfaceWithImport
- {
- [Import("InterfaceImport")]
- int MyImport { get; set; }
- }
-
- public interface InterfaceWithExport
- {
- [Export("InterfaceExport")]
- int MyExport { get; set; }
- }
-
- [TestMethod]
- public void AttributesOnInterface_ShouldNotBeConsiderAPart()
- {
- var catalog = CatalogFactory.CreateAttributed(
- typeof(InterfaceWithImport),
- typeof(InterfaceWithExport));
-
- Assert.AreEqual(0, catalog.Parts.Count());
- }
-
- [Export]
- public class ClassWithInterfaceInheritedImport : InterfaceWithImport
- {
- public int MyImport { get; set; }
- }
-
- [TestMethod]
- public void Import_InheritImportFromInterface_ShouldExposeImport()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(ClassWithInterfaceInheritedImport));
-
- container.AddAndComposeExportedValue("InterfaceImport", 42);
-
- var importer = container.GetExportedValue<ClassWithInterfaceInheritedImport>();
-
- Assert.IsTrue(importer.MyImport == default(int), "Imports declared on interfaces should not be discovered");
- }
-
- public class ClassWithInterfaceInheritedExport : InterfaceWithExport
- {
- public ClassWithInterfaceInheritedExport()
- {
- MyExport = 42;
- }
-
- public int MyExport { get; set; }
- }
-
- [TestMethod]
- public void Import_InheritExportFromInterface_ShouldNotExposeExport()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(ClassWithInterfaceInheritedExport));
-
- Assert.IsFalse(container.IsPresent("InterfaceExport"), "Export defined on interface should not be discovered!");
- }
-
- public interface IFoo { }
-
- [InheritedExport]
- public abstract class BaseWithVirtualExport
- {
- [Export]
- public virtual IFoo MyProp { get; set; }
- }
-
- [InheritedExport(typeof(BaseWithVirtualExport))]
- public class DerivedWithOverrideExport : BaseWithVirtualExport
- {
- [Export]
- public override IFoo MyProp { get; set; }
- }
-
- [TestMethod]
- public void Export_BaseAndDerivedShouldAmountInTwoExports()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(BaseWithVirtualExport),
- typeof(DerivedWithOverrideExport));
-
- var exports1 = container.GetExportedValues<BaseWithVirtualExport>();
- Assert.AreEqual(1, exports1.Count());
-
- var exports2 = container.GetExportedValues<IFoo>();
- Assert.AreEqual(1, exports2.Count());
- }
-
- public interface IDocument { }
-
- [Export(typeof(IDocument))]
- [ExportMetadata("Name", "TextDocument")]
- public class TextDocument : IDocument
- {
- }
-
- [Export(typeof(IDocument))]
- [ExportMetadata("Name", "XmlDocument")]
- public class XmlDocument : TextDocument
- {
- }
-
- [TestMethod]
- public void Export_ExportingSameContractInDerived_ShouldResultInHidingBaseExport()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(IDocument),
- typeof(XmlDocument));
-
- var export = container.GetExport<IDocument, IDictionary<string, object>>();
-
- Assert.AreEqual("XmlDocument", export.Metadata["Name"]);
- }
-
- [TestMethod]
- public void Export_ExportingBaseAndDerivedSameContract_ShouldResultInOnlyTwoExports()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(IDocument),
- typeof(TextDocument),
- typeof(XmlDocument));
-
- var exports = container.GetExports<IDocument, IDictionary<string, object>>();
-
- Assert.AreEqual(2, exports.Count());
- Assert.AreEqual("TextDocument", exports.ElementAt(0).Metadata["Name"]);
- Assert.IsInstanceOfType(exports.ElementAt(0).Value, typeof(TextDocument));
-
- Assert.AreEqual("XmlDocument", exports.ElementAt(1).Metadata["Name"]);
- Assert.IsInstanceOfType(exports.ElementAt(1).Value, typeof(XmlDocument));
- }
-
- public interface IObjectSerializer { }
-
- [Export(typeof(IDocument))]
- [Export(typeof(IObjectSerializer))]
- [ExportMetadata("Name", "XamlDocument")]
- public class XamlDocument : XmlDocument, IObjectSerializer
- {
- }
-
- [TestMethod]
- public void Export_ExportingSameContractInDerivedAndNewContract_ShouldResultInHidingBaseAndExportingNewContract()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(XamlDocument));
-
- var export = container.GetExport<IDocument, IDictionary<string, object>>();
-
- Assert.AreEqual("XamlDocument", export.Metadata["Name"]);
-
- var export2 = container.GetExport<IObjectSerializer, IDictionary<string, object>>();
-
- Assert.AreEqual("XamlDocument", export2.Metadata["Name"]);
- }
-
-
- [Export(typeof(IDocument))]
- [ExportMetadata("Name", "WPFDocument")]
- public class WPFDocument : XamlDocument
- {
- }
-
- [TestMethod]
- public void Export_ExportingSameContractInDerivedAndAnotherContractInBase_ShouldResultInHidingOneBaseAndInheritingNewContract()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(WPFDocument));
-
- var export = container.GetExport<IDocument, IDictionary<string, object>>();
-
- Assert.AreEqual("WPFDocument", export.Metadata["Name"]);
-
- var export2 = container.GetExportedValueOrDefault<IObjectSerializer>();
-
- Assert.IsNull(export2, "IObjectSerializer export should not have been inherited");
- }
-
- [InheritedExport]
- public abstract class Plugin
- {
- public virtual string GetLocation()
- {
- return "NoWhere";
- }
-
- public virtual int Version
- {
- get
- {
- return 0;
- }
- }
- }
-
- private void VerifyValidPlugin(CompositionContainer container, int version, string location)
- {
- var plugins = container.GetExports<Plugin>();
- Assert.AreEqual(1, plugins.Count());
-
- var plugin = plugins.Single().Value;
-
- Assert.AreEqual(location, plugin.GetLocation());
- Assert.AreEqual(version, plugin.Version);
- }
-
- public class Plugin1 : Plugin
- {
- }
-
- [TestMethod]
- public void Export_Plugin1()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(Plugin1));
-
- VerifyValidPlugin(container, 0, "NoWhere");
- }
-
- public class Plugin2 : Plugin
- {
- public override string GetLocation()
- {
- return "SomeWhere";
- }
- public override int Version
- {
- get
- {
- return 1;
- }
- }
- }
-
- [TestMethod]
- public void Export_Plugin2()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(Plugin2));
-
- VerifyValidPlugin(container, 1, "SomeWhere");
- }
-
- public class Plugin3 : Plugin
- {
- [Export("PluginLocation")]
- public override string GetLocation()
- {
- return "SomeWhere3";
- }
-
- [Export("PluginVersion")]
- public override int Version
- {
- get
- {
- return 3;
- }
- }
- }
-
- [TestMethod]
- public void Export_Plugin3()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(Plugin3));
-
- VerifyValidPlugin(container, 3, "SomeWhere3");
-
- var plVer = container.GetExportedValue<int>("PluginVersion");
- Assert.AreEqual(3, plVer);
-
- var plLoc = container.GetExportedValue<Func<string>>("PluginLocation");
- Assert.AreEqual("SomeWhere3", plLoc());
- }
-
- [InheritedExport(typeof(Plugin))]
- public class Plugin4 : Plugin
- {
- public override string GetLocation()
- {
- return "SomeWhere4";
- }
-
- public override int Version
- {
- get
- {
- return 4;
- }
- }
- }
-
- [TestMethod]
- public void Export_Plugin4()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(Plugin4));
-
- VerifyValidPlugin(container, 4, "SomeWhere4");
- }
-
-
- public interface IPlugin
- {
- int Id { get; }
- }
-
- public class MyPlugin : IPlugin
- {
- [Export("PluginId")]
- public int Id { get { return 0; } }
- }
-
- [TestMethod]
- public void Export_MyPlugin()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(MyPlugin));
-
- var export = container.GetExportedValue<int>("PluginId");
- }
-
- [InheritedExport]
- public interface IApplicationPlugin
- {
- string Name { get; }
-
- object Application { get; set; }
- }
-
- [InheritedExport]
- public interface IToolbarPlugin : IApplicationPlugin
- {
- object ToolBar { get; set; }
- }
-
- public class MyToolbarPlugin : IToolbarPlugin
- {
- [Export("ApplicationPluginNames")]
- public string Name { get { return "MyToolbarPlugin"; } }
-
- [Import("Application")]
- public object Application { get; set; }
-
- [Import("ToolBar")]
- public object ToolBar { get; set; }
- }
-
- [TestMethod]
- public void TestInterfaces()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(MyToolbarPlugin));
-
- var app = new object();
- container.AddAndComposeExportedValue<object>("Application", app);
-
- var toolbar = new object();
- container.AddAndComposeExportedValue<object>("ToolBar", toolbar);
-
- var export = container.GetExportedValue<IToolbarPlugin>();
-
- Assert.AreEqual(app, export.Application);
- Assert.AreEqual(toolbar, export.ToolBar);
- Assert.AreEqual("MyToolbarPlugin", export.Name);
-
- var pluginNames = container.GetExportedValues<string>("ApplicationPluginNames");
- Assert.AreEqual(1, pluginNames.Count());
- }
-
- public class ImportOnVirtualProperty
- {
- public int ImportSetCount = 0;
- private int _value;
-
- [Import("VirtualImport")]
- public virtual int VirtualImport
- {
- get
- {
- return this._value;
- }
- set
- {
- this._value = value;
- ImportSetCount++;
- }
- }
- }
-
- public class ImportOnOverridenPropertyWithSameContract : ImportOnVirtualProperty
- {
- [Import("VirtualImport")]
- public override int VirtualImport
- {
- get
- {
- return base.VirtualImport;
- }
- set
- {
- base.VirtualImport = value;
- }
- }
- }
-
- [TestMethod]
- public void Import_VirtualPropertyOverrideWithSameContract_ShouldSucceed()
- {
- var container = ContainerFactory.Create();
- container.AddAndComposeExportedValue<int>("VirtualImport", 21);
-
- var import = new ImportOnOverridenPropertyWithSameContract();
-
- container.SatisfyImportsOnce(import);
-
- // Import will get set twice because there are 2 imports on the same property.
- // We would really like to either elminate it getting set twice or error in this case
- // but we figure it is a rare enough corner case that it doesn't warrented the run time cost
- // and can be covered by an FxCop rule.
-
- Assert.AreEqual(2, import.ImportSetCount);
- Assert.AreEqual(21, import.VirtualImport);
- }
-
- public class ImportOnOverridenPropertyWithDifferentContract : ImportOnVirtualProperty
- {
- [Import("OverriddenImport")]
- public override int VirtualImport
- {
- set
- {
- base.VirtualImport = value;
- }
- }
- }
-
- [TestMethod]
- public void Import_VirtualPropertyOverrideWithDifferentContract_ShouldSucceed()
- {
- var container = ContainerFactory.Create();
- container.AddAndComposeExportedValue<int>("VirtualImport", 21);
- container.AddAndComposeExportedValue<int>("OverriddenImport", 42);
-
- var import = new ImportOnOverridenPropertyWithSameContract();
-
- container.SatisfyImportsOnce(import);
-
- // Import will get set twice because there are 2 imports on the same property.
- // We would really like to either elminate it getting set twice or error in this case
- // but we figure it is a rare enough corner case that it doesn't warrented the run time cost
- // and can be covered by an FxCop rule.
-
- Assert.AreEqual(2, import.ImportSetCount);
-
- // The derived most import should be discovered first and so it will get set first
- // and thus the value should be the base import which is 21.
- Assert.AreEqual(21, import.VirtualImport);
- }
-
- [InheritedExport]
- public interface IOrderScreen { }
-
- public class NorthwindOrderScreen : IOrderScreen
- {
- }
-
- public class SouthsandOrderScreen : IOrderScreen
- {
- }
-
- [TestMethod]
- public void Export_ExportOnlyOnBaseInterfacewithInheritedMarked_ShouldFindAllImplementers()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(NorthwindOrderScreen),
- typeof(SouthsandOrderScreen));
-
- var exports = container.GetExportedValues<IOrderScreen>();
-
- Assert.AreEqual(2, exports.Count());
- Assert.IsInstanceOfType(exports.ElementAt(0), typeof(NorthwindOrderScreen));
- Assert.IsInstanceOfType(exports.ElementAt(1), typeof(SouthsandOrderScreen));
- }
-
- [Export]
- public class PartWithStaticConstructor
- {
- static PartWithStaticConstructor()
- {
- throw new Exception();
- }
- }
-
- [TestMethod]
- public void StaticConstructor()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(PartWithStaticConstructor));
-
- CompositionAssert.ThrowsError(ErrorId.ImportEngine_PartCannotGetExportedValue,
- ErrorId.ImportEngine_PartCannotActivate,
- ErrorId.ReflectionModel_PartConstructorThrewException,
- () => container.GetExportedValue<PartWithStaticConstructor>());
- }
-
- public interface IAddin
- {
- void LoadAddin(object application);
- void Shutdown();
- }
-
- public interface IAddinMetadata
- {
- string Name { get; }
- string Version { get; }
- string Id { get; }
- }
-
- [MetadataAttribute]
- [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
- public class AddinAttribute : ExportAttribute, IAddinMetadata
- {
- private string _name;
- private string _version;
- private string _id;
-
- public AddinAttribute(string name, string version, string id)
- : base(typeof(IAddin))
- {
- this._name = name;
- this._version = version;
- this._id = id;
- }
-
- public string Name { get { return this._name; } }
- public string Version { get { return this._version; } }
- public string Id { get { return this._id; } }
- }
-
-
- [Addin("Addin1", "1.0", "{63D1B00F-AD2F-4F14-8A36-FFA59E4A101C}")]
- public class Addin1 : IAddin
- {
- public void LoadAddin(object application)
- {
- }
- public void Shutdown()
- {
- }
- }
-
- [Addin("Addin2", "1.0", "{63D1B00F-AD2F-4F14-8A36-FFA59E4A101D}")]
- public class Addin2 : IAddin
- {
- public void LoadAddin(object application)
- {
- }
- public void Shutdown()
- {
- }
- }
-
- [Addin("Addin3", "1.0", "{63D1B00F-AD2F-4F14-8A36-FFA59E4A101E}")]
- public class Addin3 : IAddin
- {
- public void LoadAddin(object application)
- {
- }
- public void Shutdown()
- {
- }
- }
-
- [TestMethod]
- public void DiscoverAddinsWithCombinedCustomExportAndMetadataAttribute()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(Addin1), typeof(Addin2), typeof(Addin3));
-
- var addins = container.GetExports<IAddin, IAddinMetadata>().ToArray();
-
- Assert.AreEqual(3, addins.Length, "Incorrect number of addins");
-
- var values = new AddinAttribute[]
- {
- new AddinAttribute("Addin1", "1.0", "{63D1B00F-AD2F-4F14-8A36-FFA59E4A101C}"),
- new AddinAttribute("Addin2", "1.0", "{63D1B00F-AD2F-4F14-8A36-FFA59E4A101D}"),
- new AddinAttribute("Addin3", "1.0", "{63D1B00F-AD2F-4F14-8A36-FFA59E4A101E}"),
- };
-
- for (int i = 0; i < values.Length; i++)
- {
- var addinMetadata = addins[i].Metadata;
-
- Assert.AreEqual(values[i].Name, addinMetadata.Name);
- Assert.AreEqual(values[i].Version, addinMetadata.Version);
- Assert.AreEqual(values[i].Id, addinMetadata.Id);
- }
- }
-
- [TestMethod]
- public void CombinedCustomExportMetadataAttribute_ShouldNotContainMetadataFromExportAttribute()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(Addin1));
- var addin = container.GetExport<IAddin, IDictionary<string, object>>();
-
- Assert.AreEqual(4, addin.Metadata.Count); // 3 metadata values and type identity
-
- Assert.AreEqual(AttributedModelServices.GetTypeIdentity(typeof(IAddin)), addin.Metadata[CompositionConstants.ExportTypeIdentityMetadataName]);
- Assert.AreEqual("Addin1", addin.Metadata["Name"]);
- Assert.AreEqual("1.0", addin.Metadata["Version"]);
- Assert.AreEqual("{63D1B00F-AD2F-4F14-8A36-FFA59E4A101C}", addin.Metadata["Id"]);
- }
-
- public class CustomInheritedExportAttribute : InheritedExportAttribute
- {
- }
-
- [CustomInheritedExport]
- public interface IUsesCustomInheritedExport
- {
- int Property { get; }
- }
-
- public class UsesCustomInheritedExportOnInterface : IUsesCustomInheritedExport
- {
- public int Property
- {
- get { return 42; }
- }
- }
-
- [TestMethod]
- public void Test_CustomInheritedExportAttribute_OnInterface()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(UsesCustomInheritedExportOnInterface));
- var exporter = container.GetExportedValue<IUsesCustomInheritedExport>();
- Assert.AreEqual(42, exporter.Property);
- }
-
- [CustomInheritedExport]
- public class BaseClassWithCustomInheritedExport
- {
- public int Property { get; set; }
- }
-
- public class DerivedFromBaseWithCustomInheritedExport : BaseClassWithCustomInheritedExport
- {
- public DerivedFromBaseWithCustomInheritedExport()
- {
- Property = 43;
- }
- }
-
- [TestMethod]
- public void Test_CustomInheritedExportAttribute_OnBaseClass()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(DerivedFromBaseWithCustomInheritedExport));
- var exporter = container.GetExportedValue<BaseClassWithCustomInheritedExport>();
- Assert.AreEqual(43, exporter.Property);
- }
-
-
- [InheritedExport("Foo")]
- [ExportMetadata("Name", "IFoo1")]
- public interface IFoo1 { }
-
- [InheritedExport("Foo")]
- [ExportMetadata("Name", "IFoo2")]
- public interface IFoo2 { }
-
- [InheritedExport("Foo")]
- [ExportMetadata("Name", "FooWithOneFoo")]
- public class FooWithOneFoo : IFoo1
- {
- }
-
- [TestMethod]
- public void InheritedExport_OnTypeAndInterface()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(FooWithOneFoo));
-
- var foos = container.GetExports<object, IDictionary<string, object>>("Foo").ToArray();
-
- Assert.AreEqual(1, foos.Length);
- Assert.AreEqual("FooWithOneFoo", foos[0].Metadata["Name"]);
- }
-
- public class FooWithTwoFoos : IFoo1, IFoo2 { }
-
- [TestMethod]
- public void InheritedExport_TwoInterfaces()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(FooWithTwoFoos));
-
- var foos = container.GetExports<object, IDictionary<string, object>>("Foo").ToArray();
-
- Assert.AreEqual(2, foos.Length);
-
- EnumerableAssert.AreEqual(foos.Select(e => (string)e.Metadata["Name"]), "IFoo1", "IFoo2");
- }
-
- public class FooWithIfaceByOneFoo : FooWithOneFoo, IFoo1 { }
-
- [TestMethod]
- public void InheritedExport_BaseAndInterface()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(FooWithIfaceByOneFoo));
-
- var foos = container.GetExports<object, IDictionary<string, object>>("Foo").ToArray();
-
- Assert.AreEqual(1, foos.Length);
-
- Assert.AreEqual("FooWithOneFoo", foos[0].Metadata["Name"]);
- }
-
- [InheritedExport("Foo")]
- [ExportMetadata("Name", "FooWithInheritedOnSelf")]
- public class FooWithInheritedOnSelf : FooWithOneFoo, IFoo1 { }
-
- [TestMethod]
- public void InheritedExport_BaseInterfaceAndSelf()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(FooWithInheritedOnSelf));
-
- var foos = container.GetExports<object, IDictionary<string, object>>("Foo").ToArray();
-
- Assert.AreEqual(1, foos.Length);
-
- Assert.AreEqual("FooWithInheritedOnSelf", foos[0].Metadata["Name"]);
- }
-
- [InheritedExport("Foo")]
- [ExportMetadata("Name", "IFoo3")]
- public interface IFoo3 : IFoo1 { }
-
- public class FooWithInterfaceWithMultipleFoos : IFoo3 { }
-
- [TestMethod]
- public void InheritedExport_InterfaceHiearchy()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(FooWithInterfaceWithMultipleFoos));
-
- var foos = container.GetExports<object, IDictionary<string, object>>("Foo").ToArray();
- Assert.AreEqual(2, foos.Length);
-
- EnumerableAssert.AreEqual(foos.Select(e => (string)e.Metadata["Name"]), "IFoo1", "IFoo3");
- }
-
- [InheritedExport("Foo2")]
- [ExportMetadata("Name", "FooWithMultipleInheritedExports")]
- public class FooWithMultipleInheritedExports : IFoo1 { }
-
- [TestMethod]
- public void InheritedExport_MultipleDifferentContracts()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(FooWithMultipleInheritedExports));
-
- var foos = container.GetExports<object, IDictionary<string, object>>("Foo").ToArray();
-
- Assert.AreEqual(1, foos.Length);
-
- Assert.AreEqual("IFoo1", foos[0].Metadata["Name"]);
-
- var foo2s = container.GetExports<object, IDictionary<string, object>>("Foo2").ToArray();
-
- Assert.AreEqual(1, foo2s.Length);
-
- Assert.AreEqual("FooWithMultipleInheritedExports", foo2s[0].Metadata["Name"]);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/ExportProviderEventTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/ExportProviderEventTests.cs deleted file mode 100644 index 3744048f8ae..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/ExportProviderEventTests.cs +++ /dev/null @@ -1,284 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Linq;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Factories;
-
-namespace System.ComponentModel.Composition
-{
- [TestClass]
- public class ExportProviderEventTests
- {
- [TestMethod]
- public void BatchAdd_ShouldFireEvents()
- {
- var container = ContainerFactory.Create();
- var eventListener = new ExportProviderListener(container, container);
-
- var batch = new CompositionBatch();
- batch.AddExportedValue<object>("MyExport", new object());
- eventListener.VerifyCompose(batch);
- }
-
- [TestMethod]
- public void BatchRemove_ShouldFireEvents()
- {
- var container = ContainerFactory.Create();
- var batch = new CompositionBatch();
- var exportPart = batch.AddExportedValue<object>("MyExport", new object());
- container.Compose(batch);
-
- var eventListener = new ExportProviderListener(container, container);
-
- batch = new CompositionBatch();
- batch.RemovePart(exportPart);
- eventListener.VerifyCompose(batch);
- }
-
- [TestMethod]
- public void BatchAddRemove_ShouldFireEvents()
- {
- var container = ContainerFactory.Create();
- var batch = new CompositionBatch();
- var exportPart = batch.AddExportedValue<object>("MyExport", new object());
- container.Compose(batch);
-
- var eventListener = new ExportProviderListener(container, container);
-
- batch = new CompositionBatch();
- batch.RemovePart(exportPart);
- batch.AddExportedValue<object>("MyExport2", new object());
- eventListener.VerifyCompose(batch);
- }
-
- [TestMethod]
- public void BatchMultipleAdds_ShouldFireEvents()
- {
- var container = ContainerFactory.Create();
- var eventListener = new ExportProviderListener(container, container);
-
- var batch = new CompositionBatch();
- batch.AddExportedValue<object>("MyExport", new object());
- batch.AddExportedValue<object>("MyExport2", new object());
- batch.AddExportedValue<object>("MyExport3", new object());
- eventListener.VerifyCompose(batch);
- }
-
- [TestMethod]
- public void BatchNestedContainerAdds_ShouldFireEvents()
- {
- var parentContainer = ContainerFactory.Create();
- var container = ContainerFactory.Create(parentContainer);
- var eventListener = new ExportProviderListener(parentContainer, container);
-
- var batch = new CompositionBatch();
- batch.AddExportedValue<object>("MyExport", new object());
- eventListener.VerifyCompose(batch);
- }
-
- [Export]
- public class SampleCatalogExport { }
-
- [TestMethod]
- public void CatalogAdd_ShouldFireEvents()
- {
- var catalog = new TypeCatalog(typeof(SampleCatalogExport));
- var aggCat = new AggregateCatalog();
- var container = ContainerFactory.Create(aggCat);
- var eventListener = new ExportProviderListener(container, container);
-
- eventListener.VerifyCatalogAdd(() => aggCat.Catalogs.Add(catalog), typeof(SampleCatalogExport));
- }
-
- [TestMethod]
- public void CatalogRemove_ShouldFireEvents()
- {
- var catalog = new TypeCatalog(typeof(SampleCatalogExport));
- var aggCat = new AggregateCatalog();
- var container = ContainerFactory.Create(aggCat);
-
- aggCat.Catalogs.Add(catalog);
- var eventListener = new ExportProviderListener(container, container);
-
- eventListener.VerifyCatalogRemove(() => aggCat.Catalogs.Remove(catalog), typeof(SampleCatalogExport));
- }
-
- [Export]
- public class SampleCatalogExport2 { }
-
- [TestMethod]
- [Ignore]
- [WorkItem(812029)]
- public void CatalogMultipleAdds_ShouldFireEvents()
- {
- var catalog = new TypeCatalog(typeof(SampleCatalogExport));
- var aggCat = new AggregateCatalog();
- var container = ContainerFactory.Create(aggCat);
- var eventListener = new ExportProviderListener(container, container);
-
- var otherAggCat = new AggregateCatalog(new TypeCatalog(typeof(SampleCatalogExport)), new TypeCatalog(typeof(SampleCatalogExport2)));
-
- eventListener.VerifyCatalogAdd(() => aggCat.Catalogs.Add(otherAggCat), typeof(SampleCatalogExport), typeof(SampleCatalogExport2));
- }
-
- [TestMethod]
- public void CatalogNestedContainerAdds_ShouldFireEvents()
- {
- var catalog = new TypeCatalog(typeof(SampleCatalogExport));
- var aggCat = new AggregateCatalog();
- var parentContainer = ContainerFactory.Create(aggCat);
- var container = ContainerFactory.Create(parentContainer);
- var eventListener = new ExportProviderListener(parentContainer, container);
-
- eventListener.VerifyCatalogAdd(() => aggCat.Catalogs.Add(catalog), typeof(SampleCatalogExport));
- }
-
- public class ExportProviderListener
- {
- private CompositionContainer _container;
- private ExportProvider _watchedProvider;
- private string[] _expectedAdds;
- private string[] _expectedRemoves;
- private int _changedEventCount;
- private int _changingEventCount;
-
- public ExportProviderListener(CompositionContainer container, ExportProvider watchExportProvider)
- {
- watchExportProvider.ExportsChanged += OnExportsChanged;
- watchExportProvider.ExportsChanging += OnExportsChanging;
- this._watchedProvider = watchExportProvider;
- this._container = container;
- }
-
- public void VerifyCompose(CompositionBatch batch)
- {
- this._expectedAdds = GetContractNames(batch.PartsToAdd);
- this._expectedRemoves = GetContractNames(batch.PartsToRemove);
-
- this._container.Compose(batch);
-
- Assert.IsTrue(this._changingEventCount == 1, "Changing event should have been called");
- Assert.IsTrue(this._changedEventCount == 1, "Changed event should have been called");
-
- ResetState();
- }
-
- public void VerifyCatalogAdd(Action doAdd, params Type[] expectedTypesAdded)
- {
- this._expectedAdds = GetContractNames(expectedTypesAdded);
-
- doAdd();
-
- Assert.IsTrue(this._changingEventCount == 1, "Changing event should have been called");
- Assert.IsTrue(this._changedEventCount == 1, "Changed event should have been called");
-
- ResetState();
- }
-
- public void VerifyCatalogRemove(Action doRemove, params Type[] expectedTypesRemoved)
- {
- this._expectedRemoves = GetContractNames(expectedTypesRemoved);
-
- doRemove();
-
- Assert.IsTrue(this._changingEventCount == 1, "Changing event should have been called");
- Assert.IsTrue(this._changedEventCount == 1, "Changed event should have been called");
-
- ResetState();
- }
-
- public void OnExportsChanging(object sender, ExportsChangeEventArgs args)
- {
- Assert.IsTrue(this._expectedAdds != null || this._expectedRemoves != null);
-
- if (this._expectedAdds == null)
- {
- EnumerableAssert.IsEmpty(args.AddedExports);
- }
- else
- {
- foreach (var add in this._expectedAdds)
- {
- Assert.IsFalse(this._container.IsPresent(add), "Added exports should ot be added yet during changing");
- }
- }
-
- if (this._expectedRemoves == null)
- {
- EnumerableAssert.IsEmpty(args.RemovedExports);
- }
- else
- {
- foreach (var remove in this._expectedRemoves)
- {
- Assert.IsTrue(this._container.IsPresent(remove), "Removed exports should not be removed yet during changing");
- }
- }
-
- this._changingEventCount++;
- }
-
- public void OnExportsChanged(object sender, ExportsChangeEventArgs args)
- {
- Assert.IsTrue(this._expectedAdds != null || this._expectedRemoves != null);
-
- if (this._expectedAdds == null)
- {
- EnumerableAssert.IsEmpty(args.AddedExports);
- }
- else
- {
- foreach (var add in this._expectedAdds)
- {
- Assert.IsTrue(this._container.IsPresent(add), "Added exports should be added during changed");
- }
- }
-
- if (this._expectedRemoves == null)
- {
- EnumerableAssert.IsEmpty(args.RemovedExports);
- }
- else
- {
- foreach (var remove in this._expectedRemoves)
- {
- Assert.IsFalse(this._container.IsPresent(remove), "Removed exports should be removed during changed");
- }
- }
-
- Assert.IsNull(args.AtomicComposition);
-
- this._changedEventCount++;
- }
-
- private void ResetState()
- {
- this._expectedAdds = null;
- this._expectedRemoves = null;
- this._changedEventCount = 0;
- this._changingEventCount = 0;
- }
-
- private static string[] GetContractNames(IEnumerable<ExportDefinition> definitions)
- {
- return definitions.Select(e => e.ContractName).ToArray();
- }
-
- private static string[] GetContractNames(IEnumerable<ComposablePart> parts)
- {
- return GetContractNames(parts.SelectMany(p => p.ExportDefinitions));
- }
-
- private static string[] GetContractNames(IEnumerable<Type> types)
- {
- return GetContractNames(types.Select(t => AttributedModelServices.CreatePartDefinition(t, null)).SelectMany(p => p.ExportDefinitions));
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/LifetimeTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/LifetimeTests.cs deleted file mode 100644 index 5a5cd5d50fb..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/LifetimeTests.cs +++ /dev/null @@ -1,1273 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.UnitTesting;
-using System.Linq;
-using System.Reflection;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace Tests.Integration
-{
- [TestClass]
- public class LifetimeTests
- {
- [Export]
- public class AnyPartSimple
- {
-
- }
-
- [Export]
- public class AnyPartDisposable : IDisposable
- {
- public bool IsDisposed { get; set; }
- public void Dispose()
- {
- Assert.IsFalse(IsDisposed);
- IsDisposed = true;
- }
- }
-
- [Export]
- public class AnyPartRecomposable
- {
- [Import("Value", AllowRecomposition = true)]
- public int Value { get; set; }
- }
-
- [Export]
- public class AnyPartDisposableRecomposable : IDisposable
- {
- [Import("Value", AllowRecomposition = true)]
- public int Value { get; set; }
-
- public bool IsDisposed { get; set; }
- public void Dispose()
- {
- Assert.IsFalse(IsDisposed);
- IsDisposed = true;
- }
- }
-
- [TestMethod]
- public void PartAddedViaAddExportedValue_ShouldNotBeDisposedWithContainer()
- {
- var container = new CompositionContainer();
- var disposablePart = new AnyPartDisposable();
- var batch = new CompositionBatch();
- batch.AddPart(batch);
- container.Compose(batch);
-
- container.Dispose();
- Assert.IsFalse(disposablePart.IsDisposed);
- }
-
- [TestMethod]
- public void PartAddedTwice_AppearsTwice()
- {
- // You probably shouldn't be adding a part to the container twice, but it's not something we're going to check for and throw an exception on
- var container = new CompositionContainer();
- var disposable = new AnyPartDisposable();
- var part = AttributedModelServices.CreatePart(disposable);
- var batch = new CompositionBatch();
- batch.AddPart(part);
- container.Compose(batch);
-
- batch = new CompositionBatch();
- batch.AddPart(part);
- container.Compose(batch);
-
- var exports = container.GetExports<AnyPartDisposable>();
- Assert.AreEqual(2, exports.Count());
-
- container.Dispose();
- }
-
- [TestMethod]
- public void AnyPart_Simple_ShouldNotBeCollected()
- {
- var catalog = new TypeCatalog(typeof(AnyPartSimple));
- var container = new CompositionContainer(catalog);
-
- var refTracker = new ReferenceTracker();
-
- refTracker.AddReferencesNotExpectedToBeCollected(
- container.GetExportedValue<AnyPartSimple>());
-
- refTracker.CollectAndAssert();
-
- GC.KeepAlive(container);
- }
-
- [TestMethod]
- public void AnyPart_Disposable_ShouldNotBeCollected()
- {
- var catalog = new TypeCatalog(typeof(AnyPartDisposable));
- var container = new CompositionContainer(catalog);
-
- var refTracker = new ReferenceTracker();
-
- refTracker.AddReferencesNotExpectedToBeCollected(
- container.GetExportedValue<AnyPartDisposable>());
-
- GC.KeepAlive(container);
- }
-
- [TestMethod]
- public void AnyPart_Disposable_ShouldBeDisposedWithContainer()
- {
- var catalog = new TypeCatalog(typeof(AnyPartDisposable));
- var container = new CompositionContainer(catalog);
-
- var exportedValue = container.GetExportedValue<AnyPartDisposable>();
-
- Assert.IsFalse(exportedValue.IsDisposed);
-
- container.Dispose();
-
- Assert.IsTrue(exportedValue.IsDisposed, "AnyPart should be disposed with the container!");
- }
-
- [TestMethod]
- public void AnyPart_RecomposabeImport_ShouldNotBeCollected()
- {
- var catalog = new TypeCatalog(typeof(AnyPartRecomposable));
- var container = new CompositionContainer(catalog);
-
- // Setup dependency
- CompositionBatch batch = new CompositionBatch();
- var valueKey = batch.AddExportedValue("Value", 21);
- container.Compose(batch);
- batch = null;
-
- var refTracker = new ReferenceTracker();
-
- refTracker.AddReferencesNotExpectedToBeCollected(
- container.GetExportedValue<AnyPartRecomposable>());
- refTracker.CollectAndAssert();
-
- // Lets make sure recomposition doesn't blow anything up here.
- batch = new CompositionBatch();
- batch.RemovePart(valueKey);
- batch.AddExportedValue("Value", 42);
- container.Compose(batch);
- batch = null;
-
- var exportedValue = (AnyPartRecomposable)refTracker.ReferencesNotExpectedToBeCollected[0].Target;
- Assert.AreEqual(42, exportedValue.Value);
-
- GC.KeepAlive(container);
- }
-
- [TestMethod]
- public void AnyPart_DisposableRecomposabeImport_ShouldNotBeCollected()
- {
- var catalog = new TypeCatalog(typeof(AnyPartDisposableRecomposable));
- var container = new CompositionContainer(catalog);
-
- // Setup dependency
- CompositionBatch batch = new CompositionBatch();
- var valueKey = batch.AddExportedValue("Value", 21);
- container.Compose(batch);
- batch = null;
-
- var refTracker = new ReferenceTracker();
-
- refTracker.AddReferencesNotExpectedToBeCollected(
- container.GetExportedValue<AnyPartDisposableRecomposable>());
-
- refTracker.CollectAndAssert();
-
- // Lets make sure recomposition doesn't blow anything up here.
- batch = new CompositionBatch();
- batch.RemovePart(valueKey);
- batch.AddExportedValue("Value", 42);
- container.Compose(batch);
- batch = null;
-
- var exportedValue = (AnyPartDisposableRecomposable)refTracker.ReferencesNotExpectedToBeCollected[0].Target;
- Assert.AreEqual(42, exportedValue.Value);
-
- GC.KeepAlive(container);
-
- container.Dispose();
-
- Assert.IsTrue(exportedValue.IsDisposed, "Any parts should be disposed with the container!");
- }
-
- [Export]
- [PartCreationPolicy(CreationPolicy.Shared)]
- public class SharedPartSimple
- {
-
- }
-
- [Export]
- [PartCreationPolicy(CreationPolicy.Shared)]
- public class SharedPartDisposable : IDisposable
- {
- public bool IsDisposed { get; set; }
- public void Dispose()
- {
- Assert.IsFalse(IsDisposed);
- IsDisposed = true;
- }
- }
-
- [Export]
- [PartCreationPolicy(CreationPolicy.Shared)]
- public class SharedPartRecomposable
- {
- [Import("Value", AllowRecomposition = true)]
- public int Value { get; set; }
- }
-
- [Export]
- [PartCreationPolicy(CreationPolicy.Shared)]
- public class SharedPartDisposableRecomposable : IDisposable
- {
- [Import("Value", AllowRecomposition = true)]
- public int Value { get; set; }
-
- public bool IsDisposed { get; set; }
- public void Dispose()
- {
- Assert.IsFalse(IsDisposed);
- IsDisposed = true;
- }
- }
-
- [TestMethod]
- public void SharedPart_Simple_ShouldNotBeCollected()
- {
- var catalog = new TypeCatalog(typeof(SharedPartSimple));
- var container = new CompositionContainer(catalog);
-
- var refTracker = new ReferenceTracker();
-
- refTracker.AddReferencesNotExpectedToBeCollected(
- container.GetExportedValue<SharedPartSimple>());
-
- refTracker.CollectAndAssert();
-
- GC.KeepAlive(container);
- }
-
- [TestMethod]
- public void SharedPart_Disposable_ShouldNotBeCollected()
- {
- var catalog = new TypeCatalog(typeof(SharedPartDisposable));
- var container = new CompositionContainer(catalog);
-
- var refTracker = new ReferenceTracker();
-
- refTracker.AddReferencesNotExpectedToBeCollected(
- container.GetExportedValue<SharedPartDisposable>());
-
- refTracker.CollectAndAssert();
-
- GC.KeepAlive(container);
- }
-
- [TestMethod]
- public void SharedPart_Disposable_ShouldBeDisposedWithContainer()
- {
- var catalog = new TypeCatalog(typeof(SharedPartDisposable));
- var container = new CompositionContainer(catalog);
-
- var export = container.GetExportedValue<SharedPartDisposable>();
-
- Assert.IsFalse(export.IsDisposed);
-
- container.Dispose();
-
- Assert.IsTrue(export.IsDisposed, "SharedPart should be disposed with the container!");
- }
-
- [TestMethod]
- public void SharedPart_RecomposabeImport_ShouldNotBeCollected()
- {
- var catalog = new TypeCatalog(typeof(SharedPartRecomposable));
- var container = new CompositionContainer(catalog);
-
- // Setup dependency
- CompositionBatch batch = new CompositionBatch();
- var valueKey = batch.AddExportedValue("Value", 21);
- container.Compose(batch);
- batch = null;
-
- var refTracker = new ReferenceTracker();
-
- refTracker.AddReferencesNotExpectedToBeCollected(
- container.GetExportedValue<SharedPartRecomposable>());
-
- refTracker.CollectAndAssert();
-
- // Lets make sure recomposition doesn't blow anything up here.
- batch = new CompositionBatch();
- batch.RemovePart(valueKey);
- batch.AddExportedValue("Value", 42);
- container.Compose(batch);
- batch = null;
-
- var exportedValue = (SharedPartRecomposable)refTracker.ReferencesNotExpectedToBeCollected[0].Target;
- Assert.AreEqual(42, exportedValue.Value);
-
- GC.KeepAlive(container);
- }
-
- [TestMethod]
- public void SharedPart_DisposableRecomposabeImport_ShouldNotBeCollected()
- {
- var catalog = new TypeCatalog(typeof(SharedPartDisposableRecomposable));
- var container = new CompositionContainer(catalog);
-
- // Setup dependency
- CompositionBatch batch = new CompositionBatch();
- var valueKey = batch.AddExportedValue("Value", 21);
- container.Compose(batch);
- batch = null;
-
- var refTracker = new ReferenceTracker();
-
- refTracker.AddReferencesNotExpectedToBeCollected(
- container.GetExportedValue<SharedPartDisposableRecomposable>());
-
- refTracker.CollectAndAssert();
-
- // Lets make sure recomposition doesn't blow anything up here.
- batch = new CompositionBatch();
- batch.RemovePart(valueKey);
- batch.AddExportedValue("Value", 42);
- container.Compose(batch);
- batch = null;
-
- var exportedValue = (SharedPartDisposableRecomposable)refTracker.ReferencesNotExpectedToBeCollected[0].Target;
- Assert.AreEqual(42, exportedValue.Value);
-
- container.Dispose();
-
- Assert.IsTrue(exportedValue.IsDisposed, "Any parts should be disposed with the container!");
- }
-
- [Export]
- [PartCreationPolicy(CreationPolicy.NonShared)]
- public class NonSharedPartSimple
- {
-
- }
-
- [Export]
- [PartCreationPolicy(CreationPolicy.NonShared)]
- public class NonSharedPartRecomposable
- {
- [Import("Value", AllowRecomposition = true)]
- public int Value { get; set; }
- }
-
- [Export]
- [PartCreationPolicy(CreationPolicy.NonShared)]
- public class NonSharedPartDisposable : IDisposable
- {
- public bool IsDisposed { get; set; }
- public void Dispose()
- {
- Assert.IsFalse(IsDisposed);
- IsDisposed = true;
- }
- }
-
- [Export]
- [PartCreationPolicy(CreationPolicy.NonShared)]
- public class NonSharedPartDisposableRecomposable : IDisposable
- {
- private int _value;
-
- [Import("Value", AllowRecomposition = true)]
- public int Value
- {
- get
- {
- if (this.IsDisposed) throw new ObjectDisposedException(this.GetType().Name);
- return this._value;
- }
- set
- {
- if (this.IsDisposed) throw new ObjectDisposedException(this.GetType().Name);
- this._value = value;
- }
- }
-
- public bool IsDisposed { get; set; }
- public void Dispose()
- {
- Assert.IsFalse(IsDisposed);
- IsDisposed = true;
- }
- }
-
- [TestMethod]
- public void NonSharedPart_Disposable_ShouldNotBeCollected()
- {
- var catalog = new TypeCatalog(typeof(NonSharedPartDisposable));
- var container = new CompositionContainer(catalog);
-
- var refTracker = new ReferenceTracker();
-
- refTracker.AddReferencesNotExpectedToBeCollected(
- container.GetExportedValue<NonSharedPartDisposable>());
-
- refTracker.CollectAndAssert();
-
- GC.KeepAlive(container);
- }
-
- [TestMethod]
- public void NonSharedPart_Disposable_ShouldBeDisposedWithContainer()
- {
- var catalog = new TypeCatalog(typeof(NonSharedPartDisposable));
- var container = new CompositionContainer(catalog);
-
- var export = container.GetExportedValue<NonSharedPartDisposable>();
-
- Assert.IsFalse(export.IsDisposed);
-
- container.Dispose();
-
- Assert.IsTrue(export.IsDisposed, "NonSharedParts should be disposed with the container!");
- }
-
- [TestMethod]
- public void NonSharedPart_RecomposableImport_WithReference_ShouldNotBeCollected()
- {
- var catalog = new TypeCatalog(typeof(NonSharedPartRecomposable));
- var container = new CompositionContainer(catalog);
-
- // Setup dependency
- CompositionBatch batch = new CompositionBatch();
- var valueKey = batch.AddExportedValue("Value", 21);
- container.Compose(batch);
- batch = null;
-
- var exportedValue = container.GetExportedValue<NonSharedPartRecomposable>();
-
- var refTracker = new ReferenceTracker();
-
- refTracker.AddReferencesNotExpectedToBeCollected(exportedValue);
-
- refTracker.CollectAndAssert();
-
- // Recompose should work because we are still holding a reference to the exported value.
- batch = new CompositionBatch();
- batch.RemovePart(valueKey);
- batch.AddExportedValue("Value", 42);
- container.Compose(batch);
- batch = null;
-
- Assert.AreEqual(42, exportedValue.Value, "Value should have been recomposed");
-
- GC.KeepAlive(container);
- }
-
- [TestMethod]
- public void NonSharedPart_DisposableRecomposabeImport_NoReference_ShouldNotBeCollected()
- {
- var catalog = new TypeCatalog(typeof(NonSharedPartDisposableRecomposable));
- var container = new CompositionContainer(catalog);
-
- // Setup dependency
- CompositionBatch batch = new CompositionBatch();
- var valueKey = batch.AddExportedValue("Value", 21);
- container.Compose(batch);
- batch = null;
-
- var refTracker = new ReferenceTracker();
-
- refTracker.AddReferencesNotExpectedToBeCollected(
- container.GetExportedValue<NonSharedPartDisposableRecomposable>());
-
- refTracker.CollectAndAssert();
-
- // Recompose just to ensure we don't blow up, even though we don't expect anything to happen.
- batch = new CompositionBatch();
- batch.RemovePart(valueKey);
- batch.AddExportedValue("Value", 42);
- container.Compose(batch);
- batch = null;
-
- var exportedValue = (NonSharedPartDisposableRecomposable)refTracker.ReferencesNotExpectedToBeCollected[0].Target;
- Assert.AreEqual(42, exportedValue.Value, "Value shoudl ahve been recomposed.");
-
- GC.KeepAlive(container);
- }
-
- [Export]
- public class SharedState
- {
- public static int instanceNumber = 0;
- public SharedState()
- {
- MyInstanceNumber = instanceNumber++;
- }
-
- public int MyInstanceNumber { get; private set; }
- }
-
- [PartCreationPolicy(CreationPolicy.NonShared)]
- public class NonSharedState
- {
- [Import(AllowRecomposition = true)]
- public SharedState State { set { ExportState = value; } }
-
- [Export("SharedFromNonShared")]
- public SharedState ExportState { get; private set; }
- }
-
- [TestMethod]
- public void NonSharedPart_TwoRecomposablePartsSameExportedValue()
- {
- // This test is primarily used to ensure that we allow for multiple parts to be associated
- // with the same exported value.
- var catalog = new TypeCatalog(typeof(SharedState), typeof(NonSharedState));
- var container = new CompositionContainer(catalog);
-
- var export1 = container.GetExportedValue<SharedState>("SharedFromNonShared");
- var export2 = container.GetExportedValue<SharedState>("SharedFromNonShared");
-
- // Same exported value that comes from two different recomposable part instances.
- Assert.AreEqual(export1.MyInstanceNumber, export2.MyInstanceNumber, "Should be the same shared object!");
- }
-
- [Export]
- [PartCreationPolicy(CreationPolicy.NonShared)]
- public class SharedImporter
- {
- [Import(RequiredCreationPolicy = CreationPolicy.Shared)]
- public AnyPartSimple AnyPartSimple { get; set; }
-
- [Import(RequiredCreationPolicy = CreationPolicy.Shared)]
- public AnyPartDisposable AnyPartDisposable { get; set; }
-
- [Import(RequiredCreationPolicy = CreationPolicy.Shared)]
- public AnyPartRecomposable AnyPartRecomposable { get; set; }
-
- [Import(RequiredCreationPolicy = CreationPolicy.Shared)]
- public AnyPartDisposableRecomposable AnyPartDisposableRecomposable { get; set; }
- }
-
- [Export]
- [PartCreationPolicy(CreationPolicy.NonShared)]
- public class NonSharedImporter
- {
- [Import(RequiredCreationPolicy = CreationPolicy.NonShared)]
- public AnyPartSimple AnyPartSimple { get; set; }
-
- [Import(RequiredCreationPolicy = CreationPolicy.NonShared)]
- public AnyPartDisposable AnyPartDisposable { get; set; }
-
- [Import(RequiredCreationPolicy = CreationPolicy.NonShared)]
- public AnyPartRecomposable AnyPartRecomposable { get; set; }
-
- [Import(RequiredCreationPolicy = CreationPolicy.NonShared)]
- public AnyPartDisposableRecomposable AnyPartDisposableRecomposable { get; set; }
- }
-
- private static CompositionContainer GetContainer()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(LifetimeTests).GetNestedTypes(BindingFlags.Public));
- CompositionBatch batch = new CompositionBatch();
- batch.AddExportedValue("Value", 21);
- container.Compose(batch);
- return container;
- }
-
- [TestMethod]
- public void GetReleaseExport_SharedRoot_ShouldNotDisposeChain()
- {
- var container = GetContainer();
-
- var export = container.GetExport<SharedImporter, IDictionary<string, object>>();
- var exportedValue = export.Value;
-
- container.ReleaseExport(export);
-
- Assert.IsFalse(exportedValue.AnyPartDisposable.IsDisposed);
- Assert.IsFalse(exportedValue.AnyPartDisposableRecomposable.IsDisposed);
- }
-
- [TestMethod]
- public void AddRemovePart_SharedRoot_ShouldNotDisposeChain()
- {
- var container = GetContainer();
-
- var exportedValue = new SharedImporter();
-
- CompositionBatch batch = new CompositionBatch();
- var part = batch.AddPart(exportedValue);
- container.Compose(batch);
-
- batch = new CompositionBatch();
- batch.RemovePart(part);
- container.Compose(batch);
-
- Assert.IsFalse(exportedValue.AnyPartDisposable.IsDisposed);
- Assert.IsFalse(exportedValue.AnyPartDisposableRecomposable.IsDisposed);
- }
-
- [TestMethod]
- public void ContainerDispose_SharedRoot_ShouldDisposeChain()
- {
- var container = GetContainer();
-
- var export = container.GetExport<SharedImporter>();
- var exportedValue = export.Value;
-
- container.Dispose();
-
- Assert.IsTrue(exportedValue.AnyPartDisposable.IsDisposed);
- Assert.IsTrue(exportedValue.AnyPartDisposableRecomposable.IsDisposed);
- }
-
- [TestMethod]
- public void GetReleaseExport_NonSharedRoot_ShouldDisposeChain()
- {
- var container = GetContainer();
-
- var exports = new List<Lazy<NonSharedImporter>>();
- var exportedValues = new List<NonSharedImporter>();
-
- // Executing this 100 times to help uncover any GC bugs
- for (int i = 0; i < 100; i++)
- {
- var export = container.GetExport<NonSharedImporter>();
- var exportedValue = export.Value;
-
- exports.Add(export);
- exportedValues.Add(exportedValue);
- }
-
- for (int i = 0; i < 100; i++)
- {
- var export = exports[i];
- var exportedValue = exportedValues[i];
-
- container.ReleaseExport(export);
-
- Assert.IsTrue(exportedValue.AnyPartDisposable.IsDisposed);
- Assert.IsTrue(exportedValue.AnyPartDisposableRecomposable.IsDisposed);
- }
- }
-
- public void GetReleaseExport_NonSharedRoot_ShouldDisposeChain_WithMetadata()
- {
- var container = GetContainer();
-
- var exports = new List<Lazy<NonSharedImporter, IDictionary<string, object>>>();
- var exportedValues = new List<NonSharedImporter>();
-
- // Executing this 100 times to help uncover any GC bugs
- for (int i = 0; i < 100; i++)
- {
- var export = container.GetExport<NonSharedImporter, IDictionary<string, object>>();
- var exportedValue = export.Value;
-
- exports.Add(export);
- exportedValues.Add(exportedValue);
- }
-
- for (int i = 0; i < 100; i++)
- {
- var export = exports[i];
- var exportedValue = exportedValues[i];
-
- container.ReleaseExport(export);
-
- Assert.IsTrue(exportedValue.AnyPartDisposable.IsDisposed);
- Assert.IsTrue(exportedValue.AnyPartDisposableRecomposable.IsDisposed);
- }
- }
-
- [TestMethod]
- public void ReleaseExports_ShouldDispose_NonSharedParts()
- {
- var container = GetContainer();
-
- var export1 = container.GetExport<NonSharedImporter>();
- var exportedValue1 = export1.Value;
-
- var export2 = container.GetExport<NonSharedImporter>();
- var exportedValue2 = export2.Value;
-
- container.ReleaseExports(new[] { export1, export2 });
-
- Assert.IsTrue(exportedValue1.AnyPartDisposable.IsDisposed);
- Assert.IsTrue(exportedValue1.AnyPartDisposableRecomposable.IsDisposed);
-
- Assert.IsTrue(exportedValue2.AnyPartDisposable.IsDisposed);
- Assert.IsTrue(exportedValue2.AnyPartDisposableRecomposable.IsDisposed);
- }
-
-
- [TestMethod]
- public void AddRemovePart_NonSharedRoot_ShouldDisposeChain()
- {
- var container = GetContainer();
-
- var exportedValue = new NonSharedImporter();
-
- CompositionBatch batch = new CompositionBatch();
- var part = batch.AddPart(exportedValue);
- container.Compose(batch);
-
- batch = new CompositionBatch();
- batch.RemovePart(part);
- container.Compose(batch);
-
- Assert.IsTrue(exportedValue.AnyPartDisposable.IsDisposed);
- Assert.IsTrue(exportedValue.AnyPartDisposableRecomposable.IsDisposed);
- }
-
- [TestMethod]
- public void ContainerDispose_NonSharedRoot_ShouldNotDisposeChain()
- {
- var container = GetContainer();
-
- var export = container.GetExport<NonSharedImporter>();
- var exportedValue = export.Value;
-
- container.Dispose();
-
- Assert.IsTrue(exportedValue.AnyPartDisposable.IsDisposed);
- Assert.IsTrue(exportedValue.AnyPartDisposableRecomposable.IsDisposed);
- }
-
- [TestMethod]
- public void GetReleaseExport_NonSharedPart_ShouldNotRecomposeAfterRelease()
- {
- var catalog = new TypeCatalog(typeof(NonSharedPartRecomposable));
- var container = new CompositionContainer(catalog);
-
- // Setup dependency
- CompositionBatch batch = new CompositionBatch();
- var valueKey = batch.AddExportedValue("Value", 21);
- container.Compose(batch);
-
- var export = container.GetExport<NonSharedPartRecomposable>();
- var exportedValue = export.Value;
-
- Assert.AreEqual(21, exportedValue.Value);
-
- container.ReleaseExport(export);
-
- // Recompose just to ensure we don't blow up, even though we don't expect anything to happen.
- batch = new CompositionBatch();
- batch.RemovePart(valueKey);
- batch.AddExportedValue("Value", 42);
- container.Compose(batch);
-
- Assert.AreEqual(21, exportedValue.Value, "Value should not be recomposed after ReleaseExport is called on it.");
- }
-
- [TestMethod]
- public void GetExportManualDisposeThenRecompose_NonSharedDisposableRecomposablePart_ShouldThrowComposition()
- {
- var catalog = new TypeCatalog(typeof(NonSharedPartDisposableRecomposable));
- var container = new CompositionContainer(catalog);
-
- // Setup dependency
- CompositionBatch batch = new CompositionBatch();
- var valueKey = batch.AddExportedValue("Value", 21);
- container.Compose(batch);
-
- var export = container.GetExport<NonSharedPartDisposableRecomposable>();
- var exportedValue = export.Value;
-
- Assert.AreEqual(21, exportedValue.Value);
-
- exportedValue.Dispose();
-
- // Recompose should cause a ObjectDisposedException.
- batch = new CompositionBatch();
- batch.RemovePart(valueKey);
- batch.AddExportedValue("Value", 42);
-
- CompositionAssert.ThrowsError(
- ErrorId.ImportEngine_PartCannotActivate, // Cannot activate part because
- ErrorId.ReflectionModel_ImportThrewException, // Import threw an exception
- RetryMode.DoNotRetry,
- () =>
- {
- container.Compose(batch);
- });
- }
-
- [Export]
- public class MyImporter
- {
- [Import(AllowDefault = true, AllowRecomposition = true, RequiredCreationPolicy = CreationPolicy.NonShared)]
- public AnyPartDisposable AnyPartDisposable { get; set; }
- }
-
- [TestMethod]
- public void RecomposeCausesOldImportedValuesToBeDisposed()
- {
- var cat = new AggregateCatalog();
- var cat1 = new TypeCatalog(typeof(AnyPartDisposable));
-
- cat.Catalogs.Add(new TypeCatalog(typeof (MyImporter)));
- cat.Catalogs.Add(cat1);
-
- var container = new CompositionContainer(cat);
-
- var importer = container.GetExportedValue<MyImporter>();
-
- var anyPart = importer.AnyPartDisposable;
-
- Assert.IsFalse(anyPart.IsDisposed);
- Assert.IsInstanceOfType(anyPart, typeof(AnyPartDisposable));
-
- // Remove the instance of MyClass1
- cat.Catalogs.Remove(cat1);
-
- Assert.IsNull(importer.AnyPartDisposable);
- Assert.IsTrue(anyPart.IsDisposed);
- }
-
- private static CompositionContainer CreateParentChildContainerWithNonSharedImporter()
- {
- var parentCat = CatalogFactory.CreateAttributed(typeof(AnyPartDisposable),
- typeof(AnyPartDisposableRecomposable),
- typeof(AnyPartRecomposable),
- typeof(AnyPartSimple));
- var parent = new CompositionContainer(parentCat);
- CompositionBatch batch = new CompositionBatch();
- batch.AddExportedValue("Value", 21);
- parent.Compose(batch);
-
- var childCat = CatalogFactory.CreateAttributed(typeof(NonSharedImporter));
- var child = new CompositionContainer(childCat, parent);
-
- return child;
- }
-
- [TestMethod]
- public void ChildContainerGetReleaseExport_NonSharedRoot_ShouldDisposeChain()
- {
- var child = CreateParentChildContainerWithNonSharedImporter();
-
- var export = child.GetExport<NonSharedImporter>();
- var exportedValue = export.Value;
-
- child.ReleaseExport(export);
-
- Assert.IsTrue(exportedValue.AnyPartDisposable.IsDisposed);
- Assert.IsTrue(exportedValue.AnyPartDisposableRecomposable.IsDisposed);
- }
-
- [TestMethod]
- public void ChildContainerAddRemovePart_NonSharedRoot_ShouldDisposeChain()
- {
- var child = CreateParentChildContainerWithNonSharedImporter();
-
- var exportedValue = new NonSharedImporter();
-
- CompositionBatch batch = new CompositionBatch();
- var part = batch.AddPart(exportedValue);
- child.Compose(batch);
-
- batch = new CompositionBatch();
- batch.RemovePart(part);
- child.Compose(batch);
-
- Assert.IsTrue(exportedValue.AnyPartDisposable.IsDisposed);
- Assert.IsTrue(exportedValue.AnyPartDisposableRecomposable.IsDisposed);
- }
-
- [TestMethod]
- public void ChildContainerAddRemovePart_NonSharedRoot_ShouldNotDisposeChain()
- {
- var child = CreateParentChildContainerWithNonSharedImporter();
-
- var exportedValue = child.GetExportedValue<NonSharedImporter>();
-
- child.Dispose();
-
- Assert.IsFalse(exportedValue.AnyPartDisposable.IsDisposed);
- Assert.IsFalse(exportedValue.AnyPartDisposableRecomposable.IsDisposed);
- }
-
-#if CLR40
-
- [TestMethod]
- public void NonSharedPart_Simple_ShouldBeCollected()
- {
- var catalog = new TypeCatalog(typeof(NonSharedPartSimple));
- var container = new CompositionContainer(catalog);
-
- var refTracker = new ReferenceTracker();
-
- refTracker.AddReferencesExpectedToBeCollected(
- container.GetExportedValue<NonSharedPartSimple>());
-
- refTracker.CollectAndAssert();
-
- GC.KeepAlive(container);
- }
-
- [TestMethod]
- public void ContainerDispose_SharedPart_ShouldCollectWholeObjectChain()
- {
- // Test only works properly with while using the real ConditionalWeakTable
- var container = GetContainer();
-
- var export = container.GetExport<SharedImporter>();
- var exportedValue = export.Value;
-
- container.Dispose();
-
- var refTracker = new ReferenceTracker();
-
- refTracker.AddReferencesExpectedToBeCollected(
- exportedValue,
- exportedValue.AnyPartDisposable,
- exportedValue.AnyPartDisposableRecomposable,
- exportedValue.AnyPartRecomposable,
- exportedValue.AnyPartSimple);
-
- export = null;
- exportedValue = null;
-
- refTracker.CollectAndAssert();
-
- GC.KeepAlive(container);
- }
-
- [TestMethod]
- public void AddRemovePart_SharedPart_ShouldCollectOnlyRoot()
- {
- var container = GetContainer();
-
- var exportedValue = new SharedImporter();
-
- CompositionBatch batch = new CompositionBatch();
- var part = batch.AddPart(exportedValue);
- container.Compose(batch);
- batch = null;
-
- batch = new CompositionBatch();
- batch.RemovePart(part);
- container.Compose(batch);
- batch = null;
-
- var refTracker = new ReferenceTracker();
-
- refTracker.AddReferencesExpectedToBeCollected(
- exportedValue);
-
- refTracker.AddReferencesNotExpectedToBeCollected(
- exportedValue.AnyPartDisposable,
- exportedValue.AnyPartDisposableRecomposable,
- exportedValue.AnyPartRecomposable,
- exportedValue.AnyPartSimple);
-
- part = null;
- exportedValue = null;
-
- refTracker.CollectAndAssert();
-
- GC.KeepAlive(container);
- }
-
- [TestMethod]
- public void AddRemovePart_NonSharedPart_ShouldCollectWholeObjectChain()
- {
- var container = GetContainer();
-
- var exportedValue = new NonSharedImporter();
-
- CompositionBatch batch = new CompositionBatch();
- var part = batch.AddPart(exportedValue);
- container.Compose(batch);
- batch = null;
-
- batch = new CompositionBatch();
- batch.RemovePart(part);
- container.Compose(batch);
- batch = null;
-
- var refTracker = new ReferenceTracker();
-
- refTracker.AddReferencesExpectedToBeCollected(
- exportedValue,
- exportedValue.AnyPartDisposable,
- exportedValue.AnyPartDisposableRecomposable,
- exportedValue.AnyPartRecomposable,
- exportedValue.AnyPartSimple);
-
- part = null;
- exportedValue = null;
-
- refTracker.CollectAndAssert();
-
- GC.KeepAlive(container);
- }
-
- [TestMethod]
- public void ContainerDispose_NonSharedPart_ShouldCollectWholeObjectChain()
- {
- // Test only works properly with while using the real ConditionalWeakTable
- var container = GetContainer();
-
- var export = container.GetExport<NonSharedImporter>();
- var exportedValue = export.Value;
-
- container.Dispose();
-
- var refTracker = new ReferenceTracker();
-
- refTracker.AddReferencesExpectedToBeCollected(
- exportedValue,
- exportedValue.AnyPartDisposable,
- exportedValue.AnyPartDisposableRecomposable,
- exportedValue.AnyPartRecomposable,
- exportedValue.AnyPartSimple);
-
- export = null;
- exportedValue = null;
-
- refTracker.CollectAndAssert();
-
- GC.KeepAlive(container);
- }
-
- [TestMethod]
- public void NonSharedImporter_ReleaseReference_ShouldCollectWholeChain()
- {
- var container = GetContainer();
-
- var export = container.GetExport<NonSharedImporter>();
- var exportedValue = export.Value;
-
- var refTracker = new ReferenceTracker();
-
- // Non-Disposable references in the chain should be GC'ed
- refTracker.AddReferencesExpectedToBeCollected(
- exportedValue,
- exportedValue.AnyPartRecomposable,
- exportedValue.AnyPartSimple);
-
- // Disposable references in the chain should NOT be GC'ed
- refTracker.AddReferencesNotExpectedToBeCollected(
- exportedValue.AnyPartDisposable,
- exportedValue.AnyPartDisposableRecomposable);
-
- export = null;
- exportedValue = null;
-
- refTracker.CollectAndAssert();
-
- GC.KeepAlive(container);
- }
-
- [TestMethod]
- public void ChildContainerDispose_NonSharedPart_ShouldOnlyCleanupChildAndSimpleNonShared()
- {
- var child = CreateParentChildContainerWithNonSharedImporter();
-
- var exportedValue = child.GetExportedValue<NonSharedImporter>();
-
- child.Dispose();
-
- var refTracker = new ReferenceTracker();
-
- refTracker.AddReferencesExpectedToBeCollected(
- exportedValue, // object in child
- exportedValue.AnyPartSimple, // No reference parent so collected.
- exportedValue.AnyPartRecomposable);
-
- // These are in the parent and will not be cleaned out
- refTracker.AddReferencesNotExpectedToBeCollected(
- exportedValue.AnyPartDisposable,
- exportedValue.AnyPartDisposableRecomposable);
-
- exportedValue = null;
-
- refTracker.CollectAndAssert();
-
- GC.KeepAlive(child);
- }
-
- [TestMethod]
- public void ChildContainerGetReleaseExport_NonSharedPart_ShouldCollectWholeObjectChain()
- {
- var child = CreateParentChildContainerWithNonSharedImporter();
-
- var export = child.GetExport<NonSharedImporter>();
- var exportedValue = export.Value;
-
- child.ReleaseExport(export);
-
- var refTracker = new ReferenceTracker();
-
- refTracker.AddReferencesExpectedToBeCollected(
- exportedValue,
- exportedValue.AnyPartDisposable,
- exportedValue.AnyPartDisposableRecomposable,
- exportedValue.AnyPartRecomposable,
- exportedValue.AnyPartSimple);
-
- export = null;
- exportedValue = null;
-
- refTracker.CollectAndAssert();
-
- GC.KeepAlive(child);
- }
-
- [TestMethod]
- public void NonSharedPart_RecomposableImport_NoReference_ShouldBeCollected()
- {
- var catalog = new TypeCatalog(typeof(NonSharedPartRecomposable));
- var container = new CompositionContainer(catalog);
-
- // Setup dependency
- CompositionBatch batch = new CompositionBatch();
- var valueKey = batch.AddExportedValue("Value", 21);
- container.Compose(batch);
- batch = null;
-
- var refTracker = new ReferenceTracker();
-
- refTracker.AddReferencesExpectedToBeCollected(
- container.GetExportedValue<NonSharedPartRecomposable>());
-
- refTracker.CollectAndAssert();
-
- // Recompose just to ensure we don't blow up, even though we don't expect anything to happen.
- batch = new CompositionBatch();
- batch.RemovePart(valueKey);
- batch.AddExportedValue("Value", 42);
- container.Compose(batch);
- batch = null;
-
- GC.KeepAlive(container);
- }
-
- [TestMethod]
- public void ChildContainerAddRemovePart_NonSharedPart_ShouldCollectWholeObjectChain()
- {
- var child = CreateParentChildContainerWithNonSharedImporter();
-
- var exportedValue = new NonSharedImporter();
-
- CompositionBatch batch = new CompositionBatch();
- var part = batch.AddPart(exportedValue);
- child.Compose(batch);
- batch = null;
-
- batch = new CompositionBatch();
- batch.RemovePart(part);
- child.Compose(batch);
- batch = null;
-
- var refTracker = new ReferenceTracker();
-
- refTracker.AddReferencesExpectedToBeCollected(
- exportedValue,
- exportedValue.AnyPartDisposable,
- exportedValue.AnyPartDisposableRecomposable,
- exportedValue.AnyPartRecomposable,
- exportedValue.AnyPartSimple);
-
- part = null;
- exportedValue = null;
-
- refTracker.CollectAndAssert();
-
- GC.KeepAlive(child);
- }
-
- [TestMethod]
- public void GetReleaseExport_SharedPart_ShouldCollectOnlyRoot()
- {
- var container = GetContainer();
-
- var export = container.GetExport<SharedImporter>();
- var exportedValue = export.Value;
-
- container.ReleaseExport(export);
-
- var refTracker = new ReferenceTracker();
-
- refTracker.AddReferencesExpectedToBeCollected(
- exportedValue);
-
- refTracker.AddReferencesNotExpectedToBeCollected(
- exportedValue.AnyPartDisposable,
- exportedValue.AnyPartDisposableRecomposable,
- exportedValue.AnyPartRecomposable,
- exportedValue.AnyPartSimple);
-
- export = null;
- exportedValue = null;
-
- refTracker.CollectAndAssert();
-
- GC.KeepAlive(container);
- }
-
- [TestMethod]
- public void GetReleaseExport_NonSharedPart_ShouldCollectWholeObjectChain()
- {
- var container = GetContainer();
-
- var export = container.GetExport<NonSharedImporter>();
- var exportedValue = export.Value;
-
- container.ReleaseExport(export);
-
- var refTracker = new ReferenceTracker();
-
- refTracker.AddReferencesExpectedToBeCollected(
- exportedValue,
- exportedValue.AnyPartDisposable,
- exportedValue.AnyPartDisposableRecomposable,
- exportedValue.AnyPartRecomposable,
- exportedValue.AnyPartSimple);
-
- export = null;
- exportedValue = null;
-
- refTracker.CollectAndAssert();
-
- GC.KeepAlive(container);
- }
-
- [TestMethod]
- public void ReleaseExports_ShouldWorkWithExportCollection()
- {
- var container = GetContainer();
- var exports = container.GetExports<NonSharedImporter>();
-
- Assert.IsTrue(exports.Count() > 0);
-
- var exportedValues = exports.Select(export => export.Value).ToList();
-
- container.ReleaseExports(exports);
-
- foreach (var obj in exportedValues)
- {
- Assert.IsTrue(obj.AnyPartDisposable.IsDisposed);
- Assert.IsTrue(obj.AnyPartDisposableRecomposable.IsDisposed);
- }
- }
-#endif
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/PartCreatorTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/PartCreatorTests.cs deleted file mode 100644 index 1ce835664bb..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/PartCreatorTests.cs +++ /dev/null @@ -1,368 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.AttributedModel;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.UnitTesting;
-using System.Linq;
-using System.Reflection;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.Diagnostics;
-using System.ComponentModel.Composition.ReflectionModel;
-
-#if SILVERLIGHT
-
-namespace Tests.Integration
-{
- [TestClass]
- public class PartCreatorTests
- {
- public interface IId
- {
- int Id { get; }
- }
-
- public interface IIdTypeMetadata
- {
- string IdType { get; }
- string ExportTypeIdentity { get; }
- }
-
-
- [Export(typeof(IId))]
- [ExportMetadata("IdType", "PostiveIncrement")]
- public class UniqueExport : IId, IDisposable
- {
- private static int lastId = 0;
-
- public UniqueExport()
- {
- Id = lastId++;
- }
-
- public int Id { get; private set; }
-
- public void Dispose()
- {
- Id = -1;
- }
- }
-
- [Export]
- [CLSCompliant(false)]
- public class PartCreatorImporter
- {
- [ImportingConstructor]
- public PartCreatorImporter(
- PartCreator<IId> idCreatorTCtor,
- PartCreator<IId, IIdTypeMetadata> idCreatorTMCtor)
- {
- this._idCreatorTCtor = idCreatorTCtor;
- this._idCreatorTMCtor = idCreatorTMCtor;
- }
-
- private PartCreator<IId> _idCreatorTCtor;
- private PartCreator<IId, IIdTypeMetadata> _idCreatorTMCtor;
-
- [Import(typeof(IId))]
- public PartCreator<IId> _idCreatorTField = null; // public so these can work on SL
-
- [Import]
- public PartCreator<IId, IIdTypeMetadata> _idCreatorTMField = null; // public so these can work on SL
-
- [Import]
- public PartCreator<IId> IdCreatorTProperty { get; set; }
-
- [Import(typeof(IId))]
- public PartCreator<IId, IIdTypeMetadata> IdCreatorTMProperty { get; set; }
-
- [ImportMany]
- public PartCreator<IId>[] IdCreatorsTProperty { get; set; }
-
- [ImportMany]
- public PartCreator<IId, IIdTypeMetadata>[] IdCreatorsTMProperty { get; set; }
-
- public void AssertValid()
- {
- var ids = new int[]
- {
- VerifyPartCreator(this._idCreatorTCtor),
- VerifyPartCreator(this._idCreatorTMCtor),
- VerifyPartCreator(this._idCreatorTField),
- VerifyPartCreator(this._idCreatorTMField),
- VerifyPartCreator(this.IdCreatorTProperty),
- VerifyPartCreator(this.IdCreatorTMProperty),
- VerifyPartCreator(this.IdCreatorsTProperty[0]),
- VerifyPartCreator(this.IdCreatorsTMProperty[0])
- };
-
- Assert.AreEqual(1, this.IdCreatorsTProperty.Length, "Should only be one PartCreator");
- Assert.AreEqual(1, this.IdCreatorsTMProperty.Length, "Should only be one PartCreator");
-
- CollectionAssert.AllItemsAreUnique(ids, "There should be no duplicate ids");
- }
-
- private int VerifyPartCreator(PartCreator<IId> creator)
- {
- var val1 = creator.CreatePart();
- var val2 = creator.CreatePart();
-
- Assert.AreNotEqual(val1.ExportedValue, val2.ExportedValue, "Values should not be the same");
- Assert.AreNotEqual(val1.ExportedValue.Id, val2.ExportedValue.Id, "Value Ids should not be the same");
-
- Assert.IsTrue(val1.ExportedValue.Id >= 0, "Id should be positive");
-
- val1.Dispose();
-
- Assert.IsTrue(val1.ExportedValue.Id < 0, "Disposal of the value should set the id to negative");
-
- return creator.CreatePart().ExportedValue.Id;
- }
-
- private int VerifyPartCreator(PartCreator<IId, IIdTypeMetadata> creator)
- {
- var val = VerifyPartCreator((PartCreator<IId>)creator);
-
- Assert.AreEqual("PostiveIncrement", creator.Metadata.IdType, "IdType should be PositiveIncrement");
- Assert.AreEqual(AttributedModelServices.GetTypeIdentity(typeof(ComposablePartDefinition)), creator.Metadata.ExportTypeIdentity);
-
- return val;
- }
- }
-
- [TestMethod]
- public void PartCreatorStandardImports_ShouldWorkProperly()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(UniqueExport), typeof(PartCreatorImporter));
- var partCreatorImporter = container.GetExportedValue<PartCreatorImporter>();
-
- partCreatorImporter.AssertValid();
- }
-
- [Export]
- public class Foo : IDisposable
- {
- public bool IsDisposed { get; private set; }
-
- public void Dispose()
- {
- this.IsDisposed = true;
- }
- }
-
- [Export]
- public class SimplePartCreatorImporter
- {
- [Import]
- public PartCreator<Foo> FooFactory { get; set; }
- }
-
- [TestMethod]
- public void PartCreatorOfT_RecompositionSingle_ShouldBlockChanges()
- {
- var aggCat = new AggregateCatalog();
- var typeCat = new TypeCatalog(typeof(Foo));
- aggCat.Catalogs.Add(new TypeCatalog(typeof(SimplePartCreatorImporter)));
- aggCat.Catalogs.Add(typeCat);
-
- var container = new CompositionContainer(aggCat);
-
- var fooFactory = container.GetExportedValue<SimplePartCreatorImporter>();
-
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- aggCat.Catalogs.Remove(typeCat));
-
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- aggCat.Catalogs.Add(new TypeCatalog(typeof(Foo))));
- }
-
- [Export]
- public class ManyPartCreatorImporter
- {
- [ImportMany(AllowRecomposition = true)]
- public PartCreator<Foo>[] FooFactories { get; set; }
- }
-
- [TestMethod]
- public void FactoryOfT_RecompositionImportMany_ShouldSucceed()
- {
- var aggCat = new AggregateCatalog();
- var typeCat = new TypeCatalog(typeof(Foo));
- aggCat.Catalogs.Add(new TypeCatalog(typeof(ManyPartCreatorImporter)));
- aggCat.Catalogs.Add(typeCat);
-
- var container = new CompositionContainer(aggCat);
-
- var fooFactories = container.GetExportedValue<ManyPartCreatorImporter>();
-
- Assert.AreEqual(1, fooFactories.FooFactories.Length);
-
- aggCat.Catalogs.Add(new TypeCatalog(typeof(Foo)));
-
- Assert.AreEqual(2, fooFactories.FooFactories.Length);
- }
-
- public class PartCreatorExplicitCP
- {
- [Import(RequiredCreationPolicy = CreationPolicy.Any)]
- public PartCreator<Foo> FooCreatorAny { get; set; }
-
- [Import(RequiredCreationPolicy = CreationPolicy.NonShared)]
- public PartCreator<Foo> FooCreatorNonShared { get; set; }
-
- [Import(RequiredCreationPolicy = CreationPolicy.Shared)]
- public PartCreator<Foo> FooCreatorShared { get; set; }
-
- [ImportMany(RequiredCreationPolicy = CreationPolicy.Any)]
- public PartCreator<Foo>[] FooCreatorManyAny { get; set; }
-
- [ImportMany(RequiredCreationPolicy = CreationPolicy.NonShared)]
- public PartCreator<Foo>[] FooCreatorManyNonShared { get; set; }
-
- [ImportMany(RequiredCreationPolicy = CreationPolicy.Shared)]
- public PartCreator<Foo>[] FooCreatorManyShared { get; set; }
- }
-
- [TestMethod]
- public void PartCreator_ExplicitCreationPolicy_CPShouldBeIgnored()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(Foo));
-
- var part = new PartCreatorExplicitCP();
-
- container.SatisfyImportsOnce(part);
-
- // specifying the required creation policy explicit on the import
- // of a PartCreator will be ignored because the PartCreator requires
- // the part it wraps to be either Any or NonShared to work properly.
- Assert.IsNotNull(part.FooCreatorAny);
- Assert.IsNotNull(part.FooCreatorNonShared);
- Assert.IsNotNull(part.FooCreatorShared);
-
- Assert.AreEqual(1, part.FooCreatorManyAny.Length);
- Assert.AreEqual(1, part.FooCreatorManyNonShared.Length);
- Assert.AreEqual(1, part.FooCreatorManyShared.Length);
- }
-
- public class PartCreatorImportRequiredMetadata
- {
- [ImportMany]
- public PartCreator<Foo>[] FooCreator { get; set; }
-
- [ImportMany]
- public PartCreator<Foo, IIdTypeMetadata>[] FooCreatorWithMetadata { get; set; }
- }
-
- [TestMethod]
- public void PartCreator_ImportRequiredMetadata_MissingMetadataShouldCauseImportToBeExcluded()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(Foo));
-
- var part = new PartCreatorImportRequiredMetadata();
-
- container.SatisfyImportsOnce(part);
-
- Assert.AreEqual(1, part.FooCreator.Length, "Should contain the one Foo");
- Assert.AreEqual(0, part.FooCreatorWithMetadata.Length, "Should NOT contain Foo because it is missing the required Id metadata property");
- }
-
- [Export(typeof(Foo))]
- [PartCreationPolicy(CreationPolicy.Shared)]
- public class SharedFoo : Foo
- {
- }
-
- [TestMethod]
- public void PartCreator_ImportShouldNotImportSharedPart()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(SharedFoo));
-
- var foo = container.GetExportedValue<Foo>();
- Assert.IsNotNull(foo, "Ensure that a Foo actually exists in the container");
-
- var part = new PartCreatorImportRequiredMetadata();
-
- container.SatisfyImportsOnce(part);
-
- Assert.AreEqual(0, part.FooCreator.Length, "Should not contain the SharedFoo because the PartCreator should only wrap Any/NonShared parts");
- }
-
-
- [TestMethod]
- public void PartCreator_QueryContainerDirectly_ShouldWork()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(Foo));
-
- var importDef = ReflectionModelServices.CreateImportDefinition(
- new LazyMemberInfo(MemberTypes.Field, () => new MemberInfo[] { typeof(PartCreatorTests) }), // Give it a bogus member
- AttributedModelServices.GetContractName(typeof(Foo)),
- AttributedModelServices.GetTypeIdentity(typeof(Foo)),
- Enumerable.Empty<KeyValuePair<string, Type>>(),
- ImportCardinality.ZeroOrMore,
- true,
- CreationPolicy.Any,
- true, // isPartCreator
- null);
-
- var exports = container.GetExports(importDef);
-
- var partCreator = exports.Single();
-
- // Manually walk the steps of using a raw part creator which is modeled as a PartDefinition with
- // a single ExportDefinition.
- var partDef = (ComposablePartDefinition)partCreator.Value;
- var part = partDef.CreatePart();
- var foo = (Foo)part.GetExportedValue(partDef.ExportDefinitions.Single());
-
- Assert.IsNotNull(foo);
-
- var foo1 = (Foo)part.GetExportedValue(partDef.ExportDefinitions.Single());
- Assert.AreEqual(foo, foo1, "Retrieving the exported value from the same part should return the same value");
-
- // creating a new part should result in getting a new exported value
- var part2 = partDef.CreatePart();
- var foo2 = (Foo)part2.GetExportedValue(partDef.ExportDefinitions.Single());
-
- Assert.AreNotEqual(foo, foo2, "New part should equate to a new exported value");
-
- // Disposing of part should cause foo to be disposed
- ((IDisposable)part).Dispose();
- Assert.IsTrue(foo.IsDisposed);
- }
-
- [Export]
- public class PartImporter<PartType>
- {
- [Import]
- public PartCreator<PartType> Creator { get; set; }
- }
-
- [Export]
- public class SimpleExport
- {
- }
-
- [TestMethod]
- public void PartCreator_SimpleRejectionRecurrection_ShouldWork()
- {
- var importTypeCat = new TypeCatalog(typeof(PartImporter<SimpleExport>));
- var aggCatalog = new AggregateCatalog(importTypeCat);
- var container = ContainerFactory.Create(aggCatalog);
- var exports = container.GetExports<PartImporter<SimpleExport>>();
- Assert.AreEqual(0, exports.Count());
-
- aggCatalog.Catalogs.Add(new TypeCatalog(typeof(SimpleExport)));
-
- exports = container.GetExports<PartImporter<SimpleExport>>();
- Assert.AreEqual(1, exports.Count());
- }
- }
-}
-
-#endif
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/RecompositionTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/RecompositionTests.cs deleted file mode 100644 index 1ec36109f93..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/RecompositionTests.cs +++ /dev/null @@ -1,565 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Factories;
-using System.UnitTesting;
-using System.Linq;
-using System.ComponentModel.Composition.Primitives;
-
-namespace Tests.Integration
-{
- [TestClass]
- public class RecompositionTests
- {
- public class Class_OptIn_AllowRecompositionImports
- {
- [Import("Value", AllowRecomposition = true)]
- public int Value { get; set; }
- }
-
- [TestMethod]
- public void Import_OptIn_AllowRecomposition()
- {
- var container = new CompositionContainer();
- var importer = new Class_OptIn_AllowRecompositionImports();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- var valueKey = batch.AddExportedValue("Value", 21);
- container.Compose(batch);
-
- // Initial compose Value should be 21
- Assert.AreEqual(21, importer.Value);
-
- // Recompose Value to be 42
- batch = new CompositionBatch();
- batch.RemovePart(valueKey);
- batch.AddExportedValue("Value", 42);
- container.Compose(batch);
-
- Assert.AreEqual(42, importer.Value, "Value should have changed!");
- }
-
- public class Class_OptOut_AllowRecompositionImports
- {
- [Import("Value", AllowRecomposition = false)]
- public int Value { get; set; }
- }
-
- [TestMethod]
- public void Import_OptOut_AllowRecomposition()
- {
- var container = new CompositionContainer();
- var importer = new Class_OptOut_AllowRecompositionImports();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- var valueKey = batch.AddExportedValue("Value", 21);
- container.Compose(batch);
-
- // Initial compose Value should be 21
- Assert.AreEqual(21, importer.Value);
-
- // Reset value to ensure it doesn't get set to same value again
- importer.Value = -21;
-
- // Recompose Value to be 42
- batch = new CompositionBatch();
- batch.RemovePart(valueKey);
- batch.AddExportedValue("Value", 42);
- // After rejection batch failures throw ChangeRejectedException to indicate that
- // the failure did not affect the container
- CompositionAssert.ThrowsChangeRejectedError(ErrorId.ImportEngine_PreventedByExistingImport, () =>
- {
- container.Compose(batch);
- });
-
- Assert.AreEqual(-21, importer.Value, "Value should NOT have changed!");
- }
-
- public class Class_Default_AllowRecompositionImports
- {
- [Import("Value")]
- public int Value { get; set; }
- }
-
- [TestMethod]
- public void Import_Default_AllowRecomposition()
- {
- var container = new CompositionContainer();
- var importer = new Class_Default_AllowRecompositionImports();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- var valueKey = batch.AddExportedValue("Value", 21);
- container.Compose(batch);
-
- // Initial compose Value should be 21
- Assert.AreEqual(21, importer.Value);
-
- // Reset value to ensure it doesn't get set to same value again
- importer.Value = -21;
-
- // Recompose Value to be 42
- batch = new CompositionBatch();
- batch.RemovePart(valueKey);
- batch.AddExportedValue("Value", 42);
- // After rejection batch failures throw ChangeRejectedException to indicate that
- // the failure did not affect the container
- CompositionAssert.ThrowsChangeRejectedError(ErrorId.ImportEngine_PreventedByExistingImport, () =>
- {
- container.Compose(batch);
- });
-
- Assert.AreEqual(-21, importer.Value, "Value should NOT have changed!");
- }
-
- public class Class_BothOptInAndOptOutRecompositionImports
- {
- [Import("Value", AllowRecomposition = true)]
- public int RecomposableValue { get; set; }
-
- [Import("Value", AllowRecomposition = false)]
- public int NonRecomposableValue { get; set; }
- }
-
- [TestMethod]
- public void Import_BothOptInAndOptOutRecomposition()
- {
- var container = new CompositionContainer();
- var importer = new Class_BothOptInAndOptOutRecompositionImports();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- var valueKey = batch.AddExportedValue("Value", 21);
- container.Compose(batch);
-
- // Initial compose values should be 21
- Assert.AreEqual(21, importer.RecomposableValue);
- Assert.AreEqual(21, importer.NonRecomposableValue);
-
- // Reset value to ensure it doesn't get set to same value again
- importer.NonRecomposableValue = -21;
- importer.RecomposableValue = -21;
-
- // Recompose Value to be 42
- batch = new CompositionBatch();
- batch.RemovePart(valueKey);
- batch.AddExportedValue("Value", 42);
- // After rejection batch failures throw ChangeRejectedException to indicate that
- // the failure did not affect the container
- CompositionAssert.ThrowsChangeRejectedError(ErrorId.ImportEngine_PreventedByExistingImport, () =>
- {
- container.Compose(batch);
- });
-
- Assert.AreEqual(-21, importer.NonRecomposableValue, "Value should NOT have changed!");
- // The batch rejection means that the recomposable value shouldn't change either
- Assert.AreEqual(-21, importer.RecomposableValue, "Value should NOT have changed!");
- }
-
- public class Class_MultipleOptInRecompositionImportsWithDifferentContracts
- {
- [Import("Value1", AllowRecomposition = true)]
- public int Value1 { get; set; }
-
- [Import("Value2", AllowRecomposition = true)]
- public int Value2 { get; set; }
- }
-
- [TestMethod]
- public void Import_OptInRecomposition_Multlple()
- {
- var container = new CompositionContainer();
- var importer = new Class_MultipleOptInRecompositionImportsWithDifferentContracts();
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddPart(importer);
- var value1Key = batch.AddExportedValue("Value1", 21);
- var value2Key = batch.AddExportedValue("Value2", 23);
- container.Compose(batch);
-
- Assert.AreEqual(21, importer.Value1);
- Assert.AreEqual(23, importer.Value2);
-
- // Reset value to ensure it doesn't get set to same value again
- importer.Value1 = -21;
- importer.Value2 = -23;
-
- // Recompose Value to be 42
- batch = new CompositionBatch();
- batch.RemovePart(value1Key);
- batch.AddExportedValue("Value1", 42);
- container.Compose(batch);
-
- Assert.AreEqual(42, importer.Value1, "Value should have changed!");
- Assert.AreEqual(-23, importer.Value2, "Value should NOT have changed because Value2 contract should not be updated.");
- }
-
- [PartNotDiscoverable]
- public class MyName
- {
- public MyName(string name)
- {
- this.Name = name;
- }
-
- [Export("Name")]
- public string Name { get; private set; }
- }
-
- [PartNotDiscoverable]
- public class Spouse
- {
- public Spouse(string name)
- {
- this.Name = name;
- }
-
- [Export("Friend")]
- [ExportMetadata("Relationship", "Wife")]
- public string Name { get; private set; }
- }
-
- [PartNotDiscoverable]
- public class Child
- {
- public Child(string name)
- {
- this.Name = name;
- }
-
- [Export("Child")]
- public string Name { get; private set; }
- }
-
- [PartNotDiscoverable]
- public class Job
- {
- public Job(string name)
- {
- this.Name = name;
- }
-
- [Export("Job")]
- public string Name { get; private set; }
- }
-
- [PartNotDiscoverable]
- public class Friend
- {
- public Friend(string name)
- {
- this.Name = name;
- }
-
- [Export("Friend")]
- public string Name { get; private set; }
- }
-
- public interface IRelationshipView
- {
- string Relationship { get; }
- }
-
- [PartNotDiscoverable]
- public class Me
- {
- [Import("Name", AllowRecomposition = true)]
- public string Name { get; set; }
-
- [Import("Job", AllowDefault = true, AllowRecomposition = true)]
- public string Job { get; set; }
-
- [ImportMany("Child")]
- public string[] Children { get; set; }
-
- [ImportMany("Friend")]
- public Lazy<string, IRelationshipView>[] Relatives { get; set; }
-
- [ImportMany("Friend", AllowRecomposition = true)]
- public string[] Friends { get; set; }
- }
-
- [TestMethod]
- public void Recomposition_IntegrationTest()
- {
- var container = new CompositionContainer();
- var batch = new CompositionBatch();
-
- var me = new Me();
- batch.AddPart(me);
- var namePart = batch.AddPart(new MyName("Blake"));
- batch.AddPart(new Spouse("Barbara"));
- batch.AddPart(new Friend("Steve"));
- batch.AddPart(new Friend("Joyce"));
- container.Compose(batch);
- Assert.AreEqual(me.Name, "Blake", "Name in initial composition incorrect");
- Assert.AreEqual(me.Job, null, "Job should have the default value");
- Assert.AreEqual(me.Friends.Length, 3, "Number of friends in initial composition incorrect");
- Assert.AreEqual(me.Relatives.Length, 1, "Number of relatives in initial composition incorrect");
- Assert.AreEqual(me.Children.Length, 0, "Number of children in initial composition incorrect");
-
- // Can only have one name
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- container.ComposeParts(new MyName("Blayke")));
-
- batch = new CompositionBatch();
- batch.AddPart(new MyName("Blayke"));
- batch.RemovePart(namePart);
- container.Compose(batch);
- Assert.AreEqual(me.Name, "Blayke", "Name after recomposition incorrect");
-
- batch = new CompositionBatch();
- var jobPart = batch.AddPart(new Job("Architect"));
- container.Compose(batch);
- Assert.AreEqual(me.Job, "Architect", "Job after recomposition incorrect");
-
- batch = new CompositionBatch();
- batch.AddPart(new Job("Chimney Sweep"));
- container.Compose(batch);
- Assert.IsTrue(me.Job == null, "More than one of an optional import should result in the default value");
-
- batch = new CompositionBatch();
- batch.RemovePart(jobPart);
- container.Compose(batch);
- Assert.AreEqual(me.Job, "Chimney Sweep", "Job after re-recomposition incorrect");
-
- batch = new CompositionBatch();
-
- // Can only have one spouse because they aren't recomposable
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- container.ComposeParts(new Spouse("Cameron")));
-
- Assert.AreEqual(me.Relatives.Length, 1, "Number of relatives shouldn't be affected by rolled back composition");
-
- batch = new CompositionBatch();
- batch.AddPart(new Friend("Graham"));
- container.Compose(batch);
- Assert.AreEqual(me.Friends.Length, 4, "Number of friends after recomposition incorrect");
- Assert.AreEqual(me.Relatives.Length, 1, "Number of relatives shouldn't be affected by rolled back composition");
- }
-
- public class FooWithOptionalImport
- {
- private FooWithSimpleImport _optionalImport;
-
- [Import(AllowDefault=true, AllowRecomposition=true)]
- public FooWithSimpleImport OptionalImport
- {
- get
- {
- return this._optionalImport;
- }
- set
- {
- if (value != null)
- {
- this._optionalImport = value;
-
- Assert.IsTrue(!string.IsNullOrEmpty(this._optionalImport.SimpleValue), "Value should have it's imports satisfied");
- }
- }
- }
- }
-
- [Export]
- public class FooWithSimpleImport
- {
- [Import("FooSimpleImport")]
- public string SimpleValue { get; set; }
- }
-
- [TestMethod]
- public void PartsShouldHaveImportsSatisfiedBeforeBeingUsedToSatisfyRecomposableImports()
- {
- var container = new CompositionContainer();
- var fooOptional = new FooWithOptionalImport();
-
- container.ComposeParts(fooOptional);
- container.ComposeExportedValue<string>("FooSimpleImport", "NotNullOrEmpty");
- container.ComposeParts(new FooWithSimpleImport());
-
- Assert.IsTrue(!string.IsNullOrEmpty(fooOptional.OptionalImport.SimpleValue));
- }
-
-
- [Export]
- public class RootImportRecomposable
- {
- [Import(AllowDefault = true, AllowRecomposition = true)]
- public NonSharedImporter Importer { get; set; }
- }
-
- [Export]
- [PartCreationPolicy(CreationPolicy.NonShared)]
- public class NonSharedImporter
- {
- [Import]
- public SimpleImport Import { get; set; }
- }
-
- [Export]
- public class RootImporter
- {
- [Import]
- public SimpleImport Import { get; set; }
- }
-
- [Export]
- public class SimpleImport
- {
- public int Property { get { return 42; } }
- }
-
- [TestMethod]
- [Ignore]
- [WorkItem(733533)]
- public void RemoveCatalogWithNonSharedPartWithRequiredImport()
- {
- var typeCatalog = new TypeCatalog(typeof(NonSharedImporter), typeof(SimpleImport));
- var aggCatalog = new AggregateCatalog();
- var container = new CompositionContainer(aggCatalog);
-
- aggCatalog.Catalogs.Add(typeCatalog);
- aggCatalog.Catalogs.Add(new TypeCatalog(typeof(RootImportRecomposable)));
-
- var rootExport = container.GetExport<RootImportRecomposable>();
- var root = rootExport.Value;
-
- Assert.AreEqual(42, root.Importer.Import.Property);
-
- aggCatalog.Catalogs.Remove(typeCatalog);
-
- Assert.IsNull(root.Importer);
- }
-
- [TestMethod]
- [Ignore]
- [WorkItem(734123)]
- public void GetExportResultShouldBePromise()
- {
- var typeCatalog = new TypeCatalog(typeof(RootImporter), typeof(SimpleImport));
- var aggCatalog = new AggregateCatalog();
- var container = new CompositionContainer(aggCatalog);
-
- aggCatalog.Catalogs.Add(typeCatalog);
-
- var root = container.GetExport<RootImporter>();
-
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- aggCatalog.Catalogs.Remove(typeCatalog)
- );
-
- var value = root.Value;
- Assert.AreEqual(42, value.Import.Property);
- }
-
- [TestMethod]
- [WorkItem(789269)]
- public void TestRemovingAndReAddingMultipleDefinitionsFromCatalog()
- {
- var fixedParts = new TypeCatalog(typeof(RootMultipleImporter), typeof(ExportedService));
- var changingParts = new TypeCatalog(typeof(Exporter1), typeof(Exporter2));
- var catalog = new AggregateCatalog();
- catalog.Catalogs.Add(fixedParts);
- catalog.Catalogs.Add(changingParts);
-
- var container = new CompositionContainer(catalog);
-
- var root = container.GetExport<RootMultipleImporter>().Value;
-
- Assert.AreEqual(2, root.Imports.Length);
-
- catalog.Catalogs.Remove(changingParts);
-
- Assert.AreEqual(0, root.Imports.Length);
-
- catalog.Catalogs.Add(changingParts);
-
- Assert.AreEqual(2, root.Imports.Length);
- }
-
- [Export]
- public class RootMultipleImporter
- {
- [ImportMany(AllowRecomposition=true)]
- public IExportedInterface[] Imports { get; set; }
- }
-
- public interface IExportedInterface
- {
-
- }
-
- [Export(typeof(IExportedInterface))]
- public class Exporter1 : IExportedInterface
- {
- [Import]
- public ExportedService Service { get; set; }
- }
-
- [Export(typeof(IExportedInterface))]
- public class Exporter2 : IExportedInterface
- {
- [Import]
- public ExportedService Service { get; set; }
- }
-
- [Export]
- public class ExportedService
- {
-
- }
-
- [TestMethod]
- [WorkItem(762215)]
- [Ignore]
- public void TestPartCreatorResurrection()
- {
- var container = new CompositionContainer(new TypeCatalog(typeof(NonDisposableImportsDisposable), typeof(PartImporter<NonDisposableImportsDisposable>)));
- var exports = container.GetExports<PartImporter<NonDisposableImportsDisposable>>();
- Assert.AreEqual(0, exports.Count());
- container.ComposeParts(new DisposablePart());
- exports = container.GetExports<PartImporter<NonDisposableImportsDisposable>>();
- Assert.AreEqual(1, exports.Count());
- }
-
- [Export]
- public class PartImporter<PartType>
- {
- [Import]
- public PartType Creator { get; set; }
- }
-
- [Export]
- public class NonDisposableImportsDisposable
- {
- [Import]
- public DisposablePart Part { get; set; }
- }
-
- [Export]
- public class Part
- {
-
- }
- [Export]
- [PartCreationPolicy(CreationPolicy.NonShared)]
- public class DisposablePart : Part, IDisposable
- {
- public bool Disposed { get; private set; }
- public void Dispose()
- {
- Disposed = true;
- }
- }
-
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/RejectionTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/RejectionTests.cs deleted file mode 100644 index 9efdc6cc569..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/RejectionTests.cs +++ /dev/null @@ -1,505 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Linq;
-using System.Text;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.UnitTesting;
-
-namespace Tests.Integration
-{
- [TestClass]
- public class RejectionTests
- {
- public interface IExtension
- {
- int Id { get; set; }
- }
-
- [Export]
- public class MyImporter
- {
- [ImportMany(AllowRecomposition = true)]
- public IExtension[] Extensions { get; set; }
- }
-
- [Export(typeof(IExtension))]
- public class Extension1 : IExtension
- {
- [Import("IExtension.IdValue")]
- public int Id { get; set; }
- }
-
- [Export(typeof(IExtension))]
- public class Extension2 : IExtension
- {
- [Import("IExtension.IdValue2")]
- public int Id { get; set; }
- }
-
- [TestMethod]
- public void Rejection_ExtensionLightUp_AddedViaBatch()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(
- typeof(MyImporter),
- typeof(Extension1),
- typeof(Extension2));
-
- var importer = container.GetExportedValue<MyImporter>();
-
- Assert.AreEqual(0, importer.Extensions.Length, "Should have 0 extensions");
-
- container.ComposeExportedValue<int>("IExtension.IdValue", 10);
-
- Assert.AreEqual(1, importer.Extensions.Length, "Should have 1 extension");
- Assert.AreEqual(10, importer.Extensions[0].Id);
-
- container.ComposeExportedValue<int>("IExtension.IdValue2", 20);
-
- Assert.AreEqual(2, importer.Extensions.Length, "Should have 2 extension");
- Assert.AreEqual(10, importer.Extensions[0].Id);
- Assert.AreEqual(20, importer.Extensions[1].Id);
- }
-
- public class ExtensionValues
- {
- [Export("IExtension.IdValue")]
- public int Value = 10;
-
- [Export("IExtension.IdValue2")]
- public int Value2 = 20;
- }
-
- [TestMethod]
- public void Rejection_ExtensionLightUp_AddedViaCatalog()
- {
- var ext1Cat = CatalogFactory.CreateAttributed(typeof(Extension1));
- var ext2Cat = CatalogFactory.CreateAttributed(typeof(Extension2));
- var hostCat = CatalogFactory.CreateAttributed(typeof(MyImporter));
- var valueCat = CatalogFactory.CreateAttributed(typeof(ExtensionValues));
-
- var catalog = new AggregateCatalog();
- catalog.Catalogs.Add(hostCat);
-
- var container = ContainerFactory.Create(catalog);
-
- var importer = container.GetExportedValue<MyImporter>();
-
- Assert.AreEqual(0, importer.Extensions.Length, "Should have 0 extensions");
-
- catalog.Catalogs.Add(ext1Cat);
-
- Assert.AreEqual(0, importer.Extensions.Length, "Should have 0 extensions after ext1 added without dependency");
-
- catalog.Catalogs.Add(ext2Cat);
-
- Assert.AreEqual(0, importer.Extensions.Length, "Should have 0 extensions after ext2 added without dependency");
-
- catalog.Catalogs.Add(valueCat);
-
- Assert.AreEqual(2, importer.Extensions.Length, "Should have 2 extension");
- Assert.AreEqual(10, importer.Extensions[0].Id);
- Assert.AreEqual(20, importer.Extensions[1].Id);
- }
-
- public interface IMissing { }
- public interface ISingle { }
- public interface IMultiple { }
- public interface IConditional { }
- public class SingleImpl : ISingle { }
- public class MultipleImpl : IMultiple { }
-
- public class NoImportPart
- {
- public NoImportPart()
- {
- SingleExport = new SingleImpl();
- MultipleExport1 = new MultipleImpl();
- MultipleExport2 = new MultipleImpl();
- }
-
- [Export]
- public ISingle SingleExport { private set; get; }
-
- [Export]
- public IMultiple MultipleExport1 { private set; get; }
-
- [Export]
- public IMultiple MultipleExport2 { private set; get; }
- }
-
- [Export]
- public class Needy
- {
- public Needy() { }
-
- [Import]
- public ISingle SingleImport { get; set; }
- }
-
- [TestMethod]
- public void Rejection_Resurrection()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(Needy));
-
- var exports1 = container.GetExportedValues<Needy>();
-
- Assert.AreEqual(0, exports1.Count(), "Catalog entry should be rejected");
-
- container.ComposeParts(new NoImportPart());
-
- var exports2 = container.GetExportedValues<Needy>();
- Assert.AreEqual(1, exports2.Count(), "Catalog entry should be ressurrected");
- }
-
- [TestMethod]
- public void Rejection_BatchSatisfiesBatch()
- {
- var container = ContainerFactory.Create();
- var needy = new Needy();
- container.ComposeParts(needy, new NoImportPart());
- Assert.IsInstanceOfType(needy.SingleImport, typeof(SingleImpl), "Import not satisifed as expected");
- }
-
- [TestMethod]
- public void Rejection_BatchSatisfiesBatchReversed()
- {
- var container = ContainerFactory.Create();
- var needy = new Needy();
- container.ComposeParts(new NoImportPart(), needy);
- Assert.IsInstanceOfType(needy.SingleImport, typeof(SingleImpl), "Import not satisifed as expected");
- }
-
- [TestMethod]
- public void Rejection_CatalogSatisfiesBatch()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(NoImportPart));
- var needy = new Needy();
- container.ComposeParts(needy);
- Assert.IsInstanceOfType(needy.SingleImport, typeof(SingleImpl), "Import not satisifed as expected");
- }
-
- [TestMethod]
- public void Rejection_TransitiveDependenciesSatisfied()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(Needy), typeof(NoImportPart));
- var needy = container.GetExportedValue<Needy>();
- Assert.IsNotNull(needy);
- Assert.IsInstanceOfType(needy.SingleImport, typeof(SingleImpl), "Import not satisifed as expected");
- }
-
- [TestMethod]
- public void Rejection_TransitiveDependenciesUnsatisfied_ShouldThrowCardinalityMismatch()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(Needy), typeof(MissingImportPart));
-
- ExceptionAssert.Throws<ImportCardinalityMismatchException>(() =>
- container.GetExportedValue<Needy>());
- }
-
- public class MissingImportPart : NoImportPart
- {
- [Import]
- public IMissing MissingImport { set; get; }
- }
-
- [TestMethod]
- public void Rejection_BatchRevert()
- {
- var container = ContainerFactory.Create();
-
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- container.ComposeParts(new MissingImportPart()));
- }
-
- [TestMethod]
- public void Rejection_DefendPromisesOnceMade()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(Needy));
-
- var addBatch = new CompositionBatch();
- var removeBatch = new CompositionBatch();
- var addedPart = addBatch.AddPart(new NoImportPart());
- removeBatch.RemovePart(addedPart);
-
- // Add then remove should be fine as long as exports aren't used yet.
- container.Compose(addBatch);
- container.Compose(removeBatch);
-
- // Add the dependencies
- container.Compose(addBatch);
-
- // Retrieve needy which uses an export from addedPart
- var export = container.GetExportedValue<Needy>();
-
- // Should not be able to remove the addedPart because someone depends on it.
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- container.Compose(removeBatch));
- }
-
- [TestMethod]
- public void Rejection_DefendPromisesLazily()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(Needy));
-
- // Add the missing dependency for Needy
- container.ComposeParts(new NoImportPart());
-
- // This change should succeed since the component "Needy" hasn't been fully composed
- // and one way of satisfying its needs is as good ask another
- var export = container.GetExport<Needy>();
-
- // Cannot add another import because it would break existing promised compositions
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- container.ComposeParts(new NoImportPart()));
-
- // Instansitate the object
- var needy = export.Value;
-
- // Cannot add another import because it would break existing compositions
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- container.ComposeParts(new NoImportPart()));
- }
-
-
- [TestMethod]
- public void Rejection_SwitchPromiseFromManualToCatalog()
- {
- // This test shows how the priority list in the AggregateCatalog can actually play with
- // the rejection work. Until the actual object is actually pulled on and satisfied the
- // promise can be moved around even for not-recomposable imports but once the object is
- // pulled on it is fixed from that point on.
-
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(Needy), typeof(NoImportPart));
-
- // Add the missing dependency for Needy
- container.ComposeParts(new NoImportPart());
-
- // This change should succeed since the component "Needy" hasn't been fully composed
- // and one way of satisfying its needs is as good as another
- var export = container.GetExport<Needy>();
-
- // Adding more exports doesn't fail because we push the promise to use the NoImportPart from the catalog
- // using the priorities from the AggregateExportProvider
- container.ComposeParts(new NoImportPart());
-
- // Instansitate the object
- var needy = export.Value;
-
- // Cannot add another import because it would break existing compositions
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- container.ComposeParts(new NoImportPart()));
- }
-
- public interface ILoopA { }
- public interface ILoopB { }
-
- [Export(typeof(ILoopA))]
- public class LoopA1 : ILoopA
- {
- [Import]
- public ILoopB LoopB { set; get; }
- }
-
- [Export(typeof(ILoopA))]
- public class LoopA2 : ILoopA
- {
- [Import]
- public ILoopB LoopB { set; get; }
- }
-
- [Export(typeof(ILoopB))]
- public class LoopB1 : ILoopB
- {
- [Import]
- public ILoopA LoopA { set; get; }
- }
-
- [Export(typeof(ILoopB))]
- public class LoopB2 : ILoopB
- {
- [Import]
- public ILoopA LoopA { set; get; }
- }
-
- // This is an interesting situation. There are several possible self-consistent outcomes:
- // - All parts involved in the loop are rejected
- // - A consistent subset are not rejected (exactly one of LoopA1/LoopA2 and one of LoopB1/LoopB2
- //
- // Both have desireable and undesirable characteristics. The first case is non-discriminatory but
- // rejects more parts than are necessary, the second minimizes rejection but must choose a subset
- // on somewhat arbitary grounds.
- [TestMethod]
- public void Rejection_TheClemensLoop()
- {
- var catalog = new TypeCatalog(new Type[] { typeof(LoopA1), typeof(LoopA2), typeof(LoopB1), typeof(LoopB2) });
- var container = new CompositionContainer(catalog);
- var exportsA = container.GetExportedValues<ILoopA>();
- var exportsB = container.GetExportedValues<ILoopB>();
-
- // These assertions would prove solution one
- Assert.AreEqual(0, exportsA.Count(), "Catalog ILoopA entries should be rejected");
- Assert.AreEqual(0, exportsB.Count(), "Catalog ILoopB entries should be rejected");
-
- // These assertions would prove solution two
- //Assert.AreEqual(1, exportsA.Count, "Only noe ILoopA entry should not be rejected");
- //Assert.AreEqual(1, exportsB.Count, "Only noe ILoopB entry should not be rejected");
- }
-
- public interface IWorkItem
- {
- string Id { get; set; }
- }
-
- [Export]
- public class AllWorkItems
- {
- [ImportMany(AllowRecomposition = true)]
- public Lazy<IWorkItem>[] WorkItems { get; set; }
- }
-
- [Export(typeof(IWorkItem))]
- public class WorkItem : IWorkItem
- {
- [Import("WorkItem.Id", AllowRecomposition = true)]
- public string Id { get; set; }
- }
-
- public class Ids
- {
- [Export("WorkItem.Id")]
- public string Id = "MyId";
-
- }
-
- [TestMethod]
- public void AppliedStateNotCompleteedYet()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(AllWorkItems));
-
- container.ComposeExportedValue<string>("WorkItem.Id", "A");
-
- var workItems = container.GetExportedValue<AllWorkItems>();
-
- Assert.AreEqual(0, workItems.WorkItems.Length);
-
- container.ComposeParts(new WorkItem());
-
- Assert.AreEqual(1, workItems.WorkItems.Length);
- Assert.AreEqual("A", workItems.WorkItems[0].Value.Id);
- }
-
- [Export]
- public class ClassWithMissingImport
- {
- [Import]
- private string _importNotFound = null;
- }
-
- [TestMethod]
- public void AppliedStateStored_ShouldRevertStateOnFailure()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(AllWorkItems), typeof(WorkItem), typeof(Ids));
-
- var workItems = container.GetExportedValue<AllWorkItems>();
-
- Assert.AreEqual(1, workItems.WorkItems.Length);
-
- var batch = new CompositionBatch();
-
- batch.AddExportedValue("WorkItem.Id", "B");
- batch.AddPart(new ClassWithMissingImport());
-
- ExceptionAssert.Throws<ChangeRejectedException>(() =>
- container.Compose(batch));
-
- Assert.AreEqual("MyId", workItems.WorkItems[0].Value.Id);
- }
-
- [Export]
- public class OptionalImporter
- {
- [Import(AllowDefault = true)]
- public ClassWithMissingImport Import { get; set; }
- }
-
- [TestMethod]
- public void OptionalImportWithMissingDependency_ShouldRejectAndComposeFine()
- {
- var container = ContainerFactory.CreateWithAttributedCatalog(typeof(OptionalImporter), typeof(ClassWithMissingImport));
-
- var importer = container.GetExportedValue<OptionalImporter>();
-
- Assert.IsNull(importer.Import);
- }
-
- [Export]
- public class PartA
- {
- [Import(AllowDefault = true, AllowRecomposition = true)]
- public PartB ImportB { get; set; }
- }
-
- [Export]
- public class PartB
- {
- [Import]
- public PartC ImportC { get; set; }
- }
-
- [Export]
- public class PartC
- {
- [Import]
- public PartB ImportB { get; set; }
- }
-
- [TestMethod]
- [WorkItem(684510)]
- public void PartAOptionalDependsOnPartB_PartBGetAddedLater()
- {
- var container = new CompositionContainer(new TypeCatalog(typeof(PartC), typeof(PartA)));
- var partA = container.GetExportedValue<PartA>();
-
- Assert.IsNull(partA.ImportB);
-
- var partB = new PartB();
- container.ComposeParts(partB);
-
- Assert.AreEqual(partA.ImportB, partB);
- Assert.IsNotNull(partB.ImportC);
- }
-
- [Export]
- public class PartA2
- {
- [Import(AllowDefault = true, AllowRecomposition = true)]
- public PartB ImportB { get; set; }
-
- [Import(AllowDefault = true, AllowRecomposition = true)]
- public PartC ImportC { get; set; }
- }
-
- [TestMethod]
- [WorkItem(684510)]
- public void PartAOptionalDependsOnPartBAndPartC_PartCGetRecurrected()
- {
- var container = new CompositionContainer(new TypeCatalog(typeof(PartA2), typeof(PartB)));
- var partA = container.GetExportedValue<PartA2>();
-
- Assert.IsNull(partA.ImportB);
- Assert.IsNull(partA.ImportC);
-
- var partC = new PartC();
- container.ComposeParts(partC);
-
- Assert.AreEqual(partA.ImportB, partC.ImportB);
- Assert.AreEqual(partA.ImportC, partC);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/RequiredCreationPolicyTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/RequiredCreationPolicyTests.cs deleted file mode 100644 index 742b4c83ce0..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/Integration/RequiredCreationPolicyTests.cs +++ /dev/null @@ -1,159 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.Linq;
-using System.Linq.Expressions;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace Tests.Integration
-{
- [TestClass]
- public class RequiredCreationPolicyTests
- {
- // Matrix that details which policy to use for a given part to satisfy a given import.
- // Part.Any Part.Shared Part.NonShared
- // Import.Any Shared Shared NonShared
- // Import.Shared Shared Shared N/A
- // Import.NonShared NonShared N/A NonShared
-
- public interface ICreationPolicyExport
- {
-
- }
-
- [Export(typeof(ICreationPolicyExport))]
- public class CreationPolicyAnyExportImplicit : ICreationPolicyExport
- {
-
- }
-
- [Export(typeof(ICreationPolicyExport))]
- [PartCreationPolicy(CreationPolicy.Any)]
- public class CreationPolicyAnyExportExplicit : ICreationPolicyExport
- {
-
- }
-
- [Export(typeof(ICreationPolicyExport))]
- [PartCreationPolicy(CreationPolicy.Shared)]
- public class CreationPolicySharedExport : ICreationPolicyExport
- {
-
- }
-
- [Export(typeof(ICreationPolicyExport))]
- [PartCreationPolicy(CreationPolicy.NonShared)]
- public class CreationPolicyNonSharedExport : ICreationPolicyExport
- {
-
- }
-
- [Export]
- public class RequiredAnyImporterImplicit
- {
- [ImportMany]
- public IEnumerable<ICreationPolicyExport> Exports { get; set; }
- }
-
- [Export]
- public class RequiredAnyImporterExplicit
- {
- [ImportMany(RequiredCreationPolicy = CreationPolicy.Any)]
- public IEnumerable<ICreationPolicyExport> Exports { get; set; }
- }
-
- [Export]
- public class RequiredSharedImporter
- {
- [ImportMany(RequiredCreationPolicy = CreationPolicy.Shared)]
- public IEnumerable<ICreationPolicyExport> Exports { get; set; }
- }
-
- [Export]
- public class RequiredNonSharedImporter
- {
- [ImportMany(RequiredCreationPolicy = CreationPolicy.NonShared)]
- public IEnumerable<ICreationPolicyExport> Exports { get; set; }
- }
-
- private static CompositionContainer CreateDefaultContainer()
- {
- return ContainerFactory.CreateWithAttributedCatalog(
- typeof(ICreationPolicyExport),
-
- typeof(CreationPolicyAnyExportImplicit),
- typeof(CreationPolicyAnyExportExplicit),
- typeof(CreationPolicySharedExport),
- typeof(CreationPolicyNonSharedExport),
-
- typeof(RequiredAnyImporterImplicit),
- typeof(RequiredAnyImporterExplicit),
- typeof(RequiredSharedImporter),
- typeof(RequiredNonSharedImporter));
- }
-
- [TestMethod]
- public void RequiredAnyImporterImplicit_ShouldIncludeAll()
- {
- var container = CreateDefaultContainer();
-
- var importer = container.GetExportedValue<RequiredAnyImporterImplicit>();
-
- EnumerableAssert.AreEqual(
- importer.Exports.Select(obj => obj.GetType()),
- typeof(CreationPolicyAnyExportImplicit),
- typeof(CreationPolicyAnyExportExplicit),
- typeof(CreationPolicySharedExport),
- typeof(CreationPolicyNonSharedExport));
- }
-
- [TestMethod]
- public void RequiredAnyImporterExplicit_ShouldIncludeAll()
- {
- var container = CreateDefaultContainer();
-
- var importer = container.GetExportedValue<RequiredAnyImporterExplicit>();
-
- EnumerableAssert.AreEqual(
- importer.Exports.Select(obj => obj.GetType()),
- typeof(CreationPolicyAnyExportImplicit),
- typeof(CreationPolicyAnyExportExplicit),
- typeof(CreationPolicySharedExport),
- typeof(CreationPolicyNonSharedExport));
- }
-
- [TestMethod]
- public void RequiredSharedImporter_ShouldFilterNonShared()
- {
- var container = CreateDefaultContainer();
-
- var importer = container.GetExportedValue<RequiredSharedImporter>();
-
- EnumerableAssert.AreEqual(
- importer.Exports.Select(obj => obj.GetType()),
- typeof(CreationPolicyAnyExportImplicit),
- typeof(CreationPolicyAnyExportExplicit),
- typeof(CreationPolicySharedExport));
- }
-
- [TestMethod]
- public void RequiredNonSharedImporter_ShouldFilterShared()
- {
- var container = CreateDefaultContainer();
-
- var importer = container.GetExportedValue<RequiredNonSharedImporter>();
-
- EnumerableAssert.AreEqual(
- importer.Exports.Select(obj => obj.GetType()),
- typeof(CreationPolicyAnyExportImplicit),
- typeof(CreationPolicyAnyExportExplicit),
- typeof(CreationPolicyNonSharedExport));
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/LazyOfTTMetadataTests.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/LazyOfTTMetadataTests.cs deleted file mode 100644 index 8e22488c134..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/LazyOfTTMetadataTests.cs +++ /dev/null @@ -1,111 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Factories;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System
-{
- [TestClass]
- public class LazyOfTMetadataTests
- {
- public class MetadataView
- {
- }
-
- [TestMethod]
- public void Constructor1_MetadataViewSet()
- {
- MetadataView metadataView = new MetadataView();
- var export = new Lazy<string, MetadataView>(() => "Value", metadataView, false);
- Assert.AreEqual(metadataView, export.Metadata);
- }
-
- [TestMethod]
- public void Constructor1_MetadataViewSetToNull()
- {
- MetadataView metadataView = new MetadataView();
- var export = new Lazy<string, MetadataView>(() => "Value", null, false);
- Assert.IsNull(export.Metadata);
- }
-
-
- [TestMethod]
- public void Constructor1_NullAsExportedValueGetterArgument_ShouldThrowArgumentNull()
- {
- ExceptionAssert.ThrowsArgument<ArgumentNullException>("valueFactory", () =>
- {
- new Lazy<string, MetadataView>((Func<string>)null, new MetadataView(), false);
- });
- }
-
- [TestMethod]
- public void Constructor1_FuncReturningAStringAsExportedValueGetter_ShouldBeReturnedByGetExportedValue()
- {
- var export = new Lazy<string, MetadataView>(() => "Value", new MetadataView(), false);
-
- Assert.AreEqual("Value", export.Value);
- }
-
- [TestMethod]
- public void Constructor1_FuncReturningNullAsExportedValueGetter_ShouldBeReturnedByGetExportedValue()
- {
- var export = new Lazy<string, MetadataView>(() => null, new MetadataView(), false);
-
- Assert.IsNull(export.Value);
- }
-
- [TestMethod]
- public void Value_ShouldCacheExportedValueGetter()
- {
- int count = 0;
-
- var export = new Lazy<int, MetadataView>(() =>
- {
- count++;
- return count;
- }, new MetadataView(), false);
-
- Assert.AreEqual(1, export.Value);
- Assert.AreEqual(1, export.Value);
- Assert.AreEqual(1, export.Value);
- }
- [TestMethod]
- public void Constructor2_MetadataSet()
- {
- MetadataView metadataView = new MetadataView();
- var export = new Lazy<object, MetadataView>(metadataView, false);
-
- Assert.AreSame(metadataView, export.Metadata);
- Assert.IsNotNull(export.Value);
- }
-
-#if CLR40
- [TestMethod]
- public void Constructor3_MetadataSet()
- {
- MetadataView metadataView = new MetadataView();
- var export = new Lazy<object, MetadataView>(metadataView, true);
-
- Assert.AreSame(metadataView, export.Metadata);
- Assert.IsNotNull(export.Value);
- }
-
- [TestMethod]
- public void Constructor4_MetadataSet()
- {
- MetadataView metadataView = new MetadataView();
- var export = new Lazy<string, MetadataView>(() => "Value",
- metadataView, true);
-
- Assert.AreSame(metadataView, export.Metadata);
- Assert.IsNotNull(export.Value);
- }
-#endif
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/UnitTesting/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/UnitTesting/.gitattributes deleted file mode 100644 index 5c302f05cff..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/UnitTesting/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -/ReflectionItemAssert.cs -crlf -/TestUtilities.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/UnitTesting/ReflectionItemAssert.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/UnitTesting/ReflectionItemAssert.cs deleted file mode 100644 index 2fac3f659b3..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/UnitTesting/ReflectionItemAssert.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.ReflectionModel;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.UnitTesting
-{
- internal static class ReflectionItemAssert
- {
- public static void AreSame(ReflectionItem expected, ReflectionItem actual)
- {
- switch (expected.ItemType)
- {
- case ReflectionItemType.Property:
- {
- ReflectionProperty expectedProperty = (ReflectionProperty)expected;
- ReflectionProperty actualProperty = (ReflectionProperty)actual;
-
- ReflectionAssert.AreSame(expectedProperty.UnderlyingGetMethod, actualProperty.UnderlyingGetMethod);
- ReflectionAssert.AreSame(expectedProperty.UnderlyingSetMethod, actualProperty.UnderlyingSetMethod);
- return;
- }
-
- case ReflectionItemType.Parameter:
- {
- ReflectionParameter expectedParameter = (ReflectionParameter)expected;
- ReflectionParameter actualParameter = (ReflectionParameter)actual;
-
- ReflectionAssert.AreSame(expectedParameter.UnderlyingParameter, actualParameter.UnderlyingParameter);
- return;
- }
-
- default:
- {
- ReflectionMember expectedMember = (ReflectionMember)expected;
- ReflectionMember actualMember = (ReflectionMember)actual;
-
- ReflectionAssert.AreSame(expectedMember.UnderlyingMember, actualMember.UnderlyingMember);
- return;
- }
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/UnitTesting/TestUtilities.cs b/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/UnitTesting/TestUtilities.cs deleted file mode 100644 index 9da9f86c7a9..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/UnitTesting/TestUtilities.cs +++ /dev/null @@ -1,97 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.ComponentModel.Composition;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.UnitTesting
-{
- public static class TestUtilities
- {
-
- public static void CheckICollectionOfTConformance<T>(ICollection<T> list, T a, T b, T c, T d)
- {
- list.Clear();
- EnumerableAssert.AreEqual(list);
-
- Assert.IsFalse(list.IsReadOnly, "The list should not report being read-only for these tests to work");
- Assert.IsFalse(list.Contains(a), "Contains should fail for anything when the collection is empty");
- Assert.IsFalse(list.Remove(a), "Remove should fail on anything when the collection is empty");
-
- list.Add(a);
- EnumerableAssert.AreEqual(list, a);
-
- list.Add(b);
- EnumerableAssert.AreEqual(list, a, b);
-
- list.Add(c);
- EnumerableAssert.AreEqual(list, a, b, c);
-
- list.Remove(b);
- EnumerableAssert.AreEqual(list, a, c);
-
- list.Remove(c);
- EnumerableAssert.AreEqual(list, a);
-
- list.Remove(a);
- EnumerableAssert.AreEqual(list);
-
- list.Add(a); list.Add(b); list.Add(c);
-
- list.Clear();
- EnumerableAssert.AreEqual(list);
-
- list.Clear();
- EnumerableAssert.AreEqual(list);
-
- list.Add(d); list.Add(c); list.Add(b); list.Add(a);
-
- T[] destination = new T[5];
- list.CopyTo(destination, 0);
- EnumerableAssert.AreEqual(destination, d, c, b, a, default(T));
- }
-
- public static void CheckIListOfTConformance<T>(IList<T> list, T a, T b, T c, T d)
- {
- CheckICollectionOfTConformance(list, a, b, c, d);
-
- list.Clear();
- list.Insert(0, d);
- list.Insert(0, a);
- list.Insert(1, c);
- list.Insert(1, b);
- CompareListContents(list, a, b, c, d);
-
- list[1] = a;
- CompareListContents(list, a, a, c, d);
-
- list.RemoveAt(2);
- CompareListContents(list, a, a, d);
-
- Assert.AreEqual(2, list.IndexOf(d), "Expected indexof to return the correct location of {0}", d);
- Assert.AreEqual(-1, list.IndexOf(b), "{0} should not be found in the collection", b);
- Assert.AreEqual(-1, list.IndexOf(c), "{0} should not be found in the collection", c);
- }
-
-
-
- public static void CompareListContents<T>(IList<T> list, params object[] values)
- {
- EnumerableAssert.AreEqual(list, values);
-
- for (var index = 0; index < values.Length; index++)
- {
- Assert.AreEqual(values[index], list[index],
- "List should return true for Contains on every element, index {0}, length {1}", index, values[index]);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/.gitattributes deleted file mode 100644 index f7d8287f511..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -/AssemblyInfo.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/AssemblyInfo.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/AssemblyInfo.cs deleted file mode 100644 index d043eef0a20..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/AssemblyInfo.cs +++ /dev/null @@ -1,8 +0,0 @@ -//------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//------------------------------------------------------------
-[assembly: System.CLSCompliant(true)]
-[assembly: System.Reflection.AssemblyTitle("System.ComponentModel.Composition.UnitTestFramework")]
-[assembly: System.Reflection.AssemblyCopyright("(c) Microsoft Corporation. All rights reserved.")]
-[assembly: System.Reflection.AssemblyVersion("2010.02.11")]
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.ComponentModel.Composition.UnitTests")]
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/.gitattributes deleted file mode 100644 index ed47a6216df..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/.gitattributes +++ /dev/null @@ -1,4 +0,0 @@ -/DisposableObject.cs -crlf -/EnumExtensions.cs -crlf -/ReferenceTracker.cs -crlf -/TypeExtensions.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Collections/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Collections/.gitattributes deleted file mode 100644 index e27dae9bcb6..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Collections/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -/EnumerableExtensions.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Collections/EnumerableExtensions.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Collections/EnumerableExtensions.cs deleted file mode 100644 index efb9c82994f..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Collections/EnumerableExtensions.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace Microsoft.Internal.Collections
-{
- public static class EnumerableExtensions
- {
- public static int Count(this IEnumerable source)
- {
- int count = 0;
-
- foreach (object o in source)
- {
- count++;
- }
-
- return count;
- }
-
- public static IEnumerable<T> ToEnumerable<T>(this IEnumerable source)
- {
- foreach (object value in source)
- {
- yield return (T)value;
- }
- }
-
- public static List<object> ToList(this IEnumerable source)
- {
- var enumerable = source.ToEnumerable<object>();
-
- return System.Linq.Enumerable.ToList(enumerable);
- }
-
- public static T AssertSingle<T>(this IEnumerable<T> source)
- {
- return AssertSingle(source, t => true);
- }
-
- public static T AssertSingle<T>(this IEnumerable<T> source, string message)
- {
- return AssertSingle(source, t => true, message);
- }
-
- public static T AssertSingle<T>(this IEnumerable<T> source, Func<T, bool> predicate)
- {
- return AssertSingle(source, predicate, "Expecting a single item matching the predicate in the collection.");
- }
-
- public static T AssertSingle<T>(this IEnumerable<T> source, Func<T, bool> predicate, string message)
- {
- int count = 0;
- T ret = default(T);
- foreach (T t in source)
- {
- if (predicate(t))
- {
- count++;
- ret = t;
- }
- }
-
- Assert.AreEqual(1, count, message);
- return ret;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Collections/Generic/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Collections/Generic/.gitattributes deleted file mode 100644 index f96646a32c5..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Collections/Generic/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -/DictionaryExtensions.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Collections/Generic/DictionaryExtensions.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Collections/Generic/DictionaryExtensions.cs deleted file mode 100644 index c9942406cde..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Collections/Generic/DictionaryExtensions.cs +++ /dev/null @@ -1,60 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-
-namespace Microsoft.Internal.Collections
-{
- public static class DictionaryExtensions
- {
- public static bool ContainsAllKeys<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, IEnumerable<TKey> keys)
- {
- foreach (TKey key in keys)
- {
- if (!dictionary.ContainsKey(key))
- return false;
- }
-
- return true;
- }
-
- public static bool DictionaryEquals<TKey, TValue>(this IDictionary<TKey, TValue> dictionary1, IDictionary<TKey, TValue> dictionary2)
- {
- if (dictionary1.Keys.Count != dictionary2.Keys.Count)
- {
- return false;
- }
-
- foreach (KeyValuePair<TKey, TValue> kvp in dictionary1)
- {
- TValue value1 = kvp.Value;
- TValue value2 = default(TValue);
- if (!dictionary2.TryGetValue(kvp.Key, out value2))
- {
- return false;
- }
-
- IDictionary<TKey, TValue> nestedDictionary1 = value1 as IDictionary<TKey, TValue>;
- IDictionary<TKey, TValue> nestedDictionary2 = value1 as IDictionary<TKey, TValue>;
-
- if ((nestedDictionary1 != null) && (nestedDictionary2 != null))
- {
- if (!nestedDictionary1.DictionaryEquals(nestedDictionary2))
- {
- return false;
- }
- }
- else
- {
- if (!(value1.Equals(value2)))
- {
- return false;
- }
- }
- }
-
- return true;
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/.gitattributes deleted file mode 100644 index 8946265321a..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -/ConstraintParser.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/ConstraintParser.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/ConstraintParser.cs deleted file mode 100644 index 2a0a0d3e665..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/ConstraintParser.cs +++ /dev/null @@ -1,225 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Linq.Expressions;
-using System.Reflection;
-using Microsoft.Internal;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition
-{
- public class ContraintParser
- {
- private static readonly PropertyInfo _exportDefinitionContractNameProperty = typeof(ExportDefinition).GetProperty("ContractName");
- private static readonly PropertyInfo _exportDefinitionMetadataProperty = typeof(ExportDefinition).GetProperty("Metadata");
- private static readonly MethodInfo _metadataContainsKeyMethod = typeof(IDictionary<string, object>).GetMethod("ContainsKey");
- private static readonly MethodInfo _metadataItemMethod = typeof(IDictionary<string, object>).GetMethod("get_Item");
- private static readonly MethodInfo _typeIsInstanceOfTypeMethod = typeof(Type).GetMethod("IsInstanceOfType");
-
- public static bool TryParseConstraint(Expression<Func<ExportDefinition, bool>> constraint, out string contractName, out IEnumerable<KeyValuePair<string, Type>> requiredMetadata)
- {
- contractName = null;
- requiredMetadata = null;
-
- List<KeyValuePair<string, Type>> requiredMetadataList = new List<KeyValuePair<string, Type>>();
- foreach (Expression expression in SplitConstraintBody(constraint.Body))
- {
- // First try to parse as a contract, if we don't have one already
- if (contractName == null && TryParseExpressionAsContractConstraintBody(expression, constraint.Parameters[0], out contractName))
- {
- continue;
- }
-
- // Then try to parse as a required metadata item name
- string requiredMetadataItemName = null;
- Type requiredMetadataItemType = null;
- if (TryParseExpressionAsMetadataConstraintBody(expression, constraint.Parameters[0], out requiredMetadataItemName, out requiredMetadataItemType))
- {
- requiredMetadataList.Add(new KeyValuePair<string, Type>(requiredMetadataItemName, requiredMetadataItemType));
- }
-
- // Just skip the expressions we don't understand
- }
-
- // ContractName should have been set already, just need to set metadata
- requiredMetadata = requiredMetadataList;
- return true;
- }
-
-
- private static IEnumerable<Expression> SplitConstraintBody(Expression expression)
- {
- Assert.IsNotNull(expression);
-
- // The expression we know about should be a set of nested AndAlso's, we
- // need to flatten them into one list. we do this iteratively, as
- // recursion will create too much of a memory churn.
- Stack<Expression> expressions = new Stack<Expression>();
- expressions.Push(expression);
-
- while (expressions.Count > 0)
- {
- Expression current = expressions.Pop();
- if (current.NodeType == ExpressionType.AndAlso)
- {
- BinaryExpression andAlso = (BinaryExpression)current;
- // Push right first - this preserves the ordering of the expression, which will force
- // the contract constraint to come up first as the callers are optimized for this form
- expressions.Push(andAlso.Right);
- expressions.Push(andAlso.Left);
- continue;
- }
-
- yield return current;
- }
- }
-
- private static bool TryParseExpressionAsContractConstraintBody(Expression expression, Expression parameter, out string contractName)
- {
- contractName = null;
-
- // The expression should be an '==' expression
- if (expression.NodeType != ExpressionType.Equal)
- {
- return false;
- }
-
- BinaryExpression contractConstraintExpression = (BinaryExpression)expression;
-
- // First try item.ContractName == "Value"
- if (TryParseContractNameFromEqualsExpression(contractConstraintExpression.Left, contractConstraintExpression.Right, parameter, out contractName))
- {
- return true;
- }
-
- // Then try "Value == item.ContractName
- if (TryParseContractNameFromEqualsExpression(contractConstraintExpression.Right, contractConstraintExpression.Left, parameter, out contractName))
- {
- return true;
- }
-
- return false;
- }
-
- private static bool TryParseContractNameFromEqualsExpression(Expression left, Expression right, Expression parameter, out string contractName)
- {
- contractName = null;
-
- // The left should be access to property "Contract" applied to the parameter
- MemberExpression targetMember = left as MemberExpression;
- if (targetMember == null)
- {
- return false;
- }
-
- if ((targetMember.Member != _exportDefinitionContractNameProperty) || (targetMember.Expression != parameter))
- {
- return false;
- }
-
- // Right should a constant expression containing the contract name
- ConstantExpression contractNameConstant = right as ConstantExpression;
- if (contractNameConstant == null)
- {
- return false;
- }
-
- if (!TryParseConstant<string>(contractNameConstant, out contractName))
- {
- return false;
- }
-
- return true;
- }
-
- private static bool TryParseExpressionAsMetadataConstraintBody(Expression expression, Expression parameter, out string requiredMetadataKey, out Type requiredMetadataType)
- {
- Assumes.NotNull(expression, parameter);
-
- requiredMetadataKey = null;
- requiredMetadataType = null;
-
- // Should be a call to Type.IsInstanceofType on definition.Metadata[key]
- MethodCallExpression outerMethodCall = expression as MethodCallExpression;
- if (outerMethodCall == null)
- {
- return false;
- }
-
- // Make sure that the right method ie being called
- if (outerMethodCall.Method != _typeIsInstanceOfTypeMethod)
- {
- return false;
- }
- Assumes.IsTrue(outerMethodCall.Arguments.Count == 1);
-
-
- // 'this' should be a constant expression pointing at a Type object
- ConstantExpression targetType = outerMethodCall.Object as ConstantExpression;
- if(!TryParseConstant<Type>(targetType, out requiredMetadataType))
- {
- return false;
- }
-
- // SHould be a call to get_Item
- MethodCallExpression methodCall = outerMethodCall.Arguments[0] as MethodCallExpression;
- if (methodCall == null)
- {
- return false;
- }
-
- if (methodCall.Method != _metadataItemMethod)
- {
- return false;
- }
-
- // Make sure the method is being called on the right object
- MemberExpression targetMember = methodCall.Object as MemberExpression;
- if (targetMember == null)
- {
- return false;
- }
-
- if ((targetMember.Expression != parameter) || (targetMember.Member != _exportDefinitionMetadataProperty))
- {
- return false;
- }
-
- // There should only ever be one argument; otherwise,
- // we've got the wrong IDictionary.get_Item method.
- Assumes.IsTrue(methodCall.Arguments.Count == 1);
-
- // Argument should a constant expression containing the metadata key
- ConstantExpression requiredMetadataKeyConstant = methodCall.Arguments[0] as ConstantExpression;
- if (requiredMetadataKeyConstant == null)
- {
- return false;
- }
-
- if (!TryParseConstant<string>(requiredMetadataKeyConstant, out requiredMetadataKey))
- {
- return false;
- }
-
- return true;
- }
-
- private static bool TryParseConstant<T>(ConstantExpression constant, out T result)
- where T : class
- {
- Assumes.NotNull(constant);
-
- if (constant.Type == typeof(T) && constant.Value != null)
- {
- result = (T)constant.Value;
- return true;
- }
-
- result = default(T);
- return false;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/Diagnostics/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/Diagnostics/.gitattributes deleted file mode 100644 index 2d87a8bf956..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/Diagnostics/.gitattributes +++ /dev/null @@ -1,4 +0,0 @@ -/TraceContext.TraceContextTraceListener.cs -crlf -/TraceContext.cs -crlf -/TraceEventDetails.cs -crlf -/TraceId.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/Diagnostics/TraceContext.TraceContextTraceListener.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/Diagnostics/TraceContext.TraceContextTraceListener.cs deleted file mode 100644 index aa47b32ed10..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/Diagnostics/TraceContext.TraceContextTraceListener.cs +++ /dev/null @@ -1,42 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-#if !SILVERLIGHT
-
-using System;
-using System.Diagnostics;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-
-namespace System.ComponentModel.Composition.Diagnostics
-{
- partial class TraceContext : IDisposable
- {
- private class TraceContextTraceListener : TraceListener
- {
- private readonly Collection<TraceEventDetails> _traceEvents = new Collection<TraceEventDetails>();
-
- public IList<TraceEventDetails> TraceEvents
- {
- get { return _traceEvents; }
- }
-
- public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string format, params object[] args)
- {
- _traceEvents.Add(new TraceEventDetails(eventCache, source, eventType, (TraceId)id, format, args));
- }
-
- public override void Write(string message)
- {
- throw new NotImplementedException();
- }
-
- public override void WriteLine(string message)
- {
- throw new NotImplementedException();
- }
- }
- }
-}
-
-#endif
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/Diagnostics/TraceContext.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/Diagnostics/TraceContext.cs deleted file mode 100644 index 57486c71b29..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/Diagnostics/TraceContext.cs +++ /dev/null @@ -1,44 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-#if !SILVERLIGHT
-
-using System;
-using System.Linq;
-using System.Diagnostics;
-using System.Collections.Generic;
-
-namespace System.ComponentModel.Composition.Diagnostics
-{
- public partial class TraceContext : IDisposable
- {
- private readonly SourceLevels _previousLevel = TraceSourceTraceWriter.Source.Switch.Level;
- private readonly TraceContextTraceListener _listener = new TraceContextTraceListener();
-
- public TraceContext(SourceLevels level)
- {
- TraceSourceTraceWriter.Source.Switch.Level = level;
- TraceSourceTraceWriter.Source.Listeners.Add(_listener);
- }
-
- [CLSCompliant(false)]
- public TraceEventDetails LastTraceEvent
- {
- get { return _listener.TraceEvents.LastOrDefault(); }
- }
-
- [CLSCompliant(false)]
- public IList<TraceEventDetails> TraceEvents
- {
- get { return _listener.TraceEvents; }
- }
-
- public void Dispose()
- {
- TraceSourceTraceWriter.Source.Listeners.Remove(_listener);
- TraceSourceTraceWriter.Source.Switch.Level = _previousLevel;
- }
- }
-}
-
-#endif
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/Diagnostics/TraceEventDetails.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/Diagnostics/TraceEventDetails.cs deleted file mode 100644 index 8883b0f526a..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/Diagnostics/TraceEventDetails.cs +++ /dev/null @@ -1,62 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-#if !SILVERLIGHT
-
-using System;
-using System.Diagnostics;
-
-namespace System.ComponentModel.Composition.Diagnostics
-{
- [CLSCompliant(false)]
- public class TraceEventDetails
- {
- public TraceEventDetails(TraceEventCache eventCache, string source, TraceEventType eventType, TraceId id, string format, params object[] args)
- {
- EventCache = eventCache;
- Source = source;
- EventType = eventType;
- Id = id;
- Format = format;
- Args = args;
- }
-
- public TraceEventCache EventCache
- {
- get;
- private set;
- }
-
- public string Source
- {
- get;
- private set;
- }
-
- public TraceEventType EventType
- {
- get;
- private set;
- }
-
- public TraceId Id
- {
- get;
- private set;
- }
-
- public string Format
- {
- get;
- private set;
- }
-
- public object[] Args
- {
- get;
- private set;
- }
- }
-}
-
-#endif
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/Diagnostics/TraceId.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/Diagnostics/TraceId.cs deleted file mode 100644 index 7d07532394f..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/Diagnostics/TraceId.cs +++ /dev/null @@ -1,21 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-
-namespace System.ComponentModel.Composition.Diagnostics
-{
- // We need a public version of CompositionTraceId, so that the QA tests can access and verify the trace.
- [CLSCompliant(false)]
- public enum TraceId : ushort
- {
- Rejection_DefinitionRejected = CompositionTraceId.Rejection_DefinitionRejected,
- Rejection_DefinitionResurrected = CompositionTraceId.Rejection_DefinitionResurrected,
-
- Discovery_AssemblyLoadFailed = CompositionTraceId.Discovery_AssemblyLoadFailed,
- Discovery_DefinitionMarkedWithPartNotDiscoverableAttribute = CompositionTraceId.Discovery_DefinitionMarkedWithPartNotDiscoverableAttribute,
- Discovery_DefinitionContainsGenericParameters = CompositionTraceId.Discovery_DefinitionContainsGenericParameters,
- Discovery_DefinitionContainsNoExports = CompositionTraceId.Discovery_DefinitionContainsNoExports,
- Discovery_MemberMarkedWithMultipleImportAndImportMany = CompositionTraceId.Discovery_MemberMarkedWithMultipleImportAndImportMany,
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/Hosting/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/Hosting/.gitattributes deleted file mode 100644 index 4a9c9034149..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/Hosting/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -/CompositionHostTestService.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/Hosting/CompositionHostTestService.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/Hosting/CompositionHostTestService.cs deleted file mode 100644 index fc9606310f4..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/Hosting/CompositionHostTestService.cs +++ /dev/null @@ -1,46 +0,0 @@ -#if SILVERLIGHT
-using System;
-using System.Net;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- public static class CompositionHostTestService
- {
- public static void SetupTestGlobalContainer(CompositionContainer container)
- {
- CompositionHost._container = null;
- CompositionHost.Initialize(container);
- }
-
- public static void SetupTestGlobalContainer(ComposablePartCatalog catalog)
- {
- CompositionHost._container = null;
- CompositionHost.Initialize(catalog);
- }
-
- public static void ClearGlobalContainer()
- {
- CompositionHost._container = null;
- }
-
- public static void ResetGlobalContainer()
- {
- ClearGlobalContainer();
-#if !BUILDING_IN_VS
- // We can only use the default SL Deployment option while building in VS otherwise we
- // will not have a proper Application/Deployment object setup.
- SetupTestGlobalContainer(new AssemblyCatalog(typeof(CompositionHostTestService).Assembly));
-#endif
- }
-
- public static CompositionContainer GlobalContainer
- {
- get { return CompositionHost._container; }
- }
- }
-}
-#endif
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/ReflectionModel/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/ReflectionModel/.gitattributes deleted file mode 100644 index 8e8fec9cec1..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/ReflectionModel/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -/ReflectionModelServicesEx.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/ReflectionModel/ReflectionModelServicesEx.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/ReflectionModel/ReflectionModelServicesEx.cs deleted file mode 100644 index 75b483e163b..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/ReflectionModel/ReflectionModelServicesEx.cs +++ /dev/null @@ -1,155 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition;
-using System.Linq;
-using System.Linq.Expressions;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.Reflection;
-using System.ComponentModel.Composition.Hosting;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-
-// NOTE : this is a helper class for exosig the EditorFactory functionality to tests until ExportFactory can be moved where it belongs
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- public static class ReflectionModelServicesEx
- {
- public static ContractBasedImportDefinition CreateImportDefinition(
- Lazy<ParameterInfo> parameter,
- string contractName,
- string requiredTypeIdentity,
- IEnumerable<KeyValuePair<string, Type>> requiredMetadata,
- ImportCardinality cardinality,
- CreationPolicy requiredCreationPolicy,
- bool isExportFactory,
- ICompositionElement origin)
- {
- return ReflectionModelServices.CreateImportDefinition(parameter, contractName, requiredTypeIdentity, requiredMetadata, cardinality, requiredCreationPolicy, isExportFactory, origin);
- }
-
- public static ContractBasedImportDefinition CreateImportDefinition(
- LazyMemberInfo importingMember,
- string contractName,
- string requiredTypeIdentity,
- IEnumerable<KeyValuePair<string, Type>> requiredMetadata,
- ImportCardinality cardinality,
- bool isRecomposable,
- CreationPolicy requiredCreationPolicy,
- bool isExportFactory,
- ICompositionElement origin)
- {
- return ReflectionModelServices.CreateImportDefinition(importingMember, contractName, requiredTypeIdentity, requiredMetadata, cardinality, isRecomposable, requiredCreationPolicy, isExportFactory, origin);
- }
-
- public static bool IsExportFactoryImportDefinition(ImportDefinition importDefinition)
- {
- return ReflectionModelServices.IsExportFactoryImportDefinition(importDefinition);
- }
-
- public static ContractBasedImportDefinition CreateExportFactoryImportDefinition(ContractBasedImportDefinition productImportDefinition)
- {
- return new ExportFactoryImportDefinition(productImportDefinition);
- }
-
- private class ExportFactoryImportDefinition : ContractBasedImportDefinition, IPartCreatorImportDefinition
- {
- private readonly ContractBasedImportDefinition _productImportDefinition;
-
- public ExportFactoryImportDefinition(ContractBasedImportDefinition productImportDefinition)
- : base(CompositionConstants.PartCreatorContractName, CompositionConstants.PartCreatorTypeIdentity, productImportDefinition.RequiredMetadata,
- productImportDefinition.Cardinality, productImportDefinition.IsRecomposable, false, CreationPolicy.Any)
- {
- _productImportDefinition = productImportDefinition;
- }
-
- public ContractBasedImportDefinition ProductImportDefinition
- {
- get
- {
- return _productImportDefinition;
- }
- }
-
- public override Expression<Func<ExportDefinition, bool>> Constraint
- {
- get
- {
- return CreateExportFactoryConstraint(base.Constraint, this._productImportDefinition);
- }
- }
-
- public override bool IsConstraintSatisfiedBy(ExportDefinition exportDefinition)
- {
- if (!base.IsConstraintSatisfiedBy(exportDefinition))
- {
- return false;
- }
-
- return IsProductConstraintSatisfiedBy(this._productImportDefinition, exportDefinition);
- }
-
- private static bool IsProductConstraintSatisfiedBy(ImportDefinition productImportDefinition, ExportDefinition exportDefinition)
- {
- object productValue = null;
- if (exportDefinition.Metadata.TryGetValue(CompositionConstants.ProductDefinitionMetadataName, out productValue))
- {
- ExportDefinition productDefinition = productValue as ExportDefinition;
-
- if (productDefinition != null)
- {
- return productImportDefinition.IsConstraintSatisfiedBy(productDefinition);
- }
- }
-
- return false;
- }
-
- private static readonly PropertyInfo _exportDefinitionMetadataProperty = typeof(ExportDefinition).GetProperty("Metadata");
- private static readonly MethodInfo _metadataContainsKeyMethod = typeof(IDictionary<string, object>).GetMethod("ContainsKey");
- private static readonly MethodInfo _metadataItemMethod = typeof(IDictionary<string, object>).GetMethod("get_Item");
-
- private static Expression<Func<ExportDefinition, bool>> CreateExportFactoryConstraint(Expression<Func<ExportDefinition, bool>> baseConstraint, ImportDefinition productImportDefinition)
- {
- ParameterExpression exportDefinitionParameter = baseConstraint.Parameters[0];
-
- // exportDefinition.Metadata
- Expression metadataExpression = Expression.Property(exportDefinitionParameter, _exportDefinitionMetadataProperty);
-
- // exportDefinition.Metadata.ContainsKey("ProductDefinition")
- Expression containsProductExpression = Expression.Call(
- metadataExpression,
- _metadataContainsKeyMethod,
- Expression.Constant(CompositionConstants.ProductDefinitionMetadataName));
-
- // exportDefinition.Metadata["ProductDefinition"]
- Expression productExportDefinitionExpression = Expression.Call(
- metadataExpression,
- _metadataItemMethod,
- Expression.Constant(CompositionConstants.ProductDefinitionMetadataName));
-
- // ProductImportDefinition.Contraint((ExportDefinition)exportDefinition.Metadata["ProductDefinition"])
- Expression productMatchExpression =
- Expression.Invoke(productImportDefinition.Constraint,
- Expression.Convert(productExportDefinitionExpression, typeof(ExportDefinition)));
-
- // baseContraint(exportDefinition) &&
- // exportDefinition.Metadata.ContainsKey("ProductDefinition") &&
- // ProductImportDefinition.Contraint((ExportDefinition)exportDefinition.Metadata["ProductDefinition"])
- Expression<Func<ExportDefinition, bool>> constraint =
- Expression.Lambda<Func<ExportDefinition, bool>>(
- Expression.AndAlso(
- baseConstraint.Body,
- Expression.AndAlso(
- containsProductExpression,
- productMatchExpression)),
- exportDefinitionParameter);
-
- return constraint;
- }
- }
-
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/UnitTesting/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/UnitTesting/.gitattributes deleted file mode 100644 index 54538e6d2f4..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/UnitTesting/.gitattributes +++ /dev/null @@ -1,4 +0,0 @@ -/CompositionAssert.cs -crlf -/ElementAssert.cs -crlf -/ErrorId.cs -crlf -/ExportsAssert.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/UnitTesting/CompositionAssert.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/UnitTesting/CompositionAssert.cs deleted file mode 100644 index 8039a825934..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/UnitTesting/CompositionAssert.cs +++ /dev/null @@ -1,439 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition;
-using System.Linq;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.Reflection;
-using System.ComponentModel.Composition.Hosting;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.UnitTesting
-{
- public static class CompositionAssert
- {
- internal static void AreEqual(CompositionResult expected, CompositionResult actual)
- {
- Assert.AreEqual(expected.Succeeded, actual.Succeeded);
-
- EnumerableAssert.AreSequenceEqual(expected.Errors, actual.Errors, (index, expectedError, actualError) =>
- {
- AreEqual(expectedError, actualError);
- });
- }
-
- internal static void AreEqual(CompositionError expected, CompositionError actual)
- {
- Assert.AreEqual(((ICompositionError)expected).Id, ((ICompositionError)actual).Id);
- Assert.AreEqual(expected.Description, actual.Description);
- ExtendedAssert.IsInstanceOfSameType(expected.Exception, actual.Exception);
- }
-
- public static void ThrowsPart(ErrorId id, Action action)
- {
- ThrowsPart(id, RetryMode.Retry, action);
- }
-
- public static void ThrowsPart(ErrorId id, RetryMode retry, Action action)
- {
- ThrowsPart(new CompositionErrorExpectation { Id = id }, retry, action);
- }
-
- public static void ThrowsPart(ErrorId id, ICompositionElement element, Action action)
- {
- ThrowsPart(id, element, RetryMode.Retry, action);
- }
-
- public static void ThrowsPart(ErrorId id, ICompositionElement element, RetryMode retry, Action action)
- {
- ThrowsPart(new CompositionErrorExpectation { Id = id, Element = element }, retry, action);
- }
-
- public static void ThrowsPart<TInner>(ErrorId id, Action action)
- where TInner : Exception
- {
- ThrowsPart<TInner>(id, RetryMode.Retry, action);
- }
-
- public static void ThrowsPart<TInner>(ErrorId id, RetryMode retry, Action action)
- where TInner : Exception
- {
- ThrowsPart(new CompositionErrorExpectation { Id = id, InnerExceptionType = typeof(TInner) }, retry, action);
- }
-
- private static void ThrowsPart(CompositionErrorExpectation expectation, RetryMode retry, Action action)
- {
- ExceptionAssert.Throws<ComposablePartException>(retry, action, (thrownException, retryCount) =>
- {
- AssertCore(retryCount, "ComposablePartException", thrownException, expectation);
- });
- }
-
- public static void ThrowsRootError(ErrorId rootId, RetryMode retry, Action action)
- {
- var exception = ExceptionAssert.Throws<CompositionException>(retry, action, (thrownException, retryCount) =>
- {
- ErrorId actualId = GetRootErrorId(thrownException);
-
- Assert.AreEqual(rootId, actualId, "Retry Count {0}: Expected '{1}' to be the root ErrorId, however, '{2}' is.", retryCount, rootId, actualId);
- });
- }
-
- public static void ThrowsError<TInner>(ErrorId id, RetryMode retry, Action action)
- {
- ThrowsError(new CompositionErrorExpectation { Id = id, InnerExceptionType = typeof(TInner) }, RetryMode.Retry, action);
- }
-
- public static void ThrowsError(ErrorId id, Action action)
- {
- ThrowsError(new CompositionErrorExpectation { Id = id}, RetryMode.Retry, action);
- }
-
- public static void ThrowsError(ErrorId id, ErrorId innerId, Action action)
- {
- ThrowsError(id, innerId, RetryMode.Retry, action);
- }
-
- public static void ThrowsError(ErrorId id, ErrorId innerId, RetryMode retry, Action action)
- {
- ThrowsError(GetExpectation(id, innerId), retry, action);
- }
-
- public static void ThrowsError(ErrorId id, ErrorId innerId, ErrorId innerInnerId, Action action)
- {
- ThrowsError(id, innerId, innerInnerId, RetryMode.Retry, action);
- }
-
- public static void ThrowsError(ErrorId id, ErrorId innerId, ErrorId innerInnerId, RetryMode retry, Action action)
- {
- ThrowsError(GetExpectation(id, innerId, innerInnerId), retry, action);
- }
-
- public static void ThrowsError(ErrorId id, RetryMode retry, Action action)
- {
- ThrowsError(new CompositionErrorExpectation { Id = id, }, retry, action);
- }
-
- public static void ThrowsError(ErrorId id, ICompositionElement element, Action action)
- {
- ThrowsError(new CompositionErrorExpectation { Id = id, Element = element}, RetryMode.Retry, action);
- }
-
- public static void ThrowsError(ErrorId id, ICompositionElement element, RetryMode retry, Action action)
- {
- ThrowsError(new CompositionErrorExpectation { Id = id, Element = element }, retry, action);
- }
-
- public static void ThrowsError(ErrorId id, Exception exception, Action action)
- {
- ThrowsError(new CompositionErrorExpectation { Id = id, InnerException = exception }, RetryMode.Retry, action);
- }
-
- public static void ThrowsError(ErrorId id, Exception exception, RetryMode retry, Action action)
- {
- ThrowsError(new CompositionErrorExpectation { Id = id, InnerException = exception }, retry, action);
- }
-
- public static void ThrowsError(ErrorId id, ICompositionElement element, Exception exception, Action action)
- {
- ThrowsError(new CompositionErrorExpectation { Id = id, Element = element, InnerException = exception }, RetryMode.Retry, action);
- }
-
- public static void ThrowsError(ErrorId id, ICompositionElement element, Exception exception, RetryMode retry, Action action)
- {
- ThrowsError(new CompositionErrorExpectation { Id = id, Element = element, InnerException = exception }, retry, action);
- }
-
- private static void ThrowsError(CompositionErrorExpectation expectation, RetryMode retry, Action action)
- {
- ThrowsErrors(new CompositionErrorExpectation[] { expectation }, retry, action);
- }
-
- public static void ThrowsErrors(ErrorId id1, ErrorId id2, Action action)
- {
- ThrowsErrors(id1, id2, RetryMode.Retry, action);
- }
-
- public static void ThrowsErrors(ErrorId id1, ErrorId id2, RetryMode retry, Action action)
- {
- ThrowsErrors(new ErrorId[] { id1, id2 }, retry, action);
- }
-
- public static void ThrowsErrors(ErrorId[] ids, RetryMode retry, Action action)
- {
- CompositionErrorExpectation[] expectations = new CompositionErrorExpectation[ids.Length];
- for (int i = 0; i < expectations.Length; i++)
- {
- expectations[i] = new CompositionErrorExpectation { Id = ids[i] };
- }
-
- ThrowsErrors(expectations, retry, action);
- }
-
- private static void ThrowsErrors(CompositionErrorExpectation[] expectations, RetryMode retry, Action action)
- {
- ExceptionAssert.Throws<CompositionException>(retry, action, (thrownException, retryCount) =>
- {
- AssertCore(retryCount, "CompositionException", thrownException, expectations);
- });
- }
-
- public static void ThrowsChangeRejectedRootError(ErrorId rootId, RetryMode retry, Action action)
- {
- var exception = ExceptionAssert.Throws<ChangeRejectedException>(retry, action, (thrownException, retryCount) =>
- {
- ErrorId actualId = GetRootErrorId(thrownException);
-
- Assert.AreEqual(rootId, actualId, "Retry Count {0}: Expected '{1}' to be the root ErrorId, however, '{2}' is.", retryCount, rootId, actualId);
- });
- }
-
- public static void ThrowsChangeRejectedError(ErrorId id, Action action)
- {
- ThrowsChangeRejectedError(new CompositionErrorExpectation { Id = id }, RetryMode.Retry, action);
- }
-
- public static void ThrowsChangeRejectedError(ErrorId id, RetryMode retry, Action action)
- {
- ThrowsChangeRejectedError(new CompositionErrorExpectation { Id = id, }, retry, action);
- }
-
- public static void ThrowsChangeRejectedError(ErrorId id, ICompositionElement element, Action action)
- {
- ThrowsChangeRejectedError(new CompositionErrorExpectation { Id = id, Element = element }, RetryMode.Retry, action);
- }
-
- public static void ThrowsChangeRejectedError(ErrorId id, ErrorId innerId, RetryMode retry, Action action)
- {
- ThrowsChangeRejectedError(GetExpectation(id, innerId), retry, action);
- }
-
- public static void ThrowsChangeRejectedError(ErrorId id, ErrorId innerId, ErrorId innerInnerId, Action action)
- {
- ThrowsChangeRejectedError(id, innerId, innerInnerId, RetryMode.Retry, action);
- }
-
- public static void ThrowsChangeRejectedError(ErrorId id, ErrorId innerId, ErrorId innerInnerId, RetryMode retry, Action action)
- {
- ThrowsChangeRejectedError(GetExpectation(id, innerId, innerInnerId), retry, action);
- }
-
- private static void ThrowsChangeRejectedError(CompositionErrorExpectation expectation, RetryMode retry, Action action)
- {
- ThrowsChangeRejectedErrors(new CompositionErrorExpectation[] { expectation }, retry, action);
- }
-
- public static void ThrowsChangeRejectedError(ErrorId id, ICompositionElement element, Exception exception, Action action)
- {
- ThrowsChangeRejectedError(new CompositionErrorExpectation { Id = id, Element = element, InnerException = exception }, RetryMode.Retry, action);
- }
-
- public static void ThrowsChangeRejectedErrors(ErrorId id1, ErrorId id2, RetryMode retry, Action action)
- {
- ThrowsChangeRejectedErrors(new ErrorId[] { id1, id2 }, retry, action);
- }
-
- public static void ThrowsChangeRejectedErrors(ErrorId[] ids, RetryMode retry, Action action)
- {
- CompositionErrorExpectation[] expectations = new CompositionErrorExpectation[ids.Length];
- for (int i = 0; i < expectations.Length; i++)
- {
- expectations[i] = new CompositionErrorExpectation { Id = ids[i] };
- }
-
- ThrowsChangeRejectedErrors(expectations, retry, action);
- }
-
- private static void ThrowsChangeRejectedErrors(CompositionErrorExpectation[] expectations, RetryMode retry, Action action)
- {
- ExceptionAssert.Throws<ChangeRejectedException>(retry, action, (thrownException, retryCount) =>
- {
- AssertCore(retryCount, "CompositionException", thrownException, expectations);
- });
- }
-
- private static void AssertCore(int retryCount, string prefix, CompositionException exception, CompositionErrorExpectation[] expectations)
- {
- Assert.AreEqual(exception.Errors.Count, expectations.Length);
-
- for (int i = 0; i < exception.Errors.Count; i++)
- {
- AssertCore(retryCount, prefix + ".Errors[" + i + "]", exception.Errors[i], expectations[i]);
- }
- }
-
- private static void AssertCore(int retryCount, string prefix, ICompositionError error, CompositionErrorExpectation expectation)
- {
- if (expectation.IdSpecified)
- {
- AssertCore(retryCount, prefix, "Id", expectation.Id, (ErrorId)error.Id);
- }
-
- if (expectation.ElementSpecified)
- {
- AssertCore(retryCount, prefix, "Element", expectation.Element, error.Element);
- }
-
- if (expectation.InnerExceptionSpecified)
- {
- AssertCore(retryCount, prefix, "InnerException", expectation.InnerException, error.InnerException);
- }
-
- if (expectation.InnerExceptionTypeSpecified)
- {
- AssertCore(retryCount, prefix, "InnerException.GetType()", expectation.InnerExceptionType, error.InnerException == null ? null : error.InnerException.GetType());
- }
-
- if (expectation.InnerExpectationsSpecified)
- {
- ICompositionError innerError = error.InnerException as ICompositionError;
- if (innerError != null)
- {
- Assert.AreEqual(1, expectation.InnerExpectations.Length);
- AssertCore(retryCount, prefix + ".InnerException", innerError, expectation.InnerExpectations[0]);
- }
- else
- {
- AssertCore(retryCount, prefix + ".InnerException", (CompositionException)error.InnerException, expectation.InnerExpectations);
- }
- }
- }
-
- private static void AssertCore<T>(int retryCount, string prefix, string propertyName, T expected, T actual)
- {
- Assert.AreEqual(expected, actual, "Retry Count {0}: Expected '{1}' to be {3}.{4}, however, '{2}' is.", retryCount, expected, actual, prefix, propertyName);
- }
-
- private static CompositionErrorExpectation GetExpectation(params ErrorId[] ids)
- {
- var parent = new CompositionErrorExpectation() { Id = ids[0] };
- var expectation = parent;
-
- for (int i = 1; i < ids.Length; i++)
- {
- expectation.InnerExpectations = new CompositionErrorExpectation[] { new CompositionErrorExpectation() { Id = ids[i] } };
- expectation = expectation.InnerExpectations[0];
- }
-
- return parent;
- }
-
- private static ErrorId GetRootErrorId(CompositionException exception)
- {
- Assert.IsTrue(exception.Errors.Count == 1);
-
- return GetRootErrorId(exception.Errors[0]);
- }
-
- private static ErrorId GetRootErrorId(ICompositionError error)
- {
- Exception exception = error.InnerException;
-
- var childError = exception as ICompositionError;
- if (childError != null)
- {
- return GetRootErrorId(childError);
- }
-
- CompositionException composition = exception as CompositionException;
- if (composition != null)
- {
- return GetRootErrorId(composition);
- }
-
- return (ErrorId)error.Id;
- }
-
- private class CompositionErrorExpectation
- {
- private ErrorId _id;
- private Exception _innerException;
- private Type _innerExceptionType;
- private ICompositionElement _element;
- private CompositionErrorExpectation[] _innerExpectations;
-
- public ErrorId Id
- {
- get { return _id; }
- set
- {
- _id = value;
- IdSpecified = true;
- }
- }
-
- public Exception InnerException
- {
- get { return _innerException; }
- set
- {
- _innerException = value;
- InnerExceptionSpecified = true;
- }
- }
-
- public Type InnerExceptionType
- {
- get { return _innerExceptionType; }
- set
- {
- _innerExceptionType = value;
- InnerExceptionTypeSpecified = true;
- }
- }
-
- public ICompositionElement Element
- {
- get { return _element; }
- set
- {
- _element = value;
- ElementSpecified = true;
- }
- }
-
- public CompositionErrorExpectation[] InnerExpectations
- {
- get { return _innerExpectations; }
- set
- {
- _innerExpectations = value;
- InnerExpectationsSpecified = true;
- }
- }
-
- public bool IdSpecified
- {
- get;
- private set;
- }
-
- public bool InnerExceptionSpecified
- {
- get;
- private set;
- }
-
- public bool InnerExceptionTypeSpecified
- {
- get;
- private set;
- }
-
- public bool ElementSpecified
- {
- get;
- private set;
- }
-
- public bool InnerExpectationsSpecified
- {
- get;
- private set;
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/UnitTesting/ElementAssert.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/UnitTesting/ElementAssert.cs deleted file mode 100644 index 8a9a4194475..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/UnitTesting/ElementAssert.cs +++ /dev/null @@ -1,42 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Linq;
-using System.Linq.Expressions;
-using System.UnitTesting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.ComponentModel.Composition.UnitTesting
-{
- internal static class ElementAssert
- {
- public static void AreEqual(ICompositionElement expected, ICompositionElement actual)
- {
- if (expected == null || actual == null)
- {
- Assert.AreEqual(expected, actual);
- return;
- }
-
- Assert.AreEqual(expected.DisplayName, actual.DisplayName);
- ElementAssert.AreEqual(expected.Origin, actual.Origin);
- }
-
- public static void AreEqual(IEnumerable<ICompositionElement> expected, IEnumerable<ICompositionElement> actual)
- {
- Assert.AreEqual(expected.Count(), actual.Count());
-
- int index = 0;
- foreach (var element in expected)
- {
- AreEqual(element, actual.ElementAt(index));
-
- index++;
- }
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/UnitTesting/ErrorId.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/UnitTesting/ErrorId.cs deleted file mode 100644 index 4ed1d2cbecc..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/UnitTesting/ErrorId.cs +++ /dev/null @@ -1,42 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-
-namespace System.ComponentModel.Composition
-{
- // We need a public version of CompositionErrorId, so that the QA tests can access and verify the errors.
- public enum ErrorId : int
- {
- Unknown = CompositionErrorId.Unknown,
- InvalidExportMetadata = CompositionErrorId.InvalidExportMetadata,
- RequiredMetadataNotFound = CompositionErrorId.RequiredMetadataNotFound,
- UnsupportedExportType = CompositionErrorId.UnsupportedExportType,
- ImportNotSetOnPart = CompositionErrorId.ImportNotSetOnPart,
- ImportEngine_ComposeTookTooManyIterations = CompositionErrorId.ImportEngine_ComposeTookTooManyIterations,
- ImportEngine_ImportCardinalityMismatch = CompositionErrorId.ImportEngine_ImportCardinalityMismatch,
- ImportEngine_PartCycle = CompositionErrorId.ImportEngine_PartCycle,
- ImportEngine_PartCannotSetImport = CompositionErrorId.ImportEngine_PartCannotSetImport,
- ImportEngine_PartCannotGetExportedValue = CompositionErrorId.ImportEngine_PartCannotGetExportedValue,
- ImportEngine_PartCannotActivate = CompositionErrorId.ImportEngine_PartCannotActivate,
- ImportEngine_PreventedByExistingImport = CompositionErrorId.ImportEngine_PreventedByExistingImport,
- ImportEngine_InvalidStateForRecomposition = CompositionErrorId.ImportEngine_InvalidStateForRecomposition,
- ReflectionModel_PartConstructorMissing = CompositionErrorId.ReflectionModel_PartConstructorMissing,
- ReflectionModel_PartConstructorThrewException = CompositionErrorId.ReflectionModel_PartConstructorThrewException,
- ReflectionModel_PartOnImportsSatisfiedThrewException = CompositionErrorId.ReflectionModel_PartOnImportsSatisfiedThrewException,
- ReflectionModel_ExportNotReadable = CompositionErrorId.ReflectionModel_ExportNotReadable,
- ReflectionModel_ExportThrewException = CompositionErrorId.ReflectionModel_ExportThrewException,
- ReflectionModel_ExportMethodTooManyParameters = CompositionErrorId.ReflectionModel_ExportMethodTooManyParameters,
- ReflectionModel_ImportNotWritable = CompositionErrorId.ReflectionModel_ImportNotWritable,
- ReflectionModel_ImportThrewException = CompositionErrorId.ReflectionModel_ImportThrewException,
- ReflectionModel_ImportNotAssignableFromExport = CompositionErrorId.ReflectionModel_ImportNotAssignableFromExport,
- ReflectionModel_ImportCollectionNull = CompositionErrorId.ReflectionModel_ImportCollectionNull,
- ReflectionModel_ImportCollectionNotWritable = CompositionErrorId.ReflectionModel_ImportCollectionNotWritable,
- ReflectionModel_ImportCollectionConstructionThrewException = CompositionErrorId.ReflectionModel_ImportCollectionConstructionThrewException,
- ReflectionModel_ImportCollectionGetThrewException = CompositionErrorId.ReflectionModel_ImportCollectionGetThrewException,
- ReflectionModel_ImportCollectionIsReadOnlyThrewException = CompositionErrorId.ReflectionModel_ImportCollectionIsReadOnlyThrewException,
- ReflectionModel_ImportCollectionClearThrewException = CompositionErrorId.ReflectionModel_ImportCollectionClearThrewException,
- ReflectionModel_ImportCollectionAddThrewException = CompositionErrorId.ReflectionModel_ImportCollectionAddThrewException,
- ReflectionModel_ImportManyOnParameterCanOnlyBeAssigned = CompositionErrorId.ReflectionModel_ImportManyOnParameterCanOnlyBeAssigned,
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/UnitTesting/ExportsAssert.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/UnitTesting/ExportsAssert.cs deleted file mode 100644 index d68a4ba1505..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ComponentModel/Composition/UnitTesting/ExportsAssert.cs +++ /dev/null @@ -1,30 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.UnitTesting;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.UnitTesting
-{
- public static class ExportsAssert
- {
- public static void AreEqual<T>(IEnumerable<Export> actual, params T[] expected)
- {
- EnumerableAssert.AreEqual((IEnumerable)expected, (IEnumerable)actual.Select(export => export.Value));
- }
-
- public static void AreEqual<T>(IEnumerable<Lazy<T>> actual, params T[] expected)
- {
- EnumerableAssert.AreEqual((IEnumerable<T>)expected, (IEnumerable<T>)actual.Select(export => export.Value));
- }
-
- public static void AreEqual<T, TMetadataView>(IEnumerable<Lazy<T, TMetadataView>> actual, params T[] expected)
- {
- EnumerableAssert.AreEqual((IEnumerable<T>)expected, (IEnumerable<T>)actual.Select(export => export.Value));
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/DisposableObject.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/DisposableObject.cs deleted file mode 100644 index 5b7ba3cd135..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/DisposableObject.cs +++ /dev/null @@ -1,21 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-
-namespace System
-{
- public class DisposableObject : IDisposable
- {
- public int DisposeCount
- {
- get;
- private set;
- }
-
- public void Dispose()
- {
- DisposeCount++;
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/EnumExtensions.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/EnumExtensions.cs deleted file mode 100644 index f6314786173..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/EnumExtensions.cs +++ /dev/null @@ -1,20 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-#if !CLR40
-using System;
-
-namespace System
-{
- public static class EnumExtensions
- {
- public static bool HasFlag(this Enum enumRef, Enum flag)
- {
- long value = Convert.ToInt64(enumRef);
- long flagVal = Convert.ToInt64(flag);
-
- return (value & flagVal) == flagVal;
- }
- }
-}
-#endif
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Globalization/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Globalization/.gitattributes deleted file mode 100644 index f5c09b62787..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Globalization/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -/CurrentCultureContext.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Globalization/CurrentCultureContext.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Globalization/CurrentCultureContext.cs deleted file mode 100644 index 6210c7f9aa6..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Globalization/CurrentCultureContext.cs +++ /dev/null @@ -1,29 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Globalization;
-using System.Threading;
-
-namespace System.Globalization
-{
- public class CurrentCultureContext : IDisposable
- {
- private CultureInfo _previousCulture;
-
- public CurrentCultureContext(CultureInfo culture)
- {
- _previousCulture = Thread.CurrentThread.CurrentCulture;
-
- Thread.CurrentThread.CurrentCulture = culture;
- }
-
- public void Dispose()
- {
- if (_previousCulture != null)
- {
- Thread.CurrentThread.CurrentCulture = _previousCulture;
- }
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/IO/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/IO/.gitattributes deleted file mode 100644 index bca099de401..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/IO/.gitattributes +++ /dev/null @@ -1,4 +0,0 @@ -/FileIO.cs -crlf -/TemporaryDirectory.cs -crlf -/TemporaryFile.cs -crlf -/TemporaryFileCopier.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/IO/FileIO.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/IO/FileIO.cs deleted file mode 100644 index d004fd7c7de..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/IO/FileIO.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Reflection;
-using System.UnitTesting;
-
-namespace System.IO
-{
- public static class FileIO
- {
- public const string RootTemporaryDirectoryName = "RootTempDirectory";
-
- private static string _temporaryDirectory;
- public static string GetRootTemporaryDirectory()
- {
- if (_temporaryDirectory == null)
- {
-#if SILVERLIGHT
- string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), RootTemporaryDirectoryName);
-#else
- string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, RootTemporaryDirectoryName);
-#endif
-
- if (!Directory.Exists(path))
- {
- Directory.CreateDirectory(path);
- }
-
- _temporaryDirectory = path;
- }
-
- return _temporaryDirectory;
- }
-
- public static string GetNewTemporaryDirectory()
- {
- string path = Path.Combine(GetRootTemporaryDirectory(), TestServices.GenerateRandomString());
-
- Directory.CreateDirectory(path);
-
- return path;
- }
-
- public static string GetTemporaryFileName(string extension)
- {
- return Path.Combine(GetRootTemporaryDirectory(), TestServices.GenerateRandomString() + "." + extension);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/IO/TemporaryDirectory.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/IO/TemporaryDirectory.cs deleted file mode 100644 index 7f373a292f5..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/IO/TemporaryDirectory.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-
-#if !SILVERLIGHT
-
-using System;
-
-namespace System.IO
-{
- public class TemporaryDirectory : IDisposable
- {
- private string _directoryPath;
-
- public TemporaryDirectory()
- {
- _directoryPath = FileIO.GetNewTemporaryDirectory();
- }
-
- public string DirectoryPath
- {
- get { return _directoryPath; }
- }
-
- public void Dispose()
- {
- if (_directoryPath != null)
- {
- try
- {
- Directory.Delete(_directoryPath, true);
- }
- catch (IOException)
- {
- }
-
- _directoryPath = null;
- }
- }
- }
-}
-
-#endif
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/IO/TemporaryFile.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/IO/TemporaryFile.cs deleted file mode 100644 index 69fda640ef6..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/IO/TemporaryFile.cs +++ /dev/null @@ -1,35 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-#if !SILVERLIGHT
-
-using System;
-
-namespace System.IO
-{
- public class TemporaryFile : IDisposable
- {
- private string _fileName;
-
- public TemporaryFile()
- {
- _fileName = Path.GetTempFileName();
- }
-
- public string FileName
- {
- get { return _fileName; }
- }
-
- public void Dispose()
- {
- if (_fileName != null)
- {
- File.Delete(_fileName);
- _fileName = null;
- }
- }
- }
-}
-
-#endif
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/IO/TemporaryFileCopier.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/IO/TemporaryFileCopier.cs deleted file mode 100644 index d1ae9070ba5..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/IO/TemporaryFileCopier.cs +++ /dev/null @@ -1,22 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-#if !SILVERLIGHT
-
-using System;
-
-namespace System.IO
-{
- public class TemporaryFileCopier : TemporaryDirectory
- {
- public TemporaryFileCopier(params string[] fileNames)
- {
- foreach (string fileName in fileNames)
- {
- File.Copy(fileName, Path.Combine(DirectoryPath, Path.GetFileName(fileName)));
- }
- }
- }
-}
-
-#endif
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ReferenceTracker.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ReferenceTracker.cs deleted file mode 100644 index b803e62f604..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/ReferenceTracker.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.UnitTesting;
-
-namespace System
-{
- public class ReferenceTracker
- {
- public readonly List<WeakReference> ReferencesExpectedToBeCollected = new List<WeakReference>();
- public readonly List<WeakReference> ReferencesNotExpectedToBeCollected = new List<WeakReference>();
-
- public void AddReferencesExpectedToBeCollected(params object[] objects)
- {
- for (int i = 0; i < objects.Length; i++)
- {
- ReferencesExpectedToBeCollected.Add(new WeakReference(objects[i]));
- objects[i] = null;
- }
- }
-
- public void AddReferencesNotExpectedToBeCollected(params object[] objects)
- {
- for (int i = 0; i < objects.Length; i++)
- {
- ReferencesNotExpectedToBeCollected.Add(new WeakReference(objects[i]));
- objects[i] = null;
- }
- }
-
- public void CollectAndAssert()
- {
- GC.Collect();
- GC.WaitForPendingFinalizers();
-
- EnumerableAssert.IsTrueForAll(ReferencesExpectedToBeCollected, wr => wr.Target == null, "Object should have been collected.");
- EnumerableAssert.IsTrueForAll(ReferencesNotExpectedToBeCollected, wr => wr.Target != null, "Object should be have NOT been collected.");
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Runtime/Serialization/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Runtime/Serialization/.gitattributes deleted file mode 100644 index 3ed0af6a232..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Runtime/Serialization/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -/SerializationTestServices.cs -crlf -/StrictFormatterConverter.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Runtime/Serialization/SerializationTestServices.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Runtime/Serialization/SerializationTestServices.cs deleted file mode 100644 index 338b520cf94..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Runtime/Serialization/SerializationTestServices.cs +++ /dev/null @@ -1,155 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-#if !SILVERLIGHT
-
-using System;
-using System.IO;
-using System.Runtime.Serialization.Formatters.Binary;
-using System.Reflection;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.Runtime.Serialization
-{
- public static class SerializationTestServices
- {
- /// <summary>
- /// Serializes and then deserializes the specified value.
- /// </summary>
- public static T RoundTrip<T>(T value)
- {
- Assert.IsNotNull(value);
-
- using (MemoryStream stream = new MemoryStream())
- {
- BinaryFormatter formatter = new BinaryFormatter();
- formatter.Serialize(stream, value);
-
- stream.Seek(0, SeekOrigin.Begin);
- return (T)formatter.Deserialize(stream);
- }
- }
-
- /// <summary>
- /// Creates an instance of a type using the serialization constructor.
- /// </summary>
- public static T Create<T>(SerializationInfo info, StreamingContext context)
- {
- ConstructorInfo constructor = typeof(T).GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null,
- new Type[] { typeof(SerializationInfo), typeof(StreamingContext) },
- (ParameterModifier[])null);
-
- Assert.IsNotNull(constructor, "Type does not have a private or protected serialization constructor.");
-
- try
- {
- return (T)constructor.Invoke(new object[] { info, context });
- }
- catch (TargetInvocationException ex)
- {
- throw ex.InnerException;
- }
- }
-
- /// <summary>
- /// Returns a new instance of <see cref="SerializationInfo"/> replacing the specified member name with the specified value.
- /// </summary>
- public static SerializationInfo CreateSerializationInfoReplacingMember<T>(string memberName, object value)
- where T : ISerializable, new()
- {
- return CreateSerializationInfoReplacingMember(memberName, value, () => new T());
- }
-
- /// <summary>
- /// Returns a new instance of <see cref="SerializationInfo"/> replacing the specified member name with the specified value.
- /// </summary>
- public static SerializationInfo CreateSerializationInfoReplacingMember<T>(string memberName, object value, Func<T> creator)
- where T : ISerializable
- {
- T serializableObject = creator();
-
- var info = GetObjectDataFrom(serializableObject);
-
- return CloneReplacingMember<T>(info, memberName, value);
- }
-
- /// <summary>
- /// Returns a new instance of <see cref="SerializationInfo"/> removing the specified member name.
- /// </summary>
- public static SerializationInfo CreateSerializationInfoRemovingMember<T>(string memberName)
- where T : ISerializable, new()
- {
- return CreateSerializationInfoRemovingMember(memberName, () => new T());
- }
-
- /// <summary>
- /// Returns a new instance of <see cref="SerializationInfo"/> removing the specified member name.
- /// </summary>
- public static SerializationInfo CreateSerializationInfoRemovingMember<T>(string memberName, Func<T> creator)
- where T : ISerializable
- {
- T serializableObject = creator();
-
- var info = GetObjectDataFrom(serializableObject);
-
- return CloneRemovingMember<T>(info, memberName);
- }
-
- private static SerializationInfo CloneReplacingMember<T>(SerializationInfo info, string memberName, object value)
- {
- return Clone<T>(info, (entry, clone) =>
- {
- if (entry.Name != memberName)
- {
- return true;
- }
-
- // Replace the entry
- clone.AddValue(entry.Name, value, value == null ? entry.ObjectType : value.GetType());
- return false;
- });
- }
-
- private static SerializationInfo CloneRemovingMember<T>(SerializationInfo info, string memberName)
- {
- return Clone<T>(info, (entry, clone) =>
- {
- // Add everything except the member we want to remove
- return entry.Name != memberName;
- });
- }
-
- private static SerializationInfo Clone<T>(SerializationInfo info, Func<SerializationEntry, SerializationInfo, bool> predicate)
- {
- var clone = GetEmptySerializationInfo<T>();
-
- foreach (var entry in info)
- {
- if (predicate(entry, clone))
- {
- clone.AddValue(entry.Name, entry.Value, entry.ObjectType);
- }
- }
-
- return clone;
- }
-
- private static SerializationInfo GetObjectDataFrom<T>(T serializableObject) where T : ISerializable
- {
- var info = GetEmptySerializationInfo<T>();
-
- serializableObject.GetObjectData(info, new StreamingContext());
-
- return info;
- }
-
- private static SerializationInfo GetEmptySerializationInfo<T>()
- {
- StrictFormatterConverter converter = new StrictFormatterConverter();
-
- return new SerializationInfo(typeof(T), converter);
- }
- }
-}
-
-#endif // !SILVERLIGHT
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Runtime/Serialization/StrictFormatterConverter.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Runtime/Serialization/StrictFormatterConverter.cs deleted file mode 100644 index 29e68d753b3..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/Runtime/Serialization/StrictFormatterConverter.cs +++ /dev/null @@ -1,106 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-#if !SILVERLIGHT
-
-using System;
-
-namespace System.Runtime.Serialization
-{
- /// <summary>
- /// Represents an <see cref="IFormatterConverter"/> where no conversion is actually performed.
- /// </summary>
- public class StrictFormatterConverter : IFormatterConverter
- {
- public object Convert(object value, TypeCode typeCode)
- {
- return value;
- }
-
- public object Convert(object value, Type type)
- {
- return value;
- }
-
- public bool ToBoolean(object value)
- {
- return (bool)value;
- }
-
- public byte ToByte(object value)
- {
- return (byte)value;
- }
-
- public char ToChar(object value)
- {
- return (char)value;
- }
-
- public DateTime ToDateTime(object value)
- {
- return (DateTime)value;
- }
-
- public decimal ToDecimal(object value)
- {
- return (decimal)value;
- }
-
- public double ToDouble(object value)
- {
- return (double)value;
- }
-
- public short ToInt16(object value)
- {
- return (short)value;
- }
-
- public int ToInt32(object value)
- {
- return (int)value;
- }
-
- public long ToInt64(object value)
- {
- return (long)value;
- }
-
- [CLSCompliant(false)]
- public sbyte ToSByte(object value)
- {
- return (sbyte)value;
- }
-
- public float ToSingle(object value)
- {
- return (float)value;
- }
-
- public string ToString(object value)
- {
- return (string)value;
- }
-
- [CLSCompliant(false)]
- public ushort ToUInt16(object value)
- {
- return (ushort)value;
- }
-
- [CLSCompliant(false)]
- public uint ToUInt32(object value)
- {
- return (uint)value;
- }
-
- [CLSCompliant(false)]
- public ulong ToUInt64(object value)
- {
- return (ulong)value;
- }
- }
-}
-
-#endif // !SILVERLIGHT
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/TypeExtensions.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/TypeExtensions.cs deleted file mode 100644 index 55d0fb1b22b..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/TypeExtensions.cs +++ /dev/null @@ -1,21 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Linq;
-using System.Reflection;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System
-{
- public static class TypeExtensions
- {
- public static MemberInfo GetSingleMember(this Type type, string name)
- {
- Assert.IsNotNull(type);
- Assert.IsNotNull(name);
-
- return type.GetMember(name).Single();
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/.gitattributes b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/.gitattributes deleted file mode 100644 index 7c48b21042d..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/.gitattributes +++ /dev/null @@ -1,10 +0,0 @@ -/EnumerableAssert.cs -crlf -/ExceptionAssert.cs -crlf -/ExpectationCollectionOfI.cs -crlf -/ExpectationCollectionOfIO.cs -crlf -/ExpectationOfI.cs -crlf -/ExpectationOfIO.cs -crlf -/ExtendedAssert.cs -crlf -/ReflectionAssert.cs -crlf -/RetryMode.cs -crlf -/TestServices.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/EnumerableAssert.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/EnumerableAssert.cs deleted file mode 100644 index 35331181341..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/EnumerableAssert.cs +++ /dev/null @@ -1,204 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Collections;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Microsoft.Internal.Collections;
-
-namespace System.UnitTesting
-{
- public static class EnumerableAssert
- {
- public static void IsTrueForAll<T>(IEnumerable<T> source, Predicate<T> predicate)
- {
- IsTrueForAll(source, predicate, "IsTrueForAll Failed");
- }
-
- public static void IsTrueForAll<T>(IEnumerable<T> source, Predicate<T> predicate, string message)
- {
- Assert.IsNotNull(source, "Source should not be null!");
-
- foreach (T t in source)
- {
- Assert.IsTrue(predicate(t), message);
- }
- }
-
- // Needed to prevent strings from matching to the plain IEnumerable overload
- public static void AreEqual(IEnumerable actual, params string[] expected)
- {
- AreEqual((IEnumerable)expected, (IEnumerable)actual);
- }
-
- public static void AreEqual(IEnumerable actual, params object[] expected)
- {
- AreEqual((IEnumerable)expected, (IEnumerable)actual);
- }
-
- public static void AreEqual<T>(IEnumerable<T> actual, params T[] expected)
- {
- AreEqual<T>((IEnumerable<T>)expected, (IEnumerable<T>)actual);
- }
-
- public static void AreEqual(IEnumerable expected, IEnumerable actual)
- {
- Assert.AreEqual(expected.Count(), actual.Count(), "Enumerable should contain the correct number of items");
-
- List<object> actualList = actual.ToList();
-
- foreach (object value in expected)
- {
- bool removed = actualList.Remove(value);
-
- Assert.IsTrue(removed, "Enumerable does not contain value {0}.", value);
- }
-
- Assert.AreEqual(0, actualList.Count, "Enumerable contains extra values.");
- }
-
- public static void AreEqual<T>(IEnumerable<T> expected, IEnumerable<T> actual)
- {
- // First, test the IEnumerable implementation
- AreEqual((IEnumerable)expected, (IEnumerable)actual);
-
- // Second, test the IEnumerable<T> implementation
- Assert.AreEqual(expected.Count(), actual.Count(), "Enumerable should contain the correct number of items");
-
- List<T> actualList = actual.ToList();
-
- foreach (T value in expected)
- {
- bool removed = actualList.Remove(value);
-
- Assert.IsTrue(removed, "Enumerable does not contain value {0}.", value);
- }
-
- Assert.AreEqual(0, actualList.Count, "Enumerable contains extra values.");
- }
-
- // Needed to prevent strings from matching to the plain IEnumerable overload
- public static void AreSequenceEqual(IEnumerable actual, params string[] expected)
- {
- AreEqual((IEnumerable)expected, (IEnumerable)actual);
- }
-
- public static void AreSequenceEqual(IEnumerable actual, params object[] expected)
- {
- AreEqual((IEnumerable)expected, (IEnumerable)actual);
- }
-
- public static void AreSequenceEqual(IEnumerable expected, IEnumerable actual)
- {
- AreSequenceEqual(expected, actual, (Action<int, object, object>)null);
- }
-
- public static void AreSequenceEqual(IEnumerable expected, IEnumerable actual, Action<int, object, object> comparer)
- {
- if (comparer == null)
- {
- comparer = (i, left, right) => Assert.AreEqual(left, right, "Enumerable at index {0} should have same value", i);
- }
-
- int expectedCount = expected.Count();
-
- Assert.AreEqual(expectedCount, actual.Count(), "Enumerable should contain the correct number of items");
-
- IEnumerator actualEnumerator = actual.GetEnumerator();
- IEnumerator expectedEnumerator = expected.GetEnumerator();
-
- int index = 0;
- while (index < expectedCount)
- {
- Assert.IsTrue(actualEnumerator.MoveNext());
- Assert.IsTrue(expectedEnumerator.MoveNext());
-
- comparer(index, expectedEnumerator.Current, actualEnumerator.Current);
- index++;
- }
- }
-
- public static void AreSequenceEqual<T>(IEnumerable<T> actual, params T[] expected)
- {
- AreSequenceEqual<T>((IEnumerable<T>)expected, (IEnumerable<T>)actual);
- }
-
- public static void AreSequenceEqual<T>(IEnumerable<T> expected, IEnumerable<T> actual)
- {
- AreSequenceEqual<T>(expected, actual, (Action<int, T, T>)null);
- }
-
- public static void AreSequenceEqual<T>(IEnumerable<T> expected, IEnumerable<T> actual, Action<int, T, T> comparer)
- {
- if (comparer == null)
- {
- comparer = (i, left, right) => Assert.AreEqual(left, right, "Enumerable at index {0} should have same value", i);
- }
-
- // First, test the IEnumerable implementation
- AreSequenceEqual((IEnumerable)expected, (IEnumerable)actual, (Action<int, object, object>)((currentIndex, left, right) => comparer(currentIndex, (T)left, (T)right)));
-
- // Second, test the IEnumerable<T> implementation
- int expectedCount = expected.Count();
-
- IEnumerator<T> actualEnumerator = actual.GetEnumerator();
- IEnumerator<T> expectedEnumerator = expected.GetEnumerator();
-
- int index = 0;
- while (index < expectedCount)
- {
- Assert.IsTrue(actualEnumerator.MoveNext());
- Assert.IsTrue(expectedEnumerator.MoveNext());
-
- comparer(index, expectedEnumerator.Current, actualEnumerator.Current);
- index++;
- }
- }
-
- public static void AreSequenceSame<T>(IEnumerable<T> expected, IEnumerable<T> actual)
- {
- AreSequenceEqual<T>(expected, actual, (index, left, right) =>
- {
- Assert.AreSame(left, right, "Enumerable at index {0} should have same value", index);
- });
- }
-
- public static void AreEqual<TKey, TValue>(IDictionary<TKey, TValue> expected, IDictionary<TKey, TValue> actual)
- {
- Assert.AreEqual(expected.Count, actual.Count, "Dictionaries are different : first has '{0} elements, whereas second has '{1}", expected.Count, actual.Count);
-
- foreach (KeyValuePair<TKey, TValue> kvp in expected)
- {
- TValue firstValue = kvp.Value;
- TValue secondValue = default(TValue);
- if (!actual.TryGetValue(kvp.Key, out secondValue))
- {
- Assert.Fail("Dictionaries are different : There is no item with key '{0}' in the second dictionary", kvp.Key);
- }
-
- if ((firstValue is IDictionary<TKey, TValue>) && (secondValue is IDictionary<TKey, TValue>))
- {
- AreEqual((IDictionary<TKey, TValue>)firstValue, (IDictionary<TKey, TValue>)secondValue);
- continue;
- }
-
- Assert.AreEqual(kvp.Value, secondValue, "Dictionaries are different : values for key '{0}' are different - '{1}' vs '{2}'", kvp.Key, firstValue, secondValue);
- }
- }
-
- /// <summary>
- /// Verifies that the specified enumerable is empty.
- /// </summary>
- public static void IsEmpty(IEnumerable source)
- {
- IsEmpty(source, null);
- }
-
- public static void IsEmpty(IEnumerable source, string message)
- {
- Assert.AreEqual(0, source.Count(), message);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/ExceptionAssert.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/ExceptionAssert.cs deleted file mode 100644 index c75dcc759ba..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/ExceptionAssert.cs +++ /dev/null @@ -1,326 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.Runtime.Serialization;
-
-namespace System.UnitTesting
-{
- public static class ExceptionAssert
- {
- // NOTE: To catch state corrupting exceptions, it by design that
- // the ThrowsXXX methods retry by default. To prevent this in a
- // test, simply use one of the overloads that takes a RetryMode.
-
- /// <summary>
- /// Verifies that the exception has the default message generated by the base Exception class.
- /// </summary>
- public static void HasDefaultMessage(Exception exception)
- {
- Assert.IsNotNull(exception);
-
- // Exception of type '[typename]' was thrown
- StringAssert.Contains(exception.Message, exception.GetType().FullName);
- }
-
- /// <summary>
- /// Verifies that the specified action throws a SerializationException.
- /// </summary>
- public static SerializationException ThrowsSerialization(string memberName, Action action)
- {
- var exception = Throws<SerializationException>(RetryMode.Retry, action, (actual, retryCount) =>
- {
- AssertSerializationMemberName(memberName, actual, retryCount);
- });
-
- return exception;
- }
-
- /// <summary>
- /// Verifies that the specified action throws an ObjectDisposedException.
- /// </summary>
- public static ObjectDisposedException ThrowsDisposed(object instance, Action action)
- {
- var exception = Throws<ObjectDisposedException>(RetryMode.Retry, action, (actual, retryCount) =>
- {
- AssertObjectDisposed(instance, actual, retryCount);
- });
-
- return exception;
- }
-
- /// <summary>
- /// Verifies that the specified action throws an ArgumentNullException.
- /// </summary>
- public static ArgumentNullException ThrowsArgumentNull(string parameterName, Action action)
- {
- return ThrowsArgument<ArgumentNullException>(parameterName, action);
- }
-
- /// <summary>
- /// Verifies that the specified action throws an ArgumentException.
- /// </summary>
- public static ArgumentException ThrowsArgument(string parameterName, Action action)
- {
- return ThrowsArgument<ArgumentException>(parameterName, action);
- }
-
- /// <summary>
- /// Verifies that the specified action throws an ArgumentException of type <typeparam name="T"/>.
- /// </summary>
- public static T ThrowsArgument<T>(string parameterName, Action action)
- where T : ArgumentException
- {
- var exception = Throws<T>(RetryMode.Retry, action, (actual, retryCount) =>
- {
- AssertSameParameterName(parameterName, actual, retryCount);
- });
-
- return exception;
- }
-
- /// <summary>
- /// Verifies that the specified action throws an exception of type <typeparam name="T"/>,
- /// with the specified inner exception of type <typeparam name="TInner"/>.
- /// </summary>
- public static T Throws<T, TInner>(Action action)
- where T : Exception
- where TInner : Exception
- {
- return Throws<T, TInner>(RetryMode.Retry, action);
- }
-
- /// <summary>
- /// Verifies that the specified action throws an exception of type <typeparam name="T"/>,
- /// with the specified inner exception of type <typeparam name="TInner"/>, and indicating
- /// whether to retry.
- /// </summary>
- public static T Throws<T, TInner>(RetryMode retry, Action action)
- where T : Exception
- where TInner : Exception
- {
- return Throws<T, TInner>(retry, action, (Action<T, int>)null);
- }
-
- /// <summary>
- /// Verifies that the specified action throws an exception of type <typeparam name="T"/>,
- /// with the specified inner exception of type <typeparam name="TInner"/>, indicating
- /// whether to retry and running the specified validator.
- /// </summary>
- public static T Throws<T, TInner>(RetryMode retry, Action action, Action<T, int> validator)
- where T : Exception
- where TInner : Exception
- {
- var exception = Throws<T>(retry, action, (actual, retryCount) =>
- {
- AssertIsExactInstanceOfInner(typeof(TInner), actual, retryCount);
-
- if (validator != null)
- {
- validator(actual, retryCount);
- }
- });
-
- return exception;
- }
-
- /// <summary>
- /// Verifies that the specified action throws an exception of type <typeparam name="T"/>,
- /// with the specified inner exception.
- /// </summary>
- public static T Throws<T>(Exception innerException, Action action)
- where T : Exception
- {
- return Throws<T>(innerException, RetryMode.Retry, action, (Action<T, int>)null);
- }
-
- /// <summary>
- /// Verifies that the specified action throws an exception of type <typeparam name="T"/>,
- /// with the specified inner exception, and indicating whether to retry.
- /// </summary>
- public static T Throws<T>(Exception innerException, RetryMode retry, Action action)
- where T : Exception
- {
- return Throws<T>(innerException, RetryMode.Retry, action, (Action<T, int>)null);
- }
-
- /// <summary>
- /// Verifies that the specified action throws an exception of type <typeparam name="T"/>,
- /// with the specified inner exception, indicating whether to retry and running the
- /// specified validator.
- /// </summary>
- public static T Throws<T>(Exception innerException, RetryMode retry, Action action, Action<T, int> validator)
- where T : Exception
- {
- T exception = Throws<T>(retry, action, (actual, retryCount) =>
- {
- AssertSameInner(innerException, actual, retryCount);
-
- if (validator != null)
- {
- validator(actual, retryCount);
- }
- });
-
- return exception;
- }
-
- /// <summary>
- /// Verifies that the specified action throws an exception of type <typeparam name="T"/>.
- /// </summary>
- public static T Throws<T>(Action action)
- where T : Exception
- {
- return Throws<T>(RetryMode.Retry, action, (Action<T, int>)null);
- }
-
- /// <summary>
- /// Verifies that the specified action throws an exception of type <typeparam name="T"/>,
- /// indicating whether to retry.
- /// </summary>
- public static T Throws<T>(RetryMode retry, Action action)
- where T : Exception
- {
- return Throws<T>(retry, action, (Action<T, int>)null);
- }
-
- /// <summary>
- /// Verifies that the specified action throws an exception of type <typeparam name="T"/>,
- /// indicating whether to retry and running the specified validator.
- /// </summary>
- public static T Throws<T>(RetryMode retry, Action action, Action<T, int> validator)
- where T : Exception
- {
- var exception = (T)Run(retry, action, (actual, retryCount) =>
- {
- AssertIsExactInstanceOf(typeof(T), actual, retryCount);
-
- if (validator != null)
- {
- validator((T)actual, retryCount);
- }
- });
-
- return exception;
- }
-
- /// <summary>
- /// Verifies that the specified action throws the specified exception.
- /// </summary>
- public static void Throws(Exception expected, Action action)
- {
- Throws(expected, RetryMode.Retry, action);
- }
-
- /// <summary>
- /// Verifies that the specified action throws the specified exception,
- /// indicating whether to retry.
- /// </summary>
- public static void Throws(Exception expected, RetryMode retry, Action action)
- {
- Throws(expected, retry, action, (Action<Exception, int>)null);
- }
-
- /// <summary>
- /// Verifies that the specified action throws the specified exception,
- /// indicating whether to retry and running the specified validator.
- /// </summary>
- public static void Throws(Exception expected, RetryMode retry, Action action, Action<Exception, int> validator)
- {
- Run(retry, action, (actual, retryCount) =>
- {
- AssertSame(expected, actual, retryCount);
-
- if (validator != null)
- {
- validator(actual, retryCount);
- }
- });
- }
-
- private static Exception Run(RetryMode retry, Action action, Action<Exception, int> validator)
- {
- Exception exception = null;
-
- for (int i = -1; i < (int)retry; i++)
- {
- exception = Run(action);
-
- validator(exception, i + 2);
- }
-
- return exception;
- }
-
- private static Exception Run(Action action)
- {
- try
- {
- action();
- return null;
- }
- catch (Exception ex)
- {
- return ex;
- }
- }
-
- private static void AssertSerializationMemberName(string memberName, SerializationException actual, int retryCount)
- {
- // Unfortunately, SerializationException does not provide a way to get our hands on the
- // the actual member that was missing from the SerializationInfo, so we need to grok the
- // message string.
-
- // Member '[memberName]' was not found.
- StringAssert.Contains(actual.Message, "'" + memberName + "'", "Retry Count {0}: Expected SerializationException MemberName to be '{1}'", retryCount, memberName);
- }
-
- private static void AssertObjectDisposed(object instance, ObjectDisposedException actual, int retryCount)
- {
- string objectName = instance.GetType().FullName;
-
- Assert.AreEqual(objectName, actual.ObjectName, "Retry Count {0}: Expected {1}.ObjectName to be '{2}', however, '{3}' is.", retryCount, actual.GetType().Name, objectName, actual.ObjectName);
- }
-
- private static void AssertSameParameterName(string parameterName, ArgumentException actual, int retryCount)
- {
-#if !SILVERLIGHT
- Assert.AreEqual(parameterName, actual.ParamName, "Retry Count {0}: Expected {1}.ParamName to be '{2}', however, '{3}' is.", retryCount, actual.GetType().Name, parameterName, actual.ParamName);
-#else
- // Silverlight doesn't have ArgumentException.ParamName
- StringAssert.Contains(actual.Message, parameterName, "Retry Count {0}: Expected {1}.ParamName to be '{2}'", retryCount, actual.GetType().Name, parameterName);
-#endif
- }
-
- private static void AssertSame(Exception expected, Exception actual, int retryCount)
- {
- Assert.AreSame(expected, actual, "Retry Count {0}: Expected '{1}' to be thrown, however, '{2}' was thrown.", retryCount, expected, actual);
- }
-
- private static void AssertSameInner(Exception innerException, Exception actual, int retryCount)
- {
- Assert.AreSame(innerException, actual.InnerException, "Retry Count {0}: Expected '{1}' to be the inner exception, however, '{2}' is.", retryCount, innerException, actual.InnerException);
- }
-
- private static void AssertIsExactInstanceOf(Type expectedType, Exception actual, int retryCount)
- {
- if (actual == null)
- Assert.Fail("Retry Count {0}: Expected '{1}' to be thrown", retryCount, expectedType);
-
- Type actualType = actual.GetType();
-
- Assert.AreSame(expectedType, actualType, "Retry Count {0}: Expected '{1}' to be thrown, however, '{2}' was thrown.", retryCount, expectedType, actualType);
- }
-
- private static void AssertIsExactInstanceOfInner(Type expectedType, Exception actual, int retryCount)
- {
- if (actual.InnerException == null)
- Assert.Fail("Retry Count {0}: Expected '{1}' be the inner exception, however, it is null.", retryCount, expectedType);
-
- Type actualType = actual.InnerException.GetType();
-
- Assert.AreSame(expectedType, actualType, "Retry Count {0}: Expected '{1}' to be the inner exception, however, '{2}' is.", retryCount, expectedType, actualType);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/ExpectationCollectionOfI.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/ExpectationCollectionOfI.cs deleted file mode 100644 index 718c898193d..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/ExpectationCollectionOfI.cs +++ /dev/null @@ -1,30 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.ObjectModel;
-using System.Collections.Generic;
-
-namespace System.UnitTesting
-{
- public class ExpectationCollection<TInputAndOutput> : Collection<Expectation<TInputAndOutput>>
- {
- public void Add(TInputAndOutput inputAndOutput)
- {
- Add(inputAndOutput, inputAndOutput);
- }
-
- public void AddRange(IEnumerable<TInputAndOutput> inputAndOutputs)
- {
- foreach (TInputAndOutput inputAndOutput in inputAndOutputs)
- {
- Add(inputAndOutput);
- }
- }
-
- public void Add(TInputAndOutput input, TInputAndOutput output)
- {
- Add(new Expectation<TInputAndOutput>(input, output));
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/ExpectationCollectionOfIO.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/ExpectationCollectionOfIO.cs deleted file mode 100644 index f323eb5242d..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/ExpectationCollectionOfIO.cs +++ /dev/null @@ -1,16 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.ObjectModel;
-
-namespace System.UnitTesting
-{
- public class ExpectationCollection<TInput, TOutput> : Collection<Expectation<TInput, TOutput>>
- {
- public void Add(TInput input, TOutput output)
- {
- Add(new Expectation<TInput, TOutput>(input, output));
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/ExpectationOfI.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/ExpectationOfI.cs deleted file mode 100644 index 7670f8cf6f2..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/ExpectationOfI.cs +++ /dev/null @@ -1,16 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-
-namespace System.UnitTesting
-{
- public class Expectation<TInputAndOutput> : Expectation<TInputAndOutput, TInputAndOutput>
- {
- public Expectation(TInputAndOutput input, TInputAndOutput output)
- : base(input, output)
- {
- }
- }
-
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/ExpectationOfIO.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/ExpectationOfIO.cs deleted file mode 100644 index 00e1b7bc999..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/ExpectationOfIO.cs +++ /dev/null @@ -1,28 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-
-namespace System.UnitTesting
-{
- public class Expectation<TInput, TOutput>
- {
- public Expectation(TInput input, TOutput output)
- {
- Input = input;
- Output = output;
- }
-
- public TInput Input
- {
- get;
- private set;
- }
-
- public TOutput Output
- {
- get;
- private set;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/ExtendedAssert.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/ExtendedAssert.cs deleted file mode 100644 index 97b605c88da..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/ExtendedAssert.cs +++ /dev/null @@ -1,70 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.IO;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.UnitTesting
-{
- public static class ExtendedAssert
- {
- /// <summary>
- /// Verifies that the two specified objects are an instance of the same type.
- /// </summary>
- public static void IsInstanceOfSameType(object expected, object actual)
- {
- if (expected == null || actual == null)
- {
- Assert.AreSame(expected, actual);
- return;
- }
-
- Assert.AreSame(expected.GetType(), actual.GetType());
- }
-
- public static void ContainsLines(string value, params string[] lines)
- {
- StringReader reader = new StringReader(value);
-
- int count = 0;
- string line;
- while ((line = reader.ReadLine()) != null)
- {
- if (count == lines.Length)
- {
- Assert.Fail();
- }
-
- StringAssert.Contains(line, lines[count]);
-
- count++;
- }
-
- Assert.AreEqual(lines.Length, count, "Expectation: {0}; Result: {1}", String.Join(Environment.NewLine, lines), value);
- }
-
- public static void EnumsContainSameValues<TEnum1, TEnum2>()
- where TEnum1 : struct
- where TEnum2 : struct
- {
- EnumsContainSameValuesCore<TEnum1, TEnum2>();
- EnumsContainSameValuesCore<TEnum2, TEnum1>();
- }
-
- private static void EnumsContainSameValuesCore<TEnum1, TEnum2>()
- where TEnum1 : struct
- where TEnum2 : struct
- {
- var values = TestServices.GetEnumValues<TEnum1>();
-
- foreach (TEnum1 value in values)
- {
- string name1 = Enum.GetName(typeof(TEnum1), value);
- string name2 = Enum.GetName(typeof(TEnum2), value);
-
- Assert.AreEqual(name1, name2, "{0} contains a value that {1} does not have. These enums need to be in sync.", typeof(TEnum1), typeof(TEnum2));
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/ReflectionAssert.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/ReflectionAssert.cs deleted file mode 100644 index bc0fca3b83e..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/ReflectionAssert.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.Reflection;
-
-namespace System.UnitTesting
-{
- // Unfortunately, you can't rely on reference equality for MemberInfo and ParameterInfo
- // objects because, you may get different instances representing the same members depending
- // on the type that the member was retrieived from.
-
- public static class ReflectionAssert
- {
- public static void AreSame(MemberInfo expected, MemberInfo actual)
- {
- if (expected == null && actual == null)
- {
- return;
- }
-
- Assert.AreEqual(expected.MetadataToken, actual.MetadataToken);
- Assert.AreSame(expected.Module, actual.Module);
- Assert.AreEqual(expected.MemberType, actual.MemberType);
- }
-
- public static void AreSame(ParameterInfo expected, ParameterInfo actual)
- {
- if (expected == null && actual == null)
- {
- return;
- }
-
- ReflectionAssert.AreSame(expected.Member, actual.Member);
- Assert.AreEqual(expected.MetadataToken, actual.MetadataToken);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/RetryMode.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/RetryMode.cs deleted file mode 100644 index bdda321a7c9..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/RetryMode.cs +++ /dev/null @@ -1,14 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace System.UnitTesting
-{
- public enum RetryMode : int
- {
- DoNotRetry = 0,
- Retry = 1,
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/TestServices.cs b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/TestServices.cs deleted file mode 100644 index 87032d796ad..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/System/UnitTesting/TestServices.cs +++ /dev/null @@ -1,30 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Reflection;
-using System.Collections.Generic;
-
-namespace System.UnitTesting
-{
- public static class TestServices
- {
- public static string GenerateRandomString()
- {
- return Guid.NewGuid().ToString().Replace('-', '_');
- }
-
- public static IEnumerable<TEnum> GetEnumValues<TEnum>() where TEnum : struct
- { // Silverlight 2.0 does not have Enum.GetValues()
- // so we need to write our own
-
- foreach (FieldInfo field in typeof(TEnum).GetFields())
- {
- if (!field.IsLiteral)
- continue;
-
- yield return (TEnum)field.GetRawConstantValue();
- }
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/UnitTestFramework.csproj b/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/UnitTestFramework.csproj deleted file mode 100644 index 3bde43f2533..00000000000 --- a/mcs/class/System.ComponentModel.Composition/Tests/UnitTestFramework/UnitTestFramework.csproj +++ /dev/null @@ -1,115 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
- <CodeAnalysisRuleSet>Migrated rules for UnitTestFramework.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules />
- </PropertyGroup>
- <PropertyGroup>
- <OutputPath>..\..\bin</OutputPath>
- <DefineConstants>$(DefineConstants);TRACE</DefineConstants>
- <NoWarn>1570;1572;1573;1591;1699</NoWarn>
- </PropertyGroup>
- <PropertyGroup>
- <ProductVersion>9.0.30729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{35FBE8A0-D87E-4991-B3FC-2A77807DEC85}</ProjectGuid>
- <ProjectClrTypes>FULLCLR;SILVERLIGHT</ProjectClrTypes>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>
- </RootNamespace>
- <AssemblyName>System.ComponentModel.Composition.UnitTestFramework</AssemblyName>
- <FileAlignment>512</FileAlignment>
- <NoWarn>;1699;1570;1572;1573;1591;0414</NoWarn>
- <PublishUrl>publish\</PublishUrl>
- <Install>true</Install>
- <InstallFrom>Disk</InstallFrom>
- <UpdateEnabled>false</UpdateEnabled>
- <UpdateMode>Foreground</UpdateMode>
- <UpdateInterval>7</UpdateInterval>
- <UpdateIntervalUnits>Days</UpdateIntervalUnits>
- <UpdatePeriodically>false</UpdatePeriodically>
- <UpdateRequired>false</UpdateRequired>
- <MapFileExtensions>true</MapFileExtensions>
- <ApplicationRevision>0</ApplicationRevision>
- <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
- <IsWebBootstrapper>false</IsWebBootstrapper>
- <UseApplicationTrust>false</UseApplicationTrust>
- <BootstrapperEnabled>true</BootstrapperEnabled>
- </PropertyGroup>
- <PropertyGroup>
- <SignAssembly>true</SignAssembly>
- <NoStdLib>true</NoStdLib>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="mscorlib" />
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Xml" />
- <ProjectReference Include="..\..\src\ComponentModel\ComponentModel.csproj">
- <Project>{1BBA5101-D4F0-48B8-A5D6-7B23A099DCE3}</Project>
- <Name>ComponentModel</Name>
- </ProjectReference>
- <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
- </ItemGroup>
- <ItemGroup Condition=" '$(IsSilverlight)' == 'true' ">
- <ProjectReference Include="$(CMInitProjectPath)\Composition.Initialization.csproj">
- <Project>{A497DC28-0A3B-4BAD-B964-B8B436686D98}</Project>
- <Name>Composition.Initialization</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="AssemblyInfo.cs" />
- <Compile Include="System\Collections\EnumerableExtensions.cs" />
- <Compile Include="System\Collections\Generic\DictionaryExtensions.cs" />
- <Compile Include="System\ComponentModel\Composition\ConstraintParser.cs" />
- <Compile Include="System\ComponentModel\Composition\Diagnostics\TraceId.cs" />
- <Compile Include="System\ComponentModel\Composition\Diagnostics\TraceContext.cs" />
- <Compile Include="System\ComponentModel\Composition\Diagnostics\TraceContext.TraceContextTraceListener.cs" />
- <Compile Include="System\ComponentModel\Composition\Diagnostics\TraceEventDetails.cs" />
- <Compile Include="System\ComponentModel\Composition\UnitTesting\CompositionAssert.cs" />
- <Compile Include="System\ComponentModel\Composition\UnitTesting\ErrorId.cs" />
- <Compile Include="System\ComponentModel\Composition\UnitTesting\ElementAssert.cs" />
- <Compile Include="System\ComponentModel\Composition\UnitTesting\ExportsAssert.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CompositionHostTestService.cs" />
- <Compile Include="System\IO\TemporaryFileCopier.cs" />
- <Compile Include="System\IO\TemporaryFile.cs" />
- <Compile Include="System\ReferenceTracker.cs" />
- <Compile Include="System\Globalization\CurrentCultureContext.cs" />
- <Compile Include="System\IO\FileIO.cs" />
- <Compile Include="System\IO\TemporaryDirectory.cs" />
- <Compile Include="System\DisposableObject.cs" />
- <Compile Include="System\Runtime\Serialization\StrictFormatterConverter.cs" />
- <Compile Include="System\Runtime\Serialization\SerializationTestServices.cs" />
- <Compile Include="System\TypeExtensions.cs" />
- <Compile Include="System\UnitTesting\ExtendedAssert.cs" />
- <Compile Include="System\UnitTesting\RetryMode.cs" />
- <Compile Include="System\UnitTesting\ExpectationCollectionOfIO.cs" />
- <Compile Include="System\UnitTesting\ExpectationCollectionOfI.cs" />
- <Compile Include="System\UnitTesting\ExpectationOfIO.cs" />
- <Compile Include="System\UnitTesting\ExpectationOfI.cs" />
- <Compile Include="System\UnitTesting\TestServices.cs" />
- <Compile Include="System\UnitTesting\ReflectionAssert.cs" />
- <Compile Include="System\UnitTesting\EnumerableAssert.cs" />
- <Compile Include="System\UnitTesting\ExceptionAssert.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionModelServicesEx.cs" />
- </ItemGroup>
- <ItemGroup>
- <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
- <Install>false</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
- <Visible>False</Visible>
- <ProductName>Windows Installer 3.1</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
-</Project>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/.gitattributes b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/.gitattributes deleted file mode 100644 index 5bebade7c71..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/.gitattributes +++ /dev/null @@ -1,6 +0,0 @@ -/AssemblyInfo.cs -crlf -/SilverlightAdditions.cs -crlf -/Strings.Designer.cs -crlf -/Strings.resx -crlf -/SuppressMessages.cs -crlf -/SuppressMessagesBaselined.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/AssemblyInfo.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/AssemblyInfo.cs deleted file mode 100644 index e77ac0d8553..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/AssemblyInfo.cs +++ /dev/null @@ -1,12 +0,0 @@ -//------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//------------------------------------------------------------
-
-[assembly: System.CLSCompliant(true)]
-[assembly: System.Reflection.AssemblyTitle("System.ComponentModel.Composition")]
-[assembly: System.Reflection.AssemblyCopyright("(c) Microsoft Corporation. All rights reserved.")]
-[assembly: System.Reflection.AssemblyVersion(Consts.FxVersion)]
-[assembly: System.Reflection.AssemblyKeyFile ("../ecma.pub")]
-[assembly: System.Reflection.AssemblyDelaySign (true)]
-//[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.ComponentModel.Composition.UnitTests")]
-//[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.ComponentModel.Composition.UnitTestFramework")]
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/ComponentModel - SL.csproj b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/ComponentModel - SL.csproj deleted file mode 100644 index 819645d6347..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/ComponentModel - SL.csproj +++ /dev/null @@ -1,211 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.30729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{A36AEF66-2411-4225-B68E-F2D29368A31B}</ProjectGuid>
- <ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Microsoft.Internal</RootNamespace>
- <AssemblyName>System.ComponentModel.Composition</AssemblyName>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>..\..\bin\SL</OutputPath>
- <DefineConstants>DEBUG;TRACE;SILVERLIGHT</DefineConstants>
- <NoStdLib>true</NoStdLib>
- <NoConfig>true</NoConfig>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <NoWarn>1570;1572;1573;1591;1699</NoWarn>
- <DocumentationFile>..\..\bin\SL\System.ComponentModel.Composition.xml</DocumentationFile>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="mscorlib" />
- <Reference Include="system" />
- <Reference Include="System.Core" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="AssemblyInfo.cs" />
- <Compile Include="Microsoft\Internal\Assumes.cs" />
- <Compile Include="Microsoft\Internal\Assumes.InternalErrorException.cs" />
- <Compile Include="Microsoft\Internal\AttributeServices.cs" />
- <Compile Include="Microsoft\Internal\Collections\CollectionServices.CollectionOfObject.cs" />
- <Compile Include="Microsoft\Internal\Collections\CollectionServices.cs" />
- <Compile Include="Microsoft\Internal\Collections\ConditionalWeakTable.cs" />
- <Compile Include="Microsoft\Internal\Collections\EnumerableCardinality.cs" />
- <Compile Include="Microsoft\Internal\Collections\ReadOnlyDictionary.cs" />
- <Compile Include="Microsoft\Internal\Collections\ReadOnlyDictionaryDebuggerProxy.cs" />
- <Compile Include="Microsoft\Internal\Collections\WeakReferenceCollection.cs" />
- <Compile Include="Microsoft\Internal\ContractServices.cs" />
- <Compile Include="Microsoft\Internal\GenerationServices.cs" />
- <Compile Include="Microsoft\Internal\LazyServices.cs" />
- <Compile Include="Microsoft\Internal\Lock.cs" />
- <Compile Include="Microsoft\Internal\Lock.Reader.cs" />
- <Compile Include="Microsoft\Internal\Lock.Writer.cs" />
- <Compile Include="Microsoft\Internal\ReflectionServices.cs" />
- <Compile Include="Microsoft\Internal\Requires.cs" />
- <Compile Include="Microsoft\Internal\Runtime\Serialization\SerializationServices.cs" />
- <Compile Include="Microsoft\Internal\StringComparers.cs" />
- <Compile Include="SilverlightAdditions.cs" />
- <Compile Include="System\ComponentModel\Composition\AttributedModelServices.cs" />
- <Compile Include="System\ComponentModel\Composition\AttributedModel\AttributedExportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\AttributedModel\AttributedModelDiscovery.cs" />
- <Compile Include="System\ComponentModel\Composition\AttributedModel\AttributedPartCreationInfo.cs" />
- <Compile Include="System\ComponentModel\Composition\ChangeRejectedException.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionContractMismatchException.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionError.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionErrorDebuggerProxy.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionErrorId.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionException.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionResult.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionResultOfT.cs" />
- <Compile Include="System\ComponentModel\Composition\ConstraintServices.cs" />
- <Compile Include="System\ComponentModel\Composition\ContractNameServices.cs" />
- <Compile Include="System\ComponentModel\Composition\CreationPolicy.cs" />
- <Compile Include="System\ComponentModel\Composition\Diagnostics\CompositionTrace.cs" />
- <Compile Include="System\ComponentModel\Composition\Diagnostics\CompositionTraceId.cs" />
- <Compile Include="System\ComponentModel\Composition\Diagnostics\CompositionTraceSource.cs" />
- <Compile Include="System\ComponentModel\Composition\Diagnostics\SilverlightTraceWriter.cs" />
- <Compile Include="System\ComponentModel\Composition\Diagnostics\TraceSourceTraceWriter.cs" />
- <Compile Include="System\ComponentModel\Composition\Diagnostics\TraceWriter.cs" />
- <Compile Include="System\ComponentModel\Composition\ErrorBuilder.cs" />
- <Compile Include="System\ComponentModel\Composition\ExceptionBuilder.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportCardinalityCheckResult.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportMetadataAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportServices.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportServices.DisposableLazy.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\AggregateCatalog.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\AggregateExportProvider.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\AssemblyCatalog.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\AssemblyCatalogDebuggerProxy.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\AtomicComposition.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\AtomicCompositionExtensions.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CatalogExportProvider.CatalogChangeProxy.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CatalogExportProvider.CatalogExport.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CatalogExportProvider.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CatalogExportProvider.PartCreatorExport.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ComposablePartCatalogChangeEventArgs.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ComposablePartCatalogCollection.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ComposablePartExportProvider.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CompositionBatch.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CompositionBatch.SingleExportComposablePart.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CompositionConstants.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CompositionContainer.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CompositionLock.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CompositionServices.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\DirectoryCatalog.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\DirectoryCatalog.DirectoryCatalogDebuggerProxy.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ExportProvider.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ExportProvider.GetExportOverrides.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ExportsChangeEventArgs.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ImportEngine.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ImportEngine.EngineContext.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ImportEngine.PartManager.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ImportEngine.RecompositionManager.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\INotifyComposablePartCatalogChanged.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\TypeCatalog.cs" />
- <Compile Include="System\ComponentModel\Composition\IAttributedImport.cs" />
- <Compile Include="System\ComponentModel\Composition\ICompositionError.cs" />
- <Compile Include="System\ComponentModel\Composition\ICompositionService.cs" />
- <Compile Include="System\ComponentModel\Composition\ImportAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\ImportCardinalityMismatchException.cs" />
- <Compile Include="System\ComponentModel\Composition\ImportingConstructorAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\ImportManyAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\InheritedExportAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\IPartImportsSatisfiedNotification.cs" />
- <Compile Include="System\ComponentModel\Composition\MetadataAttributeAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\MetadataServices.cs" />
- <Compile Include="System\ComponentModel\Composition\MetadataViewGenerator.cs" />
- <Compile Include="System\ComponentModel\Composition\MetadataViewProvider.cs" />
- <Compile Include="System\ComponentModel\Composition\PartCreationPolicyAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\PartCreatorOfT.cs" />
- <Compile Include="System\ComponentModel\Composition\PartCreatorOfTTMetadata.cs" />
- <Compile Include="System\ComponentModel\Composition\PartLifetimeContextOfT.cs" />
- <Compile Include="System\ComponentModel\Composition\PartMetadataAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\PartNotDiscoverableAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePart.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePartCatalog.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePartCatalogDebuggerProxy.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePartDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePartException.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\CompositionElement.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\CompositionElementDebuggerProxy.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\CompositionElementExtensions.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ContractBasedImportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\Export.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ExportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ExportedDelegate.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ICompositionElement.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ImportCardinality.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ImportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\IPartCreatorImportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\SerializableCompositionElement.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\DisposableReflectionComposablePart.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ExportingMember.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ImportingItem.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ImportingMember.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ImportingParameter.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ImportType.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\IReflectionPartCreationInfo.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\LazyMemberInfo.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\PartCreatorExportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\PartCreatorMemberImportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\PartCreatorParameterImportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionComposablePart.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionComposablePartDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionExtensions.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionField.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionImportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionItem.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionItemType.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionMember.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionMemberExportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionMemberImportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionMethod.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionModelServices.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionParameter.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionParameterImportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionProperty.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionType.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionWritableMember.cs" />
- <Compile Include="System\Lazy.cs" />
- <Compile Include="System\LazyOfTTMetadata.cs" />
- <Compile Include="System\Tuple.cs" />
- <Compile Include="Strings.Designer.cs">
- <AutoGen>True</AutoGen>
- <DesignTime>True</DesignTime>
- <DependentUpon>Strings.resx</DependentUpon>
- </Compile>
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Strings.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>Strings.Designer.cs</LastGenOutput>
- <CustomToolNamespace>Microsoft.Internal</CustomToolNamespace>
- </EmbeddedResource>
- </ItemGroup>
- <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\v3.0\Microsoft.Silverlight.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
- <ProjectExtensions>
- <VisualStudio>
- <FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
- <SilverlightProjectProperties />
- </FlavorProperties>
- </VisualStudio>
- </ProjectExtensions>
-</Project>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/ComponentModel.csproj b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/ComponentModel.csproj deleted file mode 100644 index 75c4836b09d..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/ComponentModel.csproj +++ /dev/null @@ -1,237 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
- <CodeAnalysisRuleSet>Migrated rules for ComponentModel.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules />
- </PropertyGroup>
- <PropertyGroup>
- <OutputPath>..\..\bin</OutputPath>
- <DefineConstants>$(DefineConstants);TRACE</DefineConstants>
- <NoWarn>1570;1572;1573;1591;1699</NoWarn>
- </PropertyGroup>
- <PropertyGroup>
- <ProductVersion>10.0.20729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{1BBA5101-D4F0-48B8-A5D6-7B23A099DCE3}</ProjectGuid>
- <ProjectClrTypes>FULLCLR;SILVERLIGHT</ProjectClrTypes>
- <OutputType>Library</OutputType>
- <RootNamespace>Microsoft.Internal</RootNamespace>
- <AssemblyName>System.ComponentModel.Composition</AssemblyName>
- <DocumentationFile>$(OutputPath)\System.ComponentModel.Composition.xml</DocumentationFile>
- <PublishUrl>publish\</PublishUrl>
- <Install>true</Install>
- <InstallFrom>Disk</InstallFrom>
- <UpdateEnabled>false</UpdateEnabled>
- <UpdateMode>Foreground</UpdateMode>
- <UpdateInterval>7</UpdateInterval>
- <UpdateIntervalUnits>Days</UpdateIntervalUnits>
- <UpdatePeriodically>false</UpdatePeriodically>
- <UpdateRequired>false</UpdateRequired>
- <MapFileExtensions>true</MapFileExtensions>
- <ApplicationRevision>0</ApplicationRevision>
- <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
- <IsWebBootstrapper>false</IsWebBootstrapper>
- <UseApplicationTrust>false</UseApplicationTrust>
- <BootstrapperEnabled>true</BootstrapperEnabled>
- </PropertyGroup>
- <PropertyGroup>
- <SignAssembly>true</SignAssembly>
- <NoStdLib>true</NoStdLib>
- </PropertyGroup>
- <PropertyGroup Condition="'$(USE_CUSTOM_KEY)' != 'true'">
- <CreateMetaAssembly>true</CreateMetaAssembly>
- <CreateRefAssembly>true</CreateRefAssembly>
- <PublishMetaAssemblyToSDK>true</PublishMetaAssemblyToSDK>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="mscorlib" />
- <Reference Include="System" />
- <Reference Include="System.Core" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="AssemblyInfo.cs" />
- <Compile Include="Microsoft\Internal\Assumes.cs" />
- <Compile Include="Microsoft\Internal\AttributeServices.cs" />
- <Compile Include="Microsoft\Internal\Collections\CollectionServices.cs" />
- <Compile Include="Microsoft\Internal\Collections\ConditionalWeakTable.cs" />
- <Compile Include="Microsoft\Internal\Collections\CollectionServices.CollectionOfObject.cs" />
- <Compile Include="Microsoft\Internal\Collections\EnumerableCardinality.cs" />
- <Compile Include="Microsoft\Internal\Collections\ReadOnlyDictionary.cs" />
- <Compile Include="Microsoft\Internal\Collections\ReadOnlyDictionaryDebuggerProxy.cs" />
- <Compile Include="Microsoft\Internal\Collections\WeakReferenceCollection.cs" />
- <Compile Include="Microsoft\Internal\ContractServices.cs" />
- <Compile Include="Microsoft\Internal\Assumes.InternalErrorException.cs" />
- <Compile Include="Microsoft\Internal\SilverlightReflectionInvoke.cs" />
- <Compile Include="Microsoft\Internal\GenerationServices.cs" />
- <Compile Include="Microsoft\Internal\LazyServices.cs" />
- <Compile Include="Microsoft\Internal\Lock.cs" />
- <Compile Include="Microsoft\Internal\Lock.Reader.cs" />
- <Compile Include="Microsoft\Internal\Lock.Writer.cs" />
- <Compile Include="Microsoft\Internal\Requires.cs" />
- <Compile Include="Microsoft\Internal\Runtime\Serialization\SerializationServices.cs" />
- <Compile Include="Microsoft\Internal\StringComparers.cs" />
- <Compile Include="Microsoft\Internal\ReflectionServices.cs" />
- <Compile Include="Strings.Designer.cs">
- <AutoGen>True</AutoGen>
- <DesignTime>True</DesignTime>
- <DependentUpon>Strings.resx</DependentUpon>
- <CustomToolNamespace>Microsoft.Internal</CustomToolNamespace>
- </Compile>
- <Compile Include="SuppressMessages.cs" />
- <Compile Include="SuppressMessagesBaselined.cs" />
- <Compile Include="System\ComponentModel\Composition\AttributedModelServices.cs" />
- <Compile Include="System\ComponentModel\Composition\AttributedModel\AttributedModelDiscovery.cs" />
- <Compile Include="System\ComponentModel\Composition\AttributedModel\AttributedPartCreationInfo.cs" />
- <Compile Include="System\ComponentModel\Composition\AttributedModel\AttributedExportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\Diagnostics\CompositionTrace.cs" />
- <Compile Include="System\ComponentModel\Composition\Diagnostics\CompositionTraceId.cs" />
- <Compile Include="System\ComponentModel\Composition\ConstraintServices.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionContractMismatchException.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionError.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionResultOfT.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CatalogExportProvider.PartCreatorExport.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CompositionLock.cs" />
- <Compile Include="System\ComponentModel\Composition\Diagnostics\CompositionTraceSource.cs" />
- <Compile Include="System\ComponentModel\Composition\Diagnostics\TraceWriter.cs" />
- <Compile Include="System\ComponentModel\Composition\Diagnostics\TraceSourceTraceWriter.cs" />
- <Compile Include="System\ComponentModel\Composition\Diagnostics\SilverlightTraceWriter.cs" />
- <Compile Include="System\ComponentModel\Composition\InheritedExportAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportServices.DisposableLazy.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\AtomicComposition.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\AtomicCompositionExtensions.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CompositionConstants.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CatalogExportProvider.CatalogChangeProxy.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\IPartCreatorImportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\PartCreatorExportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\PartCreatorParameterImportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\PartCreatorMemberImportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\IAttributedImport.cs" />
- <Compile Include="System\ComponentModel\Composition\ImportCardinalityMismatchException.cs" />
- <Compile Include="System\ComponentModel\Composition\ImportManyAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\ErrorBuilder.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionErrorDebuggerProxy.cs" />
- <Compile Include="System\ComponentModel\Composition\ExceptionBuilder.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportCardinalityCheckResult.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportServices.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\AggregateCatalog.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\AggregateExportProvider.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\AssemblyCatalog.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\AssemblyCatalogDebuggerProxy.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CatalogExportProvider.CatalogExport.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CatalogExportProvider.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ComposablePartCatalogChangeEventArgs.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ComposablePartCatalogCollection.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ComposablePartExportProvider.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CompositionBatch.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CompositionBatch.SingleExportComposablePart.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CompositionContainer.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CompositionServices.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ExportProvider.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ExportProvider.GetExportOverrides.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ExportsChangeEventArgs.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ImportEngine.RecompositionManager.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ImportEngine.EngineContext.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ImportEngine.PartManager.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ImportEngine.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\INotifyComposablePartCatalogChanged.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\TypeCatalog.cs" />
- <Compile Include="System\ComponentModel\Composition\ICompositionError.cs" />
- <Compile Include="System\ComponentModel\Composition\ImportingConstructorAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\IPartImportsSatisfiedNotification.cs" />
- <Compile Include="System\ComponentModel\Composition\MetadataServices.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePart.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePartCatalog.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePartCatalogDebuggerProxy.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePartDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePartException.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\CompositionElement.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\CompositionElementDebuggerProxy.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\CompositionElementExtensions.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ContractBasedImportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\Export.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ExportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ExportedDelegate.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ICompositionElement.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ImportCardinality.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ImportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\SerializableCompositionElement.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\DisposableReflectionComposablePart.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\IReflectionPartCreationInfo.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\LazyMemberInfo.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionImportDefinition.cs" />
- <Compile Include="Microsoft\Internal\ReflectionInvoke.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionItemType.cs" />
- <Compile Include="System\ComponentModel\Composition\MetadataViewProvider.cs" />
- <Compile Include="System\ComponentModel\Composition\PartCreationPolicyAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\PartMetadataAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\PartNotDiscoverableAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionExtensions.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ImportingParameter.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ImportingItem.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ExportingMember.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ImportingMember.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ImportType.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionComposablePart.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionComposablePartDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionMemberExportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionMemberImportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionModelServices.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionParameterImportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionWritableMember.cs" />
- <Compile Include="System\ComponentModel\Composition\MetadataViewGenerator.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionField.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionMember.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionParameter.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionProperty.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionType.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionItem.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionMethod.cs" />
- <Compile Include="System\ComponentModel\Composition\ChangeRejectedException.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionException.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionErrorId.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionResult.cs" />
- <Compile Include="System\ComponentModel\Composition\ContractNameServices.cs" />
- <Compile Include="System\ComponentModel\Composition\CreationPolicy.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportMetadataAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\ICompositionService.cs" />
- <Compile Include="System\ComponentModel\Composition\ImportAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\MetadataAttributeAttribute.cs" />
- <Compile Include="System\Lazy.cs" />
- <Compile Include="System\LazyOfTTMetadata.cs" />
- <Compile Include="System\Tuple.cs" />
- </ItemGroup>
- <ItemGroup Condition="'$(IsSilverLight)' != 'true'">
- <Compile Include="System\ComponentModel\Composition\Hosting\DirectoryCatalog.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\DirectoryCatalog.DirectoryCatalogDebuggerProxy.cs" />
- </ItemGroup>
- <ItemGroup Condition="'$(IsSilverLight)' == 'true'">
- <Compile Include="SilverlightAdditions.cs" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Strings.resx">
- <SubType>Designer</SubType>
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>Strings.Designer.cs</LastGenOutput>
- <CustomToolNamespace>Microsoft.Internal</CustomToolNamespace>
- </EmbeddedResource>
- </ItemGroup>
- <ItemGroup>
- <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
- <Install>false</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
- <Visible>False</Visible>
- <ProductName>Windows Installer 3.1</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
-</Project>
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/ComponentModelSL.csproj b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/ComponentModelSL.csproj deleted file mode 100644 index be3fe5e8867..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/ComponentModelSL.csproj +++ /dev/null @@ -1,240 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
- <CodeAnalysisRuleSet>Migrated rules for ComponentModel.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules />
- </PropertyGroup>
- <PropertyGroup>
- <IsSilverlight>true</IsSilverlight>
- <DefineConstants>$(DefineConstants);SILVERLIGHT</DefineConstants>
- <ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
- <OutputPath>..\..\bin\SL</OutputPath>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
- <NoWarn>1570;1572;1573;1591;1699</NoWarn>
- </PropertyGroup>
- <PropertyGroup>
- <ProductVersion>10.0.20729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{1BBA5101-D4F0-48B8-A5D6-7B23A099DCE3}</ProjectGuid>
- <ProjectClrTypes>FULLCLR;SILVERLIGHT</ProjectClrTypes>
- <OutputType>Library</OutputType>
- <RootNamespace>Microsoft.Internal</RootNamespace>
- <AssemblyName>System.ComponentModel.Composition</AssemblyName>
- <DocumentationFile>$(OutputPath)\System.ComponentModel.Composition.xml</DocumentationFile>
- <PublishUrl>publish\</PublishUrl>
- <Install>true</Install>
- <InstallFrom>Disk</InstallFrom>
- <UpdateEnabled>false</UpdateEnabled>
- <UpdateMode>Foreground</UpdateMode>
- <UpdateInterval>7</UpdateInterval>
- <UpdateIntervalUnits>Days</UpdateIntervalUnits>
- <UpdatePeriodically>false</UpdatePeriodically>
- <UpdateRequired>false</UpdateRequired>
- <MapFileExtensions>true</MapFileExtensions>
- <ApplicationRevision>0</ApplicationRevision>
- <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
- <IsWebBootstrapper>false</IsWebBootstrapper>
- <UseApplicationTrust>false</UseApplicationTrust>
- <BootstrapperEnabled>true</BootstrapperEnabled>
- </PropertyGroup>
- <PropertyGroup>
- <SignAssembly>true</SignAssembly>
- <NoStdLib>true</NoStdLib>
- </PropertyGroup>
- <PropertyGroup Condition="'$(USE_CUSTOM_KEY)' != 'true'">
- <CreateMetaAssembly>true</CreateMetaAssembly>
- <CreateRefAssembly>true</CreateRefAssembly>
- <PublishMetaAssemblyToSDK>true</PublishMetaAssemblyToSDK>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="mscorlib" />
- <Reference Include="System" />
- <Reference Include="System.Core" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="AssemblyInfo.cs" />
- <Compile Include="Microsoft\Internal\Assumes.cs" />
- <Compile Include="Microsoft\Internal\AttributeServices.cs" />
- <Compile Include="Microsoft\Internal\Collections\CollectionServices.cs" />
- <Compile Include="Microsoft\Internal\Collections\ConditionalWeakTable.cs" />
- <Compile Include="Microsoft\Internal\Collections\CollectionServices.CollectionOfObject.cs" />
- <Compile Include="Microsoft\Internal\Collections\EnumerableCardinality.cs" />
- <Compile Include="Microsoft\Internal\Collections\ReadOnlyDictionary.cs" />
- <Compile Include="Microsoft\Internal\Collections\ReadOnlyDictionaryDebuggerProxy.cs" />
- <Compile Include="Microsoft\Internal\Collections\WeakReferenceCollection.cs" />
- <Compile Include="Microsoft\Internal\ContractServices.cs" />
- <Compile Include="Microsoft\Internal\Assumes.InternalErrorException.cs" />
- <Compile Include="Microsoft\Internal\SilverlightReflectionInvoke.cs" />
- <Compile Include="Microsoft\Internal\GenerationServices.cs" />
- <Compile Include="Microsoft\Internal\LazyServices.cs" />
- <Compile Include="Microsoft\Internal\Lock.cs" />
- <Compile Include="Microsoft\Internal\Lock.Reader.cs" />
- <Compile Include="Microsoft\Internal\Lock.Writer.cs" />
- <Compile Include="Microsoft\Internal\Requires.cs" />
- <Compile Include="Microsoft\Internal\Runtime\Serialization\SerializationServices.cs" />
- <Compile Include="Microsoft\Internal\StringComparers.cs" />
- <Compile Include="Microsoft\Internal\ReflectionServices.cs" />
- <Compile Include="Strings.Designer.cs">
- <AutoGen>True</AutoGen>
- <DesignTime>True</DesignTime>
- <DependentUpon>Strings.resx</DependentUpon>
- <CustomToolNamespace>Microsoft.Internal</CustomToolNamespace>
- </Compile>
- <Compile Include="SuppressMessages.cs" />
- <Compile Include="SuppressMessagesBaselined.cs" />
- <Compile Include="System\ComponentModel\Composition\AttributedModelServices.cs" />
- <Compile Include="System\ComponentModel\Composition\AttributedModel\AttributedModelDiscovery.cs" />
- <Compile Include="System\ComponentModel\Composition\AttributedModel\AttributedPartCreationInfo.cs" />
- <Compile Include="System\ComponentModel\Composition\AttributedModel\AttributedExportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\Diagnostics\CompositionTrace.cs" />
- <Compile Include="System\ComponentModel\Composition\Diagnostics\CompositionTraceId.cs" />
- <Compile Include="System\ComponentModel\Composition\ConstraintServices.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionContractMismatchException.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionError.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionResultOfT.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CatalogExportProvider.PartCreatorExport.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CompositionLock.cs" />
- <Compile Include="System\ComponentModel\Composition\Diagnostics\CompositionTraceSource.cs" />
- <Compile Include="System\ComponentModel\Composition\Diagnostics\TraceWriter.cs" />
- <Compile Include="System\ComponentModel\Composition\Diagnostics\TraceSourceTraceWriter.cs" />
- <Compile Include="System\ComponentModel\Composition\Diagnostics\SilverlightTraceWriter.cs" />
- <Compile Include="System\ComponentModel\Composition\InheritedExportAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportServices.DisposableLazy.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\AtomicComposition.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\AtomicCompositionExtensions.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CompositionConstants.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CatalogExportProvider.CatalogChangeProxy.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\IPartCreatorImportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\PartCreatorExportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\PartCreatorParameterImportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\PartCreatorMemberImportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\IAttributedImport.cs" />
- <Compile Include="System\ComponentModel\Composition\ImportCardinalityMismatchException.cs" />
- <Compile Include="System\ComponentModel\Composition\ImportManyAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\ErrorBuilder.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionErrorDebuggerProxy.cs" />
- <Compile Include="System\ComponentModel\Composition\ExceptionBuilder.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportCardinalityCheckResult.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportServices.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\AggregateCatalog.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\AggregateExportProvider.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\AssemblyCatalog.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\AssemblyCatalogDebuggerProxy.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CatalogExportProvider.CatalogExport.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CatalogExportProvider.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ComposablePartCatalogChangeEventArgs.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ComposablePartCatalogCollection.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ComposablePartExportProvider.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CompositionBatch.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CompositionBatch.SingleExportComposablePart.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CompositionContainer.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CompositionServices.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ExportProvider.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ExportProvider.GetExportOverrides.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ExportsChangeEventArgs.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ImportEngine.RecompositionManager.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ImportEngine.EngineContext.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ImportEngine.PartManager.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\ImportEngine.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\INotifyComposablePartCatalogChanged.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\TypeCatalog.cs" />
- <Compile Include="System\ComponentModel\Composition\ICompositionError.cs" />
- <Compile Include="System\ComponentModel\Composition\ImportingConstructorAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\IPartImportsSatisfiedNotification.cs" />
- <Compile Include="System\ComponentModel\Composition\MetadataServices.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePart.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePartCatalog.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePartCatalogDebuggerProxy.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePartDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePartException.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\CompositionElement.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\CompositionElementDebuggerProxy.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\CompositionElementExtensions.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ContractBasedImportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\Export.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ExportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ExportedDelegate.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ICompositionElement.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ImportCardinality.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\ImportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\Primitives\SerializableCompositionElement.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\DisposableReflectionComposablePart.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\IReflectionPartCreationInfo.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\LazyMemberInfo.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionImportDefinition.cs" />
- <Compile Include="Microsoft\Internal\ReflectionInvoke.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionItemType.cs" />
- <Compile Include="System\ComponentModel\Composition\MetadataViewProvider.cs" />
- <Compile Include="System\ComponentModel\Composition\PartCreationPolicyAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\PartMetadataAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\PartNotDiscoverableAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionExtensions.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ImportingParameter.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ImportingItem.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ExportingMember.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ImportingMember.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ImportType.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionComposablePart.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionComposablePartDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionMemberExportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionMemberImportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionModelServices.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionParameterImportDefinition.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionWritableMember.cs" />
- <Compile Include="System\ComponentModel\Composition\MetadataViewGenerator.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionField.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionMember.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionParameter.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionProperty.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionType.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionItem.cs" />
- <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionMethod.cs" />
- <Compile Include="System\ComponentModel\Composition\ChangeRejectedException.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionException.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionErrorId.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionResult.cs" />
- <Compile Include="System\ComponentModel\Composition\ContractNameServices.cs" />
- <Compile Include="System\ComponentModel\Composition\CreationPolicy.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportMetadataAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\ICompositionService.cs" />
- <Compile Include="System\ComponentModel\Composition\ImportAttribute.cs" />
- <Compile Include="System\ComponentModel\Composition\MetadataAttributeAttribute.cs" />
- <Compile Include="System\Lazy.cs" />
- <Compile Include="System\LazyOfTTMetadata.cs" />
- <Compile Include="System\Tuple.cs" />
- </ItemGroup>
- <ItemGroup Condition="'$(IsSilverLight)' != 'true'">
- <Compile Include="System\ComponentModel\Composition\Hosting\DirectoryCatalog.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\DirectoryCatalog.DirectoryCatalogDebuggerProxy.cs" />
- </ItemGroup>
- <ItemGroup Condition="'$(IsSilverLight)' == 'true'">
- <Compile Include="SilverlightAdditions.cs" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Strings.resx">
- <SubType>Designer</SubType>
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>Strings.Designer.cs</LastGenOutput>
- <CustomToolNamespace>Microsoft.Internal</CustomToolNamespace>
- </EmbeddedResource>
- </ItemGroup>
- <ItemGroup>
- <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
- <Install>false</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
- <Visible>False</Visible>
- <ProductName>Windows Installer 3.1</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- </ItemGroup>
- <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight\v3.0\Microsoft.Silverlight.CSharp.targets" />
-</Project>
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/.gitattributes b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/.gitattributes deleted file mode 100644 index 8843daa9c3b..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/.gitattributes +++ /dev/null @@ -1,14 +0,0 @@ -/Assumes.InternalErrorException.cs -crlf -/Assumes.cs -crlf -/AttributeServices.cs -crlf -/ContractServices.cs -crlf -/GenerationServices.cs -crlf -/LazyServices.cs -crlf -/Lock.Reader.cs -crlf -/Lock.Writer.cs -crlf -/Lock.cs -crlf -/ReflectionInvoke.cs -crlf -/ReflectionServices.cs -crlf -/Requires.cs -crlf -/SilverlightReflectionInvoke.cs -crlf -/StringComparers.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Assumes.InternalErrorException.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Assumes.InternalErrorException.cs deleted file mode 100644 index 147e85709f8..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Assumes.InternalErrorException.cs +++ /dev/null @@ -1,32 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Diagnostics.CodeAnalysis;
-using System.Globalization;
-using System.Runtime.Serialization;
-
-namespace Microsoft.Internal
-{
- partial class Assumes
- {
- // The exception that is thrown when an internal assumption failed.
- [Serializable]
- [SuppressMessage("Microsoft.Design", "CA1064:ExceptionsShouldBePublic")]
- private class InternalErrorException : Exception
- {
- public InternalErrorException(string message)
- : base(string.Format(CultureInfo.CurrentCulture, Strings.InternalExceptionMessage, message))
- {
- }
-
-#if !SILVERLIGHT
- [System.Security.SecuritySafeCritical]
- protected InternalErrorException(SerializationInfo info, StreamingContext context)
- : base(info, context)
- {
- }
-#endif
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Assumes.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Assumes.cs deleted file mode 100644 index 7b1dd6f7975..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Assumes.cs +++ /dev/null @@ -1,102 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Diagnostics.CodeAnalysis;
-using System.Globalization;
-using System.Runtime.Serialization;
-
-namespace Microsoft.Internal
-{
- internal static partial class Assumes
- {
- [DebuggerStepThrough]
- internal static void NotNull<T>(T value)
- where T : class
- {
- IsTrue(value != null);
- }
-
- [DebuggerStepThrough]
- internal static void NotNull<T1, T2>(T1 value1, T2 value2)
- where T1 : class
- where T2 : class
- {
- NotNull(value1);
- NotNull(value2);
- }
-
- [DebuggerStepThrough]
- internal static void NotNull<T1, T2, T3>(T1 value1, T2 value2, T3 value3)
- where T1 : class
- where T2 : class
- where T3 : class
- {
- NotNull(value1);
- NotNull(value2);
- NotNull(value3);
- }
-
- [DebuggerStepThrough]
- internal static void NotNullOrEmpty<T>(T[] values)
- {
- Assumes.NotNull(values);
- Assumes.IsTrue(values.Length > 0);
- }
-
- [DebuggerStepThrough]
- internal static void NotNullOrEmpty(string value)
- {
- NotNull(value);
- IsTrue(value.Length > 0);
- }
-
- [DebuggerStepThrough]
- internal static void Null<T>(T value)
- where T : class
- {
- IsTrue(value == null);
- }
-
- [DebuggerStepThrough]
- internal static void IsFalse(bool condition)
- {
- if (condition)
- {
- Fail(null);
- }
- }
-
- [DebuggerStepThrough]
- internal static void IsTrue(bool condition)
- {
- if (!condition)
- {
- Fail(null);
- }
- }
-
- [DebuggerStepThrough]
- internal static void IsTrue(bool condition, [Localizable(false)]string message)
- {
- if (!condition)
- {
- Fail(message);
- }
- }
-
- [DebuggerStepThrough]
- internal static void Fail([Localizable(false)]string message)
- {
- throw new InternalErrorException(message);
- }
-
- [DebuggerStepThrough]
- internal static T NotReachable<T>()
- {
- throw new InternalErrorException("Code path should never be reached!");
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/AttributeServices.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/AttributeServices.cs deleted file mode 100644 index 6364fa99109..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/AttributeServices.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-
-namespace Microsoft.Internal
-{
- internal static class AttributeServices
- {
- public static T[] GetAttributes<T>(this ICustomAttributeProvider attributeProvider) where T : class
- {
- return (T[])attributeProvider.GetCustomAttributes(typeof(T), false);
- }
-
- public static T[] GetAttributes<T>(this ICustomAttributeProvider attributeProvider, bool inherit) where T : class
- {
- return (T[])attributeProvider.GetCustomAttributes(typeof(T), inherit);
- }
-
- public static T GetFirstAttribute<T>(this ICustomAttributeProvider attributeProvider) where T : class
- {
- return GetAttributes<T>(attributeProvider).FirstOrDefault();
- }
-
- public static T GetFirstAttribute<T>(this ICustomAttributeProvider attributeProvider, bool inherit) where T : class
- {
- return GetAttributes<T>(attributeProvider, inherit).FirstOrDefault();
- }
-
- public static bool IsAttributeDefined<T>(this ICustomAttributeProvider attributeProvider) where T : class
- {
- return attributeProvider.IsDefined(typeof(T), false);
- }
-
- public static bool IsAttributeDefined<T>(this ICustomAttributeProvider attributeProvider, bool inherit) where T : class
- {
- return attributeProvider.IsDefined(typeof(T), inherit);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Collections/.gitattributes b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Collections/.gitattributes deleted file mode 100644 index 71f35810375..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Collections/.gitattributes +++ /dev/null @@ -1,7 +0,0 @@ -/CollectionServices.CollectionOfObject.cs -crlf -/CollectionServices.cs -crlf -/ConditionalWeakTable.cs -crlf -/EnumerableCardinality.cs -crlf -/ReadOnlyDictionary.cs -crlf -/ReadOnlyDictionaryDebuggerProxy.cs -crlf -/WeakReferenceCollection.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Collections/CollectionServices.CollectionOfObject.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Collections/CollectionServices.CollectionOfObject.cs deleted file mode 100644 index a915efc0016..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Collections/CollectionServices.CollectionOfObject.cs +++ /dev/null @@ -1,145 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Reflection;
-
-namespace Microsoft.Internal.Collections
-{
- internal static partial class CollectionServices
- {
- public static ICollection<object> GetCollectionWrapper(Type itemType, object collectionObject)
- {
- Assumes.NotNull(itemType, collectionObject);
-
- if (itemType == typeof(object))
- {
- return (ICollection<object>)collectionObject;
- }
-
- // Most common .Net collections implement IList as well so for those
- // cases we can optimize the wrapping instead of using reflection to create
- // a generic type.
- if (typeof(IList).IsAssignableFrom(collectionObject.GetType()))
- {
- return new CollectionOfObjectList((IList)collectionObject);
- }
-
- Type collectionType = typeof(CollectionOfObject<>).MakeGenericType(itemType);
-
- return (ICollection<object>)Activator.CreateInstance(collectionType, collectionObject);
- }
-
- private class CollectionOfObjectList : ICollection<object>
- {
- private readonly IList _list;
-
- public CollectionOfObjectList(IList list)
- {
- this._list = list;
- }
-
- public void Add(object item)
- {
- this._list.Add(item);
- }
-
- public void Clear()
- {
- this._list.Clear();
- }
-
- public bool Contains(object item)
- {
- return Assumes.NotReachable<bool>();
- }
-
- public void CopyTo(object[] array, int arrayIndex)
- {
- Assumes.NotReachable<object>();
- }
-
- public int Count
- {
- get { return Assumes.NotReachable<int>(); }
- }
-
- public bool IsReadOnly
- {
- get { return this._list.IsReadOnly; }
- }
-
- public bool Remove(object item)
- {
- return Assumes.NotReachable<bool>();
- }
-
- public IEnumerator<object> GetEnumerator()
- {
- return Assumes.NotReachable<IEnumerator<object>>();
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return Assumes.NotReachable<IEnumerator>();
- }
- }
-
- private class CollectionOfObject<T> : ICollection<object>
- {
- private readonly ICollection<T> _collectionOfT;
-
- public CollectionOfObject(object collectionOfT)
- {
- this._collectionOfT = (ICollection<T>)collectionOfT;
- }
-
- public void Add(object item)
- {
- this._collectionOfT.Add((T) item);
- }
-
- public void Clear()
- {
- this._collectionOfT.Clear();
- }
-
- public bool Contains(object item)
- {
- return Assumes.NotReachable<bool>();
- }
-
- public void CopyTo(object[] array, int arrayIndex)
- {
- Assumes.NotReachable<object>();
- }
-
- public int Count
- {
- get { return Assumes.NotReachable<int>(); }
- }
-
- public bool IsReadOnly
- {
- get { return this._collectionOfT.IsReadOnly; }
- }
-
- public bool Remove(object item)
- {
- return Assumes.NotReachable<bool>();
- }
-
- public IEnumerator<object> GetEnumerator()
- {
- return Assumes.NotReachable<IEnumerator<object>>();
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return Assumes.NotReachable<IEnumerator>();
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Collections/CollectionServices.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Collections/CollectionServices.cs deleted file mode 100644 index 33fabda0602..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Collections/CollectionServices.cs +++ /dev/null @@ -1,181 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Diagnostics.CodeAnalysis;
-using System.Globalization;
-using System.Linq;
-
-namespace Microsoft.Internal.Collections
-{
- internal static partial class CollectionServices
- {
- private static readonly Type StringType = typeof(string);
- private static readonly Type IEnumerableType = typeof(IEnumerable);
- private static readonly Type IEnumerableOfTType = typeof(IEnumerable<>);
- private static readonly Type ICollectionOfTType = typeof(ICollection<>);
-
- public static bool IsEnumerableOfT(Type type)
- {
- if (type.IsGenericType)
- {
- Type genericType = type.GetGenericTypeDefinition();
-
- if (genericType == IEnumerableOfTType)
- {
- return true;
- }
- }
- return false;
- }
-
- public static Type GetEnumerableElementType(Type type)
- {
- if (type == StringType || !IEnumerableType.IsAssignableFrom(type))
- {
- return null;
- }
-
- Type closedType;
- if (ReflectionServices.TryGetGenericInterfaceType(type, IEnumerableOfTType, out closedType))
- {
- return closedType.GetGenericArguments()[0];
- }
-
- return null;
- }
-
- public static Type GetCollectionElementType(Type type)
- {
- Type closedType;
- if (ReflectionServices.TryGetGenericInterfaceType(type, ICollectionOfTType, out closedType))
- {
- return closedType.GetGenericArguments()[0];
- }
-
- return null;
- }
-
- public static ReadOnlyCollection<T> ToReadOnlyCollection<T>(this IEnumerable<T> source)
- {
- Assumes.NotNull(source);
-
- return new ReadOnlyCollection<T>(source.AsArray());
- }
-
- public static IEnumerable<T> WhereNotNull<T>(this IEnumerable<T> source) where T : class
- {
- Assumes.NotNull(source);
- return source.Where(NotNull); // Use non-generic NotNull for performance reasons
- }
-
- private static bool NotNull(object element)
- {
- return element != null;
- }
-
- public static IEnumerable<T> ConcatAllowingNull<T>(this IEnumerable<T> source, IEnumerable<T> second)
- {
- if (second == null || !second.FastAny())
- {
- return source;
- }
-
- if (source == null || !source.FastAny())
- {
- return second;
- }
-
- return source.Concat(second);
- }
-
- public static void ForEach<T>(this IEnumerable<T> source, Action<T> action)
- {
- foreach(T t in source)
- {
- action.Invoke(t);
- }
- }
-
- public static EnumerableCardinality GetCardinality<T>(this IEnumerable<T> source)
- {
- Assumes.NotNull(source);
-
- // Cast to ICollection instead of ICollection<T> for performance reasons.
- ICollection collection = source as ICollection;
- if (collection != null)
- {
- switch (collection.Count)
- {
- case 0:
- return EnumerableCardinality.Zero;
-
- case 1:
- return EnumerableCardinality.One;
-
- default:
- return EnumerableCardinality.TwoOrMore;
- }
- }
-
- using (var enumerator = source.GetEnumerator())
- {
- if (!enumerator.MoveNext())
- {
- return EnumerableCardinality.Zero;
- }
-
- if (!enumerator.MoveNext())
- {
- return EnumerableCardinality.One;
- }
-
- return EnumerableCardinality.TwoOrMore;
- }
- }
-
- public static bool FastAny<T>(this IEnumerable<T> source)
- {
- // Enumerable.Any<T> underneath doesn't cast to ICollection,
- // like it does with many of the other LINQ methods.
- // Below is significantly (4x) when mainly working with ICollection
- // sources and a little slower if working with mainly IEnumerable<T>
- // sources.
-
- // Cast to ICollection instead of ICollection<T> for performance reasons.
- ICollection collection = source as ICollection;
- if (collection != null)
- {
- return collection.Count > 0;
- }
-
- return source.Any();
- }
-
- public static Stack<T> Copy<T>(this Stack<T> stack)
- {
- Assumes.NotNull(stack);
-
- // Stack<T>.GetEnumerator walks from top to bottom
- // of the stack, whereas Stack<T>(IEnumerable<T>)
- // pushes to bottom from top, so we need to reverse
- // the stack to get them in the right order.
- return new Stack<T>(stack.Reverse());
- }
-
- public static T[] AsArray<T>(this IEnumerable<T> enumerable)
- {
- T[] array = enumerable as T[];
-
- if (array != null)
- {
- return array;
- }
-
- return enumerable.ToArray();
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Collections/ConditionalWeakTable.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Collections/ConditionalWeakTable.cs deleted file mode 100644 index d25dad3357b..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Collections/ConditionalWeakTable.cs +++ /dev/null @@ -1,116 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-#if !CLR40
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-
-namespace Microsoft.Internal.Collections
-{
- // This is a broken implementation of ConditionalWeakTable that allows us
- // to compile and work on versions of .Net eariler then 4.0. This class is
- // broken when there are circular dependencies between keys and values, which
- // can only be fixed by using some specific CLR 4.0 features.
- // For code samples of the broken behavior see ConditionalWeakTableTests.cs.
- internal class ConditionalWeakTable<TKey, TValue>
- where TKey : class
- where TValue : class
- {
- private readonly Dictionary<object, TValue> _table;
- private int _capacity = 4;
-
- public ConditionalWeakTable()
- {
- this._table = new Dictionary<object, TValue>();
- }
-
- public void Add(TKey key, TValue value)
- {
- CleanupDeadReferences();
- this._table.Add(CreateWeakKey(key), value);
- }
-
- public bool Remove(TKey key)
- {
- return this._table.Remove(key);
- }
-
- public bool TryGetValue(TKey key, out TValue value)
- {
- return this._table.TryGetValue(key, out value);
- }
-
- private void CleanupDeadReferences()
- {
- if (this._table.Count < _capacity)
- {
- return;
- }
-
- object[] deadKeys = this._table.Keys
- .Where(weakRef => !((EquivalentWeakReference)weakRef).IsAlive).ToArray();
-
- foreach (var deadKey in deadKeys)
- {
- this._table.Remove(deadKey);
- }
-
- if (this._table.Count >= _capacity)
- {
- _capacity *= 2;
- }
- }
-
- private static object CreateWeakKey(TKey key)
- {
- return new EquivalentWeakReference(key);
- }
-
- private class EquivalentWeakReference
- {
- private readonly WeakReference _weakReference;
- private readonly int _hashCode;
-
- public EquivalentWeakReference(object obj)
- {
- this._hashCode = obj.GetHashCode();
- this._weakReference = new WeakReference(obj);
- }
-
- public bool IsAlive
- {
- get
- {
- return this._weakReference.IsAlive;
- }
- }
-
- public override bool Equals(object obj)
- {
- EquivalentWeakReference weakRef = obj as EquivalentWeakReference;
-
- if (weakRef != null)
- {
- obj = weakRef._weakReference.Target;
- }
-
- if (obj == null)
- {
- return base.Equals(weakRef);
- }
-
- return object.Equals(this._weakReference.Target, obj);
- }
-
- public override int GetHashCode()
- {
- return this._hashCode;
- }
- }
- }
-}
-#endif
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Collections/EnumerableCardinality.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Collections/EnumerableCardinality.cs deleted file mode 100644 index 45fc7de01cf..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Collections/EnumerableCardinality.cs +++ /dev/null @@ -1,14 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-
-namespace Microsoft.Internal.Collections
-{
- internal enum EnumerableCardinality : int
- {
- Zero = 0,
- One = 1,
- TwoOrMore = 2,
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Collections/ReadOnlyDictionary.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Collections/ReadOnlyDictionary.cs deleted file mode 100644 index 55da71142b5..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Collections/ReadOnlyDictionary.cs +++ /dev/null @@ -1,103 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Diagnostics;
-
-namespace Microsoft.Internal.Collections
-{
- [DebuggerDisplay("Count = {Count}")]
- [DebuggerTypeProxy(typeof(ReadOnlyDictionaryDebuggerProxy<,>))]
- internal sealed partial class ReadOnlyDictionary<TKey, TValue> : IDictionary<TKey, TValue>
- {
- private readonly IDictionary<TKey, TValue> _innerDictionary;
-
- public ReadOnlyDictionary(IDictionary<TKey, TValue> dictionary)
- {
- this._innerDictionary = dictionary ?? new Dictionary<TKey, TValue>(0);
- }
-
- public int Count
- {
- get { return this._innerDictionary.Count; }
- }
-
- public bool IsReadOnly
- {
- get { return true; }
- }
-
- public ICollection<TKey> Keys
- {
- get { return this._innerDictionary.Keys; }
- }
-
- public TValue this[TKey key]
- {
- get { return this._innerDictionary[key]; }
- set { throw new NotSupportedException(Strings.NotSupportedReadOnlyDictionary); }
- }
-
- public ICollection<TValue> Values
- {
- get { return this._innerDictionary.Values; }
- }
-
- public bool Contains(KeyValuePair<TKey, TValue> item)
- {
- return this._innerDictionary.Contains(item);
- }
-
- public bool ContainsKey(TKey key)
- {
- return this._innerDictionary.ContainsKey(key);
- }
-
- public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
- {
- this._innerDictionary.CopyTo(array, arrayIndex);
- }
-
- public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
- {
- return this._innerDictionary.GetEnumerator();
- }
-
- public bool TryGetValue(TKey key, out TValue value)
- {
- return this._innerDictionary.TryGetValue(key, out value);
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return this._innerDictionary.GetEnumerator();
- }
-
- void IDictionary<TKey, TValue>.Add(TKey key, TValue value)
- {
- throw new NotSupportedException(Strings.NotSupportedReadOnlyDictionary);
- }
-
- void ICollection<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TValue> item)
- {
- throw new NotSupportedException(Strings.NotSupportedReadOnlyDictionary);
- }
-
- void ICollection<KeyValuePair<TKey, TValue>>.Clear()
- {
- throw new NotSupportedException(Strings.NotSupportedReadOnlyDictionary);
- }
-
- bool IDictionary<TKey, TValue>.Remove(TKey key)
- {
- throw new NotSupportedException(Strings.NotSupportedReadOnlyDictionary);
- }
-
- bool ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue> item)
- {
- throw new NotSupportedException(Strings.NotSupportedReadOnlyDictionary);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Collections/ReadOnlyDictionaryDebuggerProxy.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Collections/ReadOnlyDictionaryDebuggerProxy.cs deleted file mode 100644 index 8fa7ad5fcf6..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Collections/ReadOnlyDictionaryDebuggerProxy.cs +++ /dev/null @@ -1,32 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-
-namespace Microsoft.Internal.Collections
-{
- // NOTE: This type cannot be a nested proxy of ReadOnlyDictionary due to a bug
- // in the Visual Studio Debugger which causes it to ignore nested generic proxies.
- internal class ReadOnlyDictionaryDebuggerProxy<TKey, TValue>
- {
- private readonly ReadOnlyDictionary<TKey, TValue> _dictionary;
-
- public ReadOnlyDictionaryDebuggerProxy(ReadOnlyDictionary<TKey, TValue> dictionary)
- {
- Requires.NotNull(dictionary, "dictionary");
-
- _dictionary = dictionary;
- }
-
- [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
- public KeyValuePair<TKey, TValue>[] Items
- {
- // NOTE: This shouldn't be cached, so that on every query of
- // the current value of the underlying dictionary is respected.
- get { return this._dictionary.ToArray(); }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Collections/WeakReferenceCollection.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Collections/WeakReferenceCollection.cs deleted file mode 100644 index ce8b55a485c..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Collections/WeakReferenceCollection.cs +++ /dev/null @@ -1,92 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-
-namespace Microsoft.Internal.Collections
-{
- internal class WeakReferenceCollection<T> where T : class
- {
- private readonly List<WeakReference> _items = new List<WeakReference>();
-
- public void Add(T item)
- {
- // Only cleanup right before we need to reallocate space.
- if (this._items.Capacity == this._items.Count)
- {
- this.CleanupDeadReferences();
- }
-
- this._items.Add(new WeakReference(item));
- }
-
- public void Remove(T item)
- {
- int index = IndexOf(item);
-
- if (index != -1)
- {
- this._items.RemoveAt(index);
- }
- }
-
- public bool Contains(T item)
- {
- return IndexOf(item) >= 0;
- }
-
- public void Clear()
- {
- this._items.Clear();
- }
-
- // Should be executed under at least a read lock.
- private int IndexOf(T item)
- {
- int count = this._items.Count;
- for (int i = 0; i < count; i++)
- {
- if (this._items[i].Target == item)
- {
- return i;
- }
- }
- return -1;
- }
-
- // Should be executed under a write lock
- private void CleanupDeadReferences()
- {
- int count = this._items.Count;
- for (int i = count - 1; i >= 0; i--)
- {
- if (this._items[i].Target == null)
- {
- this._items.RemoveAt(i);
- }
- }
- }
-
- public List<T> AliveItemsToList()
- {
- List<T> aliveItems = new List<T>();
-
- foreach (var weakItem in this._items)
- {
- T item = weakItem.Target as T;
-
- if (item != null)
- {
- aliveItems.Add(item);
- }
- }
-
- return aliveItems;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/ContractServices.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/ContractServices.cs deleted file mode 100644 index 4a125d61407..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/ContractServices.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.ComponentModel.Composition.Primitives;
-
-namespace Microsoft.Internal
-{
- internal class ContractServices
- {
- public static T Cast<T>(object o)
- {
- return (T)o;
- }
-
- public static bool TryCast(Type contractType, object value, out object result)
- {
- if (value == null)
- {
- result = null;
- return true;
- }
- if (contractType.IsInstanceOfType(value))
- {
- result = value;
- return true;
- }
-
- // We couldn't cast see if a delegate works for us.
- if (typeof(Delegate).IsAssignableFrom(contractType))
- {
- ExportedDelegate exportedDelegate = value as ExportedDelegate;
- if (exportedDelegate != null)
- {
- result = exportedDelegate.CreateDelegate(contractType);
- return (result != null);
- }
- }
-
- result = null;
- return false;
- }
- }
-}
-
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/GenerationServices.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/GenerationServices.cs deleted file mode 100644 index 9aae10caf0e..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/GenerationServices.cs +++ /dev/null @@ -1,333 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.Globalization;
-using System.Linq;
-using System.Text;
-using System.Reflection;
-using System.Reflection.Emit;
-
-namespace Microsoft.Internal
-{
- internal static class GenerationServices
- {
- // Type.GetTypeFromHandle
- private static readonly MethodInfo _typeGetTypeFromHandleMethod = typeof(Type).GetMethod("GetTypeFromHandle");
-
-
- // typeofs are pretty expensive, so we cache them statically
- private static readonly Type TypeType = typeof(System.Type);
- private static readonly Type StringType = typeof(System.String);
- private static readonly Type CharType = typeof(System.Char);
- private static readonly Type BooleanType = typeof(System.Boolean);
- private static readonly Type ByteType = typeof(System.Byte);
- private static readonly Type SByteType = typeof(System.SByte);
- private static readonly Type Int16Type = typeof(System.Int16);
- private static readonly Type UInt16Type = typeof(System.UInt16);
- private static readonly Type Int32Type = typeof(System.Int32);
- private static readonly Type UInt32Type = typeof(System.UInt32);
- private static readonly Type Int64Type = typeof(System.Int64);
- private static readonly Type UInt64Type = typeof(System.UInt64);
- private static readonly Type DoubleType = typeof(System.Double);
- private static readonly Type SingleType = typeof(System.Single);
- private static readonly Type IEnumerableTypeofT = typeof(System.Collections.Generic.IEnumerable<>);
- private static readonly Type IEnumerableType = typeof(System.Collections.IEnumerable);
-
- private static readonly MethodInfo ExceptionGetData = typeof(Exception).GetProperty("Data").GetGetMethod();
- private static readonly MethodInfo DictionaryAdd = typeof(IDictionary).GetMethod("Add");
- private static readonly ConstructorInfo ObjectCtor = typeof(object).GetConstructor(Type.EmptyTypes);
-
- public static ILGenerator CreateGeneratorForPublicConstructor(this TypeBuilder typeBuilder, Type[] ctrArgumentTypes)
- {
- ConstructorBuilder ctorBuilder = typeBuilder.DefineConstructor(
- MethodAttributes.Public,
- CallingConventions.Standard,
- ctrArgumentTypes);
-
- ILGenerator ctorIL = ctorBuilder.GetILGenerator();
- ctorIL.Emit(OpCodes.Ldarg_0);
- ctorIL.Emit(OpCodes.Call, ObjectCtor);
-
- return ctorIL;
- }
-
- /// Generates the code that loads the supplied value on the stack
- /// This is not as simple as it seems, as different instructions need to be generated depending
- /// on its type.
- /// We support:
- /// 1. All primitive types
- /// 2. Strings
- /// 3. Enums
- /// 4. typeofs
- /// 5. nulls
- /// 6. Enumerables
- /// 7. Delegates on static functions or any of the above
- /// Everything else cannot be represented as literals
- /// <param name="ilGenerator"></param>
- /// <param name="item"></param>
- /// <param name="key"></param>
- /// <param name="value"></param>
- /// <returns></returns>
- public static void LoadValue(this ILGenerator ilGenerator, object value)
- {
- Assumes.NotNull(ilGenerator);
-
- //
- // Get nulls out of the way - they are basically typeless, so we just load null
- //
- if (value == null)
- {
- ilGenerator.LoadNull();
- return;
- }
-
- //
- // Prepare for literal loading - decide whether we should box, and handle enums properly
- //
- Type valueType = value.GetType();
- object rawValue = value;
- if (valueType.IsEnum)
- {
- // enums are special - we need to load the underlying constant on the stack
- rawValue = Convert.ChangeType(value, Enum.GetUnderlyingType(valueType), null);
- valueType = rawValue.GetType();
- }
-
- //
- // Generate IL depending on the valueType - this is messier than it should ever be, but sadly necessary
- //
- if (valueType == GenerationServices.StringType)
- {
- // we need to check for strings before enumerables, because strings are IEnumerable<char>
- ilGenerator.LoadString((string)rawValue);
- }
- else if (GenerationServices.TypeType.IsAssignableFrom(valueType))
- {
- ilGenerator.LoadTypeOf((Type)rawValue);
- }
- else if (GenerationServices.IEnumerableType.IsAssignableFrom(valueType))
- {
- // NOTE : strings and dictionaries are also enumerables, but we have already handled those
- ilGenerator.LoadEnumerable((IEnumerable) rawValue);
- }
- else if (
- (valueType == GenerationServices.CharType) ||
- (valueType == GenerationServices.BooleanType) ||
- (valueType == GenerationServices.ByteType) ||
- (valueType == GenerationServices.SByteType) ||
- (valueType == GenerationServices.Int16Type) ||
- (valueType == GenerationServices.UInt16Type) ||
- (valueType == GenerationServices.Int32Type)
- )
- {
- // NOTE : Everything that is 32 bit or less uses ldc.i4. We need to pass int32, even if the actual types is shorter - this is IL memory model
- // direct casting to (int) won't work, because the value is boxed, thus we need to use Convert.
- // Sadly, this will not work for all cases - namely large uint32 - because they can't semantically fit into 32 signed bits
- // We have a special case for that next
- ilGenerator.LoadInt((int)Convert.ChangeType(rawValue, typeof(int), CultureInfo.InvariantCulture));
- }
- else if (valueType == GenerationServices.UInt32Type)
- {
- // NOTE : This one is a bit tricky. Ldc.I4 takes an Int32 as an argument, although it really treats it as a 32bit number
- // That said, some UInt32 values are larger that Int32.MaxValue, so the Convert call above will fail, which is why
- // we need to treat this case individually and cast to uint, and then - unchecked - to int.
- ilGenerator.LoadInt(unchecked((int)((uint)rawValue)));
- }
- else if (valueType == GenerationServices.Int64Type)
- {
- ilGenerator.LoadLong((long)rawValue);
- }
- else if (valueType == GenerationServices.UInt64Type)
- {
- // NOTE : This one is a bit tricky. Ldc.I8 takes an Int64 as an argument, although it really treats it as a 64bit number
- // That said, some UInt64 values are larger that Int64.MaxValue, so the direct case we use above (or Convert, for that matter)will fail, which is why
- // we need to treat this case individually and cast to ulong, and then - unchecked - to long.
- ilGenerator.LoadLong(unchecked((long)((ulong)rawValue)));
- }
- else if (valueType == GenerationServices.SingleType)
- {
- ilGenerator.LoadFloat((float)rawValue);
- }
- else if (valueType == GenerationServices.DoubleType)
- {
- ilGenerator.LoadDouble((double)rawValue);
- }
- else
- {
- throw new InvalidOperationException(
- string.Format(CultureInfo.CurrentCulture, Strings.InvalidMetadataValue, value.GetType().FullName));
- }
- }
-
- /// Generates the code that adds an object to a dictionary stored in a local variable
- /// <param name="ilGenerator"></param>
- /// <param name="dictionary"></param>
- /// <param name="key"></param>
- /// <param name="value"></param>
- /// <returns></returns>
- public static void AddItemToLocalDictionary(this ILGenerator ilGenerator, LocalBuilder dictionary, object key, object value)
- {
- Assumes.NotNull(ilGenerator);
- Assumes.NotNull(dictionary);
- Assumes.NotNull(key);
- Assumes.NotNull(value);
-
- ilGenerator.Emit(OpCodes.Ldloc, dictionary);
- ilGenerator.LoadValue(key);
- ilGenerator.LoadValue(value);
- ilGenerator.Emit(OpCodes.Callvirt, DictionaryAdd);
- }
-
- /// Generates the code that adds an object from a local variable to a dictionary also stored in a local
- /// <param name="ilGenerator"></param>
- /// <param name="dictionary"></param>
- /// <param name="key"></param>
- /// <param name="value"></param>
- /// <returns></returns>
- public static void AddLocalToLocalDictionary(this ILGenerator ilGenerator, LocalBuilder dictionary, object key, LocalBuilder value)
- {
- Assumes.NotNull(ilGenerator);
- Assumes.NotNull(dictionary);
- Assumes.NotNull(key);
- Assumes.NotNull(value);
-
- ilGenerator.Emit(OpCodes.Ldloc, dictionary);
- ilGenerator.LoadValue(key);
- ilGenerator.Emit(OpCodes.Ldloc, value);
- ilGenerator.Emit(OpCodes.Callvirt, DictionaryAdd);
- }
-
- /// Generates the code to get the type of an object and store it in a local
- /// <param name="ilGenerator"></param>
- /// <param name="dictionary"></param>
- /// <param name="key"></param>
- /// <param name="value"></param>
- /// <returns></returns>
- public static void GetExceptionDataAndStoreInLocal(this ILGenerator ilGenerator, LocalBuilder exception, LocalBuilder dataStore)
- {
- Assumes.NotNull(ilGenerator);
- Assumes.NotNull(exception);
- Assumes.NotNull(dataStore);
-
- ilGenerator.Emit(OpCodes.Ldloc, exception);
- ilGenerator.Emit(OpCodes.Callvirt, ExceptionGetData);
- ilGenerator.Emit(OpCodes.Stloc, dataStore);
- }
-
- private static void LoadEnumerable(this ILGenerator ilGenerator, IEnumerable enumerable)
- {
- Assumes.NotNull(ilGenerator);
- Assumes.NotNull(enumerable);
-
- // We load enumerable as an array - this is the most compact and efficient way of representing it
- Type elementType = null;
- Type closedType = null;
- if (ReflectionServices.TryGetGenericInterfaceType(enumerable.GetType(), GenerationServices.IEnumerableTypeofT, out closedType))
- {
- elementType = closedType.GetGenericArguments()[0];
- }
- else
- {
- elementType = typeof(object);
- }
-
- //
- // elem[] array = new elem[<enumerable.Count()>]
- //
- Type generatedArrayType = elementType.MakeArrayType();
- LocalBuilder generatedArrayLocal = ilGenerator.DeclareLocal(generatedArrayType);
-
- ilGenerator.LoadInt(enumerable.Cast<object>().Count());
- ilGenerator.Emit(OpCodes.Newarr, elementType);
- ilGenerator.Emit(OpCodes.Stloc, generatedArrayLocal);
-
- int index = 0;
- foreach (object value in enumerable)
- {
- //
- //array[<index>] = value;
- //
- ilGenerator.Emit(OpCodes.Ldloc, generatedArrayLocal);
- ilGenerator.LoadInt(index);
- ilGenerator.LoadValue(value);
- if (GenerationServices.IsBoxingRequiredForValue(value) && !elementType.IsValueType)
- {
- ilGenerator.Emit(OpCodes.Box, value.GetType());
- }
- ilGenerator.Emit(OpCodes.Stelem, elementType);
- index++;
- }
-
- ilGenerator.Emit(OpCodes.Ldloc, generatedArrayLocal);
- }
-
- private static bool IsBoxingRequiredForValue(object value)
- {
- if (value == null)
- {
- return false;
- }
- else
- {
- return value.GetType().IsValueType;
- }
- }
-
-
- private static void LoadNull(this ILGenerator ilGenerator)
- {
- ilGenerator.Emit(OpCodes.Ldnull);
- }
-
- private static void LoadString(this ILGenerator ilGenerator, string s)
- {
- Assumes.NotNull(ilGenerator);
- if (s == null)
- {
- ilGenerator.LoadNull();
- }
- else
- {
- ilGenerator.Emit(OpCodes.Ldstr, s);
- }
- }
-
-
- private static void LoadInt(this ILGenerator ilGenerator, int value)
- {
- Assumes.NotNull(ilGenerator);
- ilGenerator.Emit(OpCodes.Ldc_I4, value);
- }
-
- private static void LoadLong(this ILGenerator ilGenerator, long value)
- {
- Assumes.NotNull(ilGenerator);
- ilGenerator.Emit(OpCodes.Ldc_I8, value);
- }
-
- private static void LoadFloat(this ILGenerator ilGenerator, float value)
- {
- Assumes.NotNull(ilGenerator);
- ilGenerator.Emit(OpCodes.Ldc_R4, value);
- }
-
- private static void LoadDouble(this ILGenerator ilGenerator, double value)
- {
- Assumes.NotNull(ilGenerator);
- ilGenerator.Emit(OpCodes.Ldc_R8, value);
- }
-
- private static void LoadTypeOf(this ILGenerator ilGenerator, Type type)
- {
- Assumes.NotNull(ilGenerator);
- //typeofs() translate into ldtoken and Type::GetTypeFromHandle call
- ilGenerator.Emit(OpCodes.Ldtoken, type);
- ilGenerator.EmitCall(OpCodes.Call, GenerationServices._typeGetTypeFromHandleMethod, null);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/LazyServices.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/LazyServices.cs deleted file mode 100644 index 07783ffcd7b..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/LazyServices.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-using System.Text;
-using System.Globalization;
-
-namespace Microsoft.Internal
-{
- internal static class LazyServices
- {
- public static Lazy<T> AsLazy<T>(this T t)
- where T : class
- {
- return new Lazy<T>(() => t, false);
- }
-
- public static T GetNotNullValue<T>(this Lazy<T> lazy, string argument)
- where T : class
- {
- Assumes.NotNull(lazy);
- T value = lazy.Value;
- if (value == null)
- {
- throw new InvalidOperationException(
- string.Format(CultureInfo.CurrentCulture, Strings.LazyServices_LazyResolvesToNull, typeof(T), argument));
- }
-
- return value;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Lock.Reader.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Lock.Reader.cs deleted file mode 100644 index 3f81a68ade9..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Lock.Reader.cs +++ /dev/null @@ -1,32 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-
-namespace Microsoft.Internal
-{
- internal struct ReadLock : IDisposable
- {
- private readonly Lock _lock;
- private int _isDisposed;
-
- public ReadLock(Lock @lock)
- {
- this._isDisposed = 0;
- this._lock = @lock;
- this._lock.EnterReadLock();
- }
-
- public void Dispose()
- {
- if (Interlocked.CompareExchange(ref this._isDisposed, 1, 0) == 0)
- {
- this._lock.ExitReadLock();
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Lock.Writer.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Lock.Writer.cs deleted file mode 100644 index e9d7088020f..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Lock.Writer.cs +++ /dev/null @@ -1,32 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-
-namespace Microsoft.Internal
-{
- internal struct WriteLock : IDisposable
- {
- private readonly Lock _lock;
- private int _isDisposed;
-
- public WriteLock(Lock @lock)
- {
- this._isDisposed = 0;
- this._lock = @lock;
- this._lock.EnterWriteLock();
- }
-
- public void Dispose()
- {
- if (Interlocked.CompareExchange(ref this._isDisposed, 1, 0) == 0)
- {
- this._lock.ExitWriteLock();
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Lock.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Lock.cs deleted file mode 100644 index 7cd7ac2ee5e..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Lock.cs +++ /dev/null @@ -1,79 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-
-namespace Microsoft.Internal
-{
- internal sealed class Lock : IDisposable
- {
-#if (!SILVERLIGHT)
- private ReaderWriterLockSlim _thisLock = new ReaderWriterLockSlim(LockRecursionPolicy.NoRecursion);
- private int _isDisposed = 0;
- public void EnterReadLock()
- {
- this._thisLock.EnterReadLock();
- }
-
- public void EnterWriteLock()
- {
- this._thisLock.EnterWriteLock();
- }
-
- public void ExitReadLock()
- {
- this._thisLock.ExitReadLock();
- }
-
- public void ExitWriteLock()
- {
- this._thisLock.ExitWriteLock();
- }
-
- public void Dispose()
- {
- if (Interlocked.CompareExchange(ref this._isDisposed, 1, 0) == 0)
- {
- this._thisLock.Dispose();
- }
- }
-
-#else
- // ReaderWriterLockSlim is not yet implemented on SilverLight
- // Satisfies our requirements until it is implemented
- object _thisLock = new object();
-
- public Lock()
- {
- }
-
- public void EnterReadLock()
- {
- Monitor.Enter(this._thisLock);
- }
-
- public void EnterWriteLock()
- {
- Monitor.Enter(this._thisLock);
- }
-
- public void ExitReadLock()
- {
- Monitor.Exit(this._thisLock);
- }
-
- public void ExitWriteLock()
- {
- Monitor.Exit(this._thisLock);
- }
-
- public void Dispose()
- {
- }
-#endif
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/ReflectionInvoke.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/ReflectionInvoke.cs deleted file mode 100644 index b91a0c52a30..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/ReflectionInvoke.cs +++ /dev/null @@ -1,114 +0,0 @@ -#if !SILVERLIGHT && CLR40
-
-using System;
-using System.Reflection;
-using System.Security;
-using System.Security.Permissions;
-
-namespace Microsoft.Internal
-{
- internal static class ReflectionInvoke
- {
- private static readonly ReflectionPermission _memberAccess = new ReflectionPermission(ReflectionPermissionFlag.MemberAccess);
- private static readonly ReflectionPermission _restrictedMemberAccess = new ReflectionPermission(ReflectionPermissionFlag.RestrictedMemberAccess);
-
- public static object SafeCreateInstance(this Type type, params object[] arguments)
- {
- DemandMemberAccessIfNeeded(type);
-
- return Activator.CreateInstance(type, arguments);
- }
-
- public static object SafeInvoke(this ConstructorInfo constructor, params object[] arguments)
- {
- DemandMemberAccessIfNeeded(constructor);
-
- return constructor.Invoke(arguments);
- }
-
- public static object SafeInvoke(this MethodInfo method, object instance, params object[] arguments)
- {
- DemandMemberAccessIfNeeded(method);
-
- return method.Invoke(instance, arguments);
- }
-
- public static object SafeGetValue(this FieldInfo field, object instance)
- {
- DemandMemberAccessIfNeeded(field);
-
- return field.GetValue(instance);
- }
-
- public static void SafeSetValue(this FieldInfo field, object instance, object value)
- {
- DemandMemberAccessIfNeeded(field);
-
- field.SetValue(instance, value);
- }
-
- public static void DemandMemberAccessIfNeeded(MethodInfo method)
- {
- if (!method.IsVisible())
- {
- DemandMemberAccess(method);
- }
- }
-
- private static void DemandMemberAccessIfNeeded(FieldInfo field)
- {
- if (!field.IsVisible())
- {
- DemandMemberAccess(field);
- }
- }
-
- public static void DemandMemberAccessIfNeeded(Type type)
- {
- // Consult UnderlyingSystemType this is the type that Activator.CreateInstance creates
- if (!type.UnderlyingSystemType.IsVisible)
- {
- DemandMemberAccess(type);
- }
- }
-
- private static void DemandMemberAccessIfNeeded(ConstructorInfo constructor)
- {
- if (!constructor.IsVisible())
- {
- DemandMemberAccess(constructor);
- }
- }
-
- private static void DemandMemberAccess(MemberInfo target)
- {
- try
- {
- _memberAccess.Demand();
- }
- catch (SecurityException)
- { // The caller doesn't have member access, but let's see whether they have access to
- // members of assemblies with less or equal permissions (this mimics Reflection's behavior)
-
- DemandRestrictedMemberAccess(target);
- }
- }
-
- private static void DemandRestrictedMemberAccess(MemberInfo target)
- {
- Assembly targetAssembly = target.Assembly();
-
- PermissionSet targetGrantSet = UnsafePermissionSet(targetAssembly);
- targetGrantSet.AddPermission(_restrictedMemberAccess);
- targetGrantSet.Demand();
- }
-
- [SecuritySafeCritical] // PermissionSet is [SecurityCritical]
- private static PermissionSet UnsafePermissionSet(Assembly assembly)
- {
- return assembly.PermissionSet;
- }
- }
-}
-
-#endif
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/ReflectionServices.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/ReflectionServices.cs deleted file mode 100644 index 937e5bdefc3..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/ReflectionServices.cs +++ /dev/null @@ -1,122 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
-using System.Linq;
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-namespace Microsoft.Internal
-{
- internal static class ReflectionServices
- {
- public static Assembly Assembly(this MemberInfo member)
- {
- Type type = member as Type;
- if (type != null)
- {
- return type.Assembly;
- }
-
- return member.DeclaringType.Assembly;
- }
-
- public static bool IsVisible(this ConstructorInfo constructor)
- {
- return constructor.DeclaringType.IsVisible && constructor.IsPublic;
- }
-
- public static bool IsVisible(this FieldInfo field)
- {
- return field.DeclaringType.IsVisible && field.IsPublic;
- }
-
- public static bool IsVisible(this MethodInfo method)
- {
- if (!method.DeclaringType.IsVisible)
- return false;
-
- if (!method.IsPublic)
- return false;
-
- if (method.IsGenericMethod)
- {
- // Check type arguments, for example if we're passed 'Activator.CreateInstance<SomeMefInternalType>()'
- foreach (Type typeArgument in method.GetGenericArguments())
- {
- if (!typeArgument.IsVisible)
- return false;
- }
- }
-
- return true;
- }
-
- public static string GetDisplayName(Type declaringType, string name)
- {
- Assumes.NotNull(declaringType);
-
- return declaringType.GetDisplayName() + "." + name;
- }
-
- public static string GetDisplayName(this MemberInfo member)
- {
- Assumes.NotNull(member);
-
- switch (member.MemberType)
- {
- case MemberTypes.TypeInfo:
- case MemberTypes.NestedType:
- return ((Type)member).FullName;
- }
-
- return GetDisplayName(member.DeclaringType, member.Name);
- }
-
- internal static bool TryGetGenericInterfaceType(Type instanceType, Type targetOpenInterfaceType, out Type targetClosedInterfaceType)
- {
- // The interface must be open
- Assumes.IsTrue(targetOpenInterfaceType.IsInterface);
- Assumes.IsTrue(targetOpenInterfaceType.IsGenericTypeDefinition);
- Assumes.IsTrue(!instanceType.IsGenericTypeDefinition);
-
- // if instanceType is an interface, we must first check it directly
- if (instanceType.IsInterface &&
- instanceType.IsGenericType &&
- instanceType.GetGenericTypeDefinition() == targetOpenInterfaceType)
- {
- targetClosedInterfaceType = instanceType;
- return true;
- }
-
- try
- {
- // Purposefully not using FullName here because it results in a significantly
- // more expensive implementation of GetInterface, this does mean that we're
- // takign the chance that there aren't too many types which implement multiple
- // interfaces by the same name...
- Type targetInterface = instanceType.GetInterface(targetOpenInterfaceType.Name, false);
- if (targetInterface != null &&
- targetInterface.GetGenericTypeDefinition() == targetOpenInterfaceType)
- {
- targetClosedInterfaceType = targetInterface;
- return true;
- }
- }
- catch (AmbiguousMatchException)
- {
- // If there are multiple with the same name we should not pick any
- }
-
- targetClosedInterfaceType = null;
- return false;
- }
-
- internal static IEnumerable<PropertyInfo> GetAllProperties(this Type type)
- {
- return type.GetInterfaces().Concat(new Type[] { type }).SelectMany(itf => itf.GetProperties());
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Requires.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Requires.cs deleted file mode 100644 index fa9656c544f..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Requires.cs +++ /dev/null @@ -1,102 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Globalization;
-using System.Reflection;
-using System.ComponentModel.Composition;
-using System.Text;
-
-namespace Microsoft.Internal
-{
- internal static class Requires
- {
- [DebuggerStepThrough]
- public static void NotNull<T>(T value, string parameterName)
- where T : class
- {
- if (value == null)
- {
- throw new ArgumentNullException(parameterName);
- }
- }
-
- [DebuggerStepThrough]
- public static void NotNullOrEmpty(string value, string parameterName)
- {
- NotNull(value, parameterName);
-
- if (value.Length == 0)
- {
- throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Strings.ArgumentException_EmptyString, parameterName), parameterName);
- }
- }
-
- [DebuggerStepThrough]
- public static void NotNullOrNullElements<T>(IEnumerable<T> values, string parameterName)
- where T : class
- {
- NotNull(values, parameterName);
- NotNullElements(values, parameterName);
- }
-
- [DebuggerStepThrough]
- public static void NullOrNotNullElements<TKey, TValue>(IEnumerable<KeyValuePair<TKey, TValue>> values, string parameterName)
- where TKey : class
- where TValue : class
- {
- if (values != null)
- {
- NotNullElements(values, parameterName);
- }
- }
-
- [DebuggerStepThrough]
- public static void NullOrNotNullElements<T>(IEnumerable<T> values, string parameterName)
- where T : class
- {
- if (values != null)
- {
- NotNullElements(values, parameterName);
- }
- }
-
- private static void NotNullElements<T>(IEnumerable<T> values, string parameterName)
- where T : class
- {
- foreach (T value in values)
- {
- if (value == null)
- {
- throw ExceptionBuilder.CreateContainsNullElement(parameterName);
- }
- }
- }
-
- private static void NotNullElements<TKey, TValue>(IEnumerable<KeyValuePair<TKey, TValue>> values, string parameterName)
- where TKey : class
- where TValue : class
- {
- foreach (KeyValuePair<TKey, TValue> value in values)
- {
- if ((value.Key == null) || (value.Value == null))
- {
- throw ExceptionBuilder.CreateContainsNullElement(parameterName);
- }
- }
- }
- [DebuggerStepThrough]
- public static void IsInMembertypeSet(MemberTypes value, string parameterName, MemberTypes enumFlagSet)
- {
- if ((value & enumFlagSet) != value || // Ensure the member is in the set
- (value & (value - 1)) != 0) // Ensure that there is only one flag in the value (i.e. value is a power of 2).
- {
- throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Strings.ArgumentOutOfRange_InvalidEnumInSet, parameterName, value, enumFlagSet.ToString()), parameterName);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Runtime/Serialization/.gitattributes b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Runtime/Serialization/.gitattributes deleted file mode 100644 index cc023ba4d69..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Runtime/Serialization/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -/SerializationServices.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Runtime/Serialization/SerializationServices.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Runtime/Serialization/SerializationServices.cs deleted file mode 100644 index 39c6f41beec..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/Runtime/Serialization/SerializationServices.cs +++ /dev/null @@ -1,22 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-#if !SILVERLIGHT
-
-using System;
-using System.Runtime.Serialization;
-
-namespace Microsoft.Internal.Runtime.Serialization
-{
- internal static class SerializationServices
- {
- public static T GetValue<T>(this SerializationInfo info, string name)
- {
- Assumes.NotNull(info, name);
-
- return (T)info.GetValue(name, typeof(T));
- }
- }
-}
-
-#endif
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/SilverlightReflectionInvoke.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/SilverlightReflectionInvoke.cs deleted file mode 100644 index 0e2e3f63f1e..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/SilverlightReflectionInvoke.cs +++ /dev/null @@ -1,43 +0,0 @@ -#if SILVERLIGHT || !CLR40
-
-using System;
-using System.Reflection;
-using System.Security;
-using System.Security.Permissions;
-
-namespace Microsoft.Internal
-{
- internal static class ReflectionInvoke
- {
- public static object SafeCreateInstance(this Type type, params object[] arguments)
- {
- return Activator.CreateInstance(type, arguments);
- }
-
- public static object SafeInvoke(this ConstructorInfo constructor, params object[] arguments)
- {
- return constructor.Invoke(arguments);
- }
-
- public static object SafeInvoke(this MethodInfo method, object instance, params object[] arguments)
- {
- return method.Invoke(instance, arguments);
- }
-
- public static object SafeGetValue(this FieldInfo field, object instance)
- {
- return field.GetValue(instance);
- }
-
- public static void SafeSetValue(this FieldInfo field, object instance, object value)
- {
- field.SetValue(instance, value);
- }
-
- public static void DemandMemberAccessIfNeeded(MethodInfo method)
- {
- }
- }
-}
-
-#endif
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/StringComparers.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/StringComparers.cs deleted file mode 100644 index d66113b4730..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Microsoft/Internal/StringComparers.cs +++ /dev/null @@ -1,20 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-
-namespace Microsoft.Internal
-{
- internal static class StringComparers
- {
- public static StringComparer ContractName
- {
- get { return StringComparer.Ordinal; }
- }
-
- public static StringComparer MetadataKeyNames
- {
- get { return StringComparer.Ordinal; }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/SilverlightAdditions.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/SilverlightAdditions.cs deleted file mode 100644 index 75c1cf65c0c..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/SilverlightAdditions.cs +++ /dev/null @@ -1,90 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Diagnostics.CodeAnalysis;
-
-namespace System
-{
- [Conditional("NOT_SILVERLIGHT")] // Trick so that the attribute is never actually applied
- [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Delegate, Inherited = false)]
- internal sealed class SerializableAttribute : Attribute
- {
- }
-}
-
-namespace System.ComponentModel
-{
- internal sealed class LocalizableAttribute : Attribute
- {
- [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "isLocalizable")]
- public LocalizableAttribute(bool isLocalizable)
- {
- }
- }
-}
-
-#if !CLR40
-namespace System.Collections.Generic
-{
- internal class HashSet<T> : IEnumerable<T>
- {
- private Dictionary<T, object> _set = new Dictionary<T, object>();
-
- public HashSet()
- {
- }
-
- public HashSet(IEnumerable<T> items)
- {
- foreach (T item in items)
- {
- Add(item);
- }
- }
-
- public bool Add(T item)
- {
- if (!this._set.ContainsKey(item))
- {
- this._set.Add(item, null);
- return true;
- }
- return false;
- }
-
- public void Clear()
- {
- this._set.Clear();
- }
-
- public bool Contains(T item)
- {
- return this._set.ContainsKey(item);
- }
-
- public bool Remove(T item)
- {
- if (this._set.ContainsKey(item))
- {
- this._set.Remove(item);
- return true;
- }
- return false;
- }
-
- public IEnumerator<T> GetEnumerator()
- {
- return this._set.Keys.GetEnumerator();
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
- }
-}
-#endif
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Strings.Designer.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Strings.Designer.cs deleted file mode 100644 index 5650944d037..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Strings.Designer.cs +++ /dev/null @@ -1,927 +0,0 @@ -//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.20626.0
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace Microsoft.Internal {
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Strings {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Strings() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Internal.Strings", typeof(Strings).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to '{0}' is a reflection-only assembly which is not supported..
- /// </summary>
- internal static string Argument_AssemblyReflectionOnly {
- get {
- return ResourceManager.GetString("Argument_AssemblyReflectionOnly", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to '{0}' contains a reflection-only type which is not supported..
- /// </summary>
- internal static string Argument_ElementReflectionOnlyType {
- get {
- return ResourceManager.GetString("Argument_ElementReflectionOnlyType", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to 'exports' cannot be empty when ImportDefinition.ImportCardinality is ImportCardinality.ExactlyOne..
- /// </summary>
- internal static string Argument_ExportsEmpty {
- get {
- return ResourceManager.GetString("Argument_ExportsEmpty", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to 'exports' cannot contain more than one element when ImportDefinition.ImportCardinality is ImportCardinality.ZeroOrOne or ImportCardinality.ExactlyOne..
- /// </summary>
- internal static string Argument_ExportsTooMany {
- get {
- return ResourceManager.GetString("Argument_ExportsTooMany", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to '{0}' cannot contain a null (Nothing in Visual Basic) element..
- /// </summary>
- internal static string Argument_NullElement {
- get {
- return ResourceManager.GetString("Argument_NullElement", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to '{0}' cannot be an empty string ("")..
- /// </summary>
- internal static string ArgumentException_EmptyString {
- get {
- return ResourceManager.GetString("ArgumentException_EmptyString", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The value of argument '{0}' ({1}) is invalid for Enum type '{2}'..
- /// </summary>
- internal static string ArgumentOutOfRange_InvalidEnum {
- get {
- return ResourceManager.GetString("ArgumentOutOfRange_InvalidEnum", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The value of argument '{0}' ({1}) is not supported. Allowed values are : '{2}'..
- /// </summary>
- internal static string ArgumentOutOfRange_InvalidEnumInSet {
- get {
- return ResourceManager.GetString("ArgumentOutOfRange_InvalidEnumInSet", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The argument was a value type which is not supported..
- /// </summary>
- internal static string ArgumentValueType {
- get {
- return ResourceManager.GetString("ArgumentValueType", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Assembly file {0} is either not found or not a dll or exe file..
- /// </summary>
- internal static string AssemblyFileNotFoundOrWrongType {
- get {
- return ResourceManager.GetString("AssemblyFileNotFoundOrWrongType", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The atomicComposition can no longer be changed because the atomicComposition has already been completed..
- /// </summary>
- internal static string AtomicComposition_AlreadyCompleted {
- get {
- return ResourceManager.GetString("AtomicComposition_AlreadyCompleted", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The atomicComposition is already contains an inner atomicComposition and cannot contain more than one atomicComposition at a time..
- /// </summary>
- internal static string AtomicComposition_AlreadyNested {
- get {
- return ResourceManager.GetString("AtomicComposition_AlreadyNested", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The atomicComposition contains another inner atomicComposition and cannot be changed until the that inner atomicComposition has been completed..
- /// </summary>
- internal static string AtomicComposition_PartOfAnotherAtomicComposition {
- get {
- return ResourceManager.GetString("AtomicComposition_PartOfAnotherAtomicComposition", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to No valid exports were found that match the constraint '{0}', invalid exports may have been rejected..
- /// </summary>
- internal static string CardinalityMismatch_NoExports {
- get {
- return ResourceManager.GetString("CardinalityMismatch_NoExports", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to More than one export was found that matches the constraint '{0}'..
- /// </summary>
- internal static string CardinalityMismatch_TooManyExports {
- get {
- return ResourceManager.GetString("CardinalityMismatch_TooManyExports", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Unknown Origin.
- /// </summary>
- internal static string CompositionElement_UnknownOrigin {
- get {
- return ResourceManager.GetString("CompositionElement_UnknownOrigin", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The composition remains unchanged. The changes were rejected because of the following error(s): {0}.
- /// </summary>
- internal static string CompositionException_ChangesRejected {
- get {
- return ResourceManager.GetString("CompositionException_ChangesRejected", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Element: {0}.
- /// </summary>
- internal static string CompositionException_ElementPrefix {
- get {
- return ResourceManager.GetString("CompositionException_ElementPrefix", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Resulting in:.
- /// </summary>
- internal static string CompositionException_ErrorPrefix {
- get {
- return ResourceManager.GetString("CompositionException_ErrorPrefix", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Unable to create an instance of the Metadata view '{0}' because a constructor could not be selected. Ensure that the type implements a constructor which takes an argument of type IDictionary<string, object>..
- /// </summary>
- internal static string CompositionException_MetadataViewInvalidConstructor {
- get {
- return ResourceManager.GetString("CompositionException_MetadataViewInvalidConstructor", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The composition produced multiple composition errors, with {0:N0} root causes. The root causes are provided below..
- /// </summary>
- internal static string CompositionException_MultipleErrorsWithMultiplePaths {
- get {
- return ResourceManager.GetString("CompositionException_MultipleErrorsWithMultiplePaths", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to {0} {1}.
- /// </summary>
- internal static string CompositionException_OriginFormat {
- get {
- return ResourceManager.GetString("CompositionException_OriginFormat", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to --> .
- /// </summary>
- internal static string CompositionException_OriginSeparator {
- get {
- return ResourceManager.GetString("CompositionException_OriginSeparator", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to ).
- /// </summary>
- internal static string CompositionException_PathsCountSeparator {
- get {
- return ResourceManager.GetString("CompositionException_PathsCountSeparator", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Review the CompositionException.Errors property for more detailed information..
- /// </summary>
- internal static string CompositionException_ReviewErrorProperty {
- get {
- return ResourceManager.GetString("CompositionException_ReviewErrorProperty", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The composition produced a single composition error, with {0:N0} root causes. The root causes are provided below..
- /// </summary>
- internal static string CompositionException_SingleErrorWithMultiplePaths {
- get {
- return ResourceManager.GetString("CompositionException_SingleErrorWithMultiplePaths", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The composition produced a single composition error. The root cause is provided below..
- /// </summary>
- internal static string CompositionException_SingleErrorWithSinglePath {
- get {
- return ResourceManager.GetString("CompositionException_SingleErrorWithSinglePath", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The catalog '{0}' could not load assembly '{1}'. {2}.
- /// </summary>
- internal static string CompositionTrace_Discovery_AssemblyLoadFailed {
- get {
- return ResourceManager.GetString("CompositionTrace_Discovery_AssemblyLoadFailed", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The ComposablePartDefinition '{0}' was ignored because it is an open generic type..
- /// </summary>
- internal static string CompositionTrace_Discovery_DefinitionContainsGenericParameters {
- get {
- return ResourceManager.GetString("CompositionTrace_Discovery_DefinitionContainsGenericParameters", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The ComposablePartDefinition '{0}' was ignored because it contains no exports..
- /// </summary>
- internal static string CompositionTrace_Discovery_DefinitionContainsNoExports {
- get {
- return ResourceManager.GetString("CompositionTrace_Discovery_DefinitionContainsNoExports", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The ComposablePartDefinition '{0}' was ignored because it was marked with PartNotDiscoverableAttribute..
- /// </summary>
- internal static string CompositionTrace_Discovery_DefinitionMarkedWithPartNotDiscoverableAttribute {
- get {
- return ResourceManager.GetString("CompositionTrace_Discovery_DefinitionMarkedWithPartNotDiscoverableAttribute", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The member or parameter '{0}' is marked with multiple Import and ImportMany attributes. Only the first attribute encountered will be respected..
- /// </summary>
- internal static string CompositionTrace_Discovery_MemberMarkedWithMultipleImportAndImportMany {
- get {
- return ResourceManager.GetString("CompositionTrace_Discovery_MemberMarkedWithMultipleImportAndImportMany", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The ComposablePartDefinition '{0}' has been rejected. {1}.
- /// </summary>
- internal static string CompositionTrace_Rejection_DefinitionRejected {
- get {
- return ResourceManager.GetString("CompositionTrace_Rejection_DefinitionRejected", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The ComposablePartDefinition '{0}' that was previously rejected has been resurrected..
- /// </summary>
- internal static string CompositionTrace_Rejection_DefinitionResurrected {
- get {
- return ResourceManager.GetString("CompositionTrace_Rejection_DefinitionResurrected", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Cannot cast the underlying exported value of type '{0}' to type '{1}'..
- /// </summary>
- internal static string ContractMismatch_ExportedValueCannotBeCastToT {
- get {
- return ResourceManager.GetString("ContractMismatch_ExportedValueCannotBeCastToT", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Unable to create an Instance of the Metadata view '{0}' because the exporter exported the metadata for the item '{1}' with the value '{2}' as type '{3}' but the view imports it as type '{4}'..
- /// </summary>
- internal static string ContractMismatch_InvalidCastOnMetadataField {
- get {
- return ResourceManager.GetString("ContractMismatch_InvalidCastOnMetadataField", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Unable to create an Instance of the Metadata view '{0}' because the exporter exported the metadata for the item '{1}' with a null value and null is not a valid value for type '{2}'..
- /// </summary>
- internal static string ContractMismatch_NullReferenceOnMetadataField {
- get {
- return ResourceManager.GetString("ContractMismatch_NullReferenceOnMetadataField", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Directory '{0}' could not be found..
- /// </summary>
- internal static string DirectoryNotFound {
- get {
- return ResourceManager.GetString("DirectoryNotFound", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Member or Type '{0}' contains multiple metadata entries with the name '{1}'. The metadata entries could be coming from the ExportMetadataAttribute or from a property of a custom metadata attribute. Either remove the duplicate entries or enable the metadata entry with name '{1}' to allow multiple entries via the IsMultiple property on ExportMetadataAttribute or AttributeUsage.AllowMultiple on custom metadata attributes..
- /// </summary>
- internal static string Discovery_DuplicateMetadataNameValues {
- get {
- return ResourceManager.GetString("Discovery_DuplicateMetadataNameValues", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Property '{0}' has type '{1}' which is an invalid metadata type. Metadata can only contain values with a type that is available to be embedded at compile-time into attributes. For more details of what types are valid reference section 17.1.3 in the C# specification..
- /// </summary>
- internal static string Discovery_MetadataContainsValueWithInvalidType {
- get {
- return ResourceManager.GetString("Discovery_MetadataContainsValueWithInvalidType", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Member or Type '{0}' contains a metadata entry with the name '{1}', which is a reserved metadata key name. Either remove this metadata entry or change the name associated with the entry..
- /// </summary>
- internal static string Discovery_ReservedMetadataNameUsed {
- get {
- return ResourceManager.GetString("Discovery_ReservedMetadataNameUsed", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to {0} did not originate from the ExportDefinitions property on this ComposablePart or its ComposablePartDefinition..
- /// </summary>
- internal static string ExportDefinitionNotOnThisComposablePart {
- get {
- return ResourceManager.GetString("ExportDefinitionNotOnThisComposablePart", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to {0} did not originate from the ImportDefinitions property on this ComposablePart or its ComposablePartDefinition..
- /// </summary>
- internal static string ImportDefinitionNotOnThisComposablePart {
- get {
- return ResourceManager.GetString("ImportDefinitionNotOnThisComposablePart", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The composition failed because it did not complete within '{0:N0}' iterations. This is most likely caused by a cycle in the dependency graph of a part which is marked with a non-shared creation policy..
- /// </summary>
- internal static string ImportEngine_ComposeTookTooManyIterations {
- get {
- return ResourceManager.GetString("ImportEngine_ComposeTookTooManyIterations", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The ComposablePart of type '{0}' cannot be recomposed because it is in an invalid state. It can only be recomposed if it has already been fully previewed or composed..
- /// </summary>
- internal static string ImportEngine_InvalidStateForRecomposition {
- get {
- return ResourceManager.GetString("ImportEngine_InvalidStateForRecomposition", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Cannot activate part '{0}'..
- /// </summary>
- internal static string ImportEngine_PartCannotActivate {
- get {
- return ResourceManager.GetString("ImportEngine_PartCannotActivate", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Cannot get export '{0}' from part '{1}'..
- /// </summary>
- internal static string ImportEngine_PartCannotGetExportedValue {
- get {
- return ResourceManager.GetString("ImportEngine_PartCannotGetExportedValue", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Cannot set import '{0}' on part '{1}'..
- /// </summary>
- internal static string ImportEngine_PartCannotSetImport {
- get {
- return ResourceManager.GetString("ImportEngine_PartCannotSetImport", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Cannot compose part '{0}' because a cycle exists in the dependencies between the exports being composed. To break this cycle, consider changing some imports from constructor to property injection..
- /// </summary>
- internal static string ImportEngine_PartCycle {
- get {
- return ResourceManager.GetString("ImportEngine_PartCycle", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Change in exports prevented by non-recomposable import '{0}' on part '{1}'..
- /// </summary>
- internal static string ImportEngine_PreventedByExistingImport {
- get {
- return ResourceManager.GetString("ImportEngine_PreventedByExistingImport", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Could not finishing composing object of type '{0}'. The import '{1}' was not satisfied..
- /// </summary>
- internal static string ImportNotSetOnPart {
- get {
- return ResourceManager.GetString("ImportNotSetOnPart", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Internal error occurred. Additional information: '{0}'..
- /// </summary>
- internal static string InternalExceptionMessage {
- get {
- return ResourceManager.GetString("InternalExceptionMessage", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Metadata can only contain values with a type that is available to be embedded at compile-time into attributes. For more details of what types are valid reference section 17.1.3 in the C# specification..
- /// </summary>
- internal static string InvalidMetadataValue {
- get {
- return ResourceManager.GetString("InvalidMetadataValue", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The Type '{0}' supplied is not a valid Metadata View..
- /// </summary>
- internal static string InvalidMetadataView {
- get {
- return ResourceManager.GetString("InvalidMetadataView", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to 'definition' cannot be set after Activate has been called because ImportDefinition.IsRecomposable is false..
- /// </summary>
- internal static string InvalidOperation_DefinitionCannotBeRecomposed {
- get {
- return ResourceManager.GetString("InvalidOperation_DefinitionCannotBeRecomposed", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to GetExportedValue cannot be called before prerequisite import '{0}' has been set..
- /// </summary>
- internal static string InvalidOperation_GetExportedValueBeforePrereqImportSet {
- get {
- return ResourceManager.GetString("InvalidOperation_GetExportedValueBeforePrereqImportSet", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to A call to Compose occurred during a call to Compose on the same CompositionContainer object. Use the IsComposing property on CompositionContainer to ensure a composition is not already in progress before calling Compose..
- /// </summary>
- internal static string InvalidOperationReentrantCompose {
- get {
- return ResourceManager.GetString("InvalidOperationReentrantCompose", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The MetadataView '{0}' is invalid because property '{1}' has a property set method..
- /// </summary>
- internal static string InvalidSetterOnMetadataField {
- get {
- return ResourceManager.GetString("InvalidSetterOnMetadataField", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Accessors must not be null (Nothing in Visual Basic)..
- /// </summary>
- internal static string LazyMemberInfo_AccessorsNull {
- get {
- return ResourceManager.GetString("LazyMemberInfo_AccessorsNull", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to A member of type '{0}' must have exactly a single accessor of type '{0}'.
- /// </summary>
- internal static string LazyMemberInfo_InvalidAccessorOnSimpleMember {
- get {
- return ResourceManager.GetString("LazyMemberInfo_InvalidAccessorOnSimpleMember", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to All event accessors must be methods..
- /// </summary>
- internal static string LazyMemberinfo_InvalidEventAccessors_AccessorType {
- get {
- return ResourceManager.GetString("LazyMemberinfo_InvalidEventAccessors_AccessorType", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to An event must have exactly three accessors..
- /// </summary>
- internal static string LazyMemberInfo_InvalidEventAccessors_Cardinality {
- get {
- return ResourceManager.GetString("LazyMemberInfo_InvalidEventAccessors_Cardinality", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to All property accessors must be methods..
- /// </summary>
- internal static string LazyMemberinfo_InvalidPropertyAccessors_AccessorType {
- get {
- return ResourceManager.GetString("LazyMemberinfo_InvalidPropertyAccessors_AccessorType", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to A property must have exactly two accessors..
- /// </summary>
- internal static string LazyMemberInfo_InvalidPropertyAccessors_Cardinality {
- get {
- return ResourceManager.GetString("LazyMemberInfo_InvalidPropertyAccessors_Cardinality", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to A member must have at least one accessor..
- /// </summary>
- internal static string LazyMemberInfo_NoAccessors {
- get {
- return ResourceManager.GetString("LazyMemberInfo_NoAccessors", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The lazily evaluated value of type '{0}' passed to the ReflectionModelServices API as part of the argument '{1}' must not return null (Nothing in Visual Basic)..
- /// </summary>
- internal static string LazyServices_LazyResolvesToNull {
- get {
- return ResourceManager.GetString("LazyServices_LazyResolvesToNull", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to This export does not support the metadata item '{0}'..
- /// </summary>
- internal static string MetadataItemNotSupported {
- get {
- return ResourceManager.GetString("MetadataItemNotSupported", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The {0} member must be overridden by a derived class..
- /// </summary>
- internal static string NotImplemented_NotOverriddenByDerived {
- get {
- return ResourceManager.GetString("NotImplemented_NotOverriddenByDerived", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Interface '{0}' is not a valid MetadataView; MetadataViews do not support non-public interfaces, and interfaces that contain members that are not properties..
- /// </summary>
- internal static string NotSupportedInterfaceMetadataView {
- get {
- return ResourceManager.GetString("NotSupportedInterfaceMetadataView", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The underlying dictionary is read-only..
- /// </summary>
- internal static string NotSupportedReadOnlyDictionary {
- get {
- return ResourceManager.GetString("NotSupportedReadOnlyDictionary", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to This property cannot be set after the object's public surface has been accessed..
- /// </summary>
- internal static string ObjectAlreadyInitialized {
- get {
- return ResourceManager.GetString("ObjectAlreadyInitialized", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to This object has not been initialized - the property '{0}' must be set..
- /// </summary>
- internal static string ObjectMustBeInitialized {
- get {
- return ResourceManager.GetString("ObjectMustBeInitialized", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Currently composing another batch in this ComposablePartExportProvider. Only one batch can be composed at a time..
- /// </summary>
- internal static string ReentrantCompose {
- get {
- return ResourceManager.GetString("ReentrantCompose", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Cannot get the value of property '{0}', because the member is not readable. The property must have an accessible getter..
- /// </summary>
- internal static string ReflectionModel_ExportNotReadable {
- get {
- return ResourceManager.GetString("ReflectionModel_ExportNotReadable", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to An exception occurred while trying to get the value of property '{0}'..
- /// </summary>
- internal static string ReflectionModel_ExportThrewException {
- get {
- return ResourceManager.GetString("ReflectionModel_ExportThrewException", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Cannot populate the collection '{0}' because an exception occurred while calling the Add method on the type '{1}'..
- /// </summary>
- internal static string ReflectionModel_ImportCollectionAddThrewException {
- get {
- return ResourceManager.GetString("ReflectionModel_ImportCollectionAddThrewException", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Cannot populate the collection '{0}' because an exception occurred while calling the Clear method on the type '{1}'..
- /// </summary>
- internal static string ReflectionModel_ImportCollectionClearThrewException {
- get {
- return ResourceManager.GetString("ReflectionModel_ImportCollectionClearThrewException", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Cannot populate the collection '{0}' because an exception occurred while calling the default constructor on the type '{1}'..
- /// </summary>
- internal static string ReflectionModel_ImportCollectionConstructionThrewException {
- get {
- return ResourceManager.GetString("ReflectionModel_ImportCollectionConstructionThrewException", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Cannot populate the collection '{0}' because an exception occurred while trying to access the collection value. If the collection is not IEnumerable<T> or T[] it must implement ICollection<T> and be either pre-initialized or be writable with a default constructor..
- /// </summary>
- internal static string ReflectionModel_ImportCollectionGetThrewException {
- get {
- return ResourceManager.GetString("ReflectionModel_ImportCollectionGetThrewException", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Cannot populate the collection '{0}' because an exception occurred while reading the IsReadOnly property on the type '{1}'..
- /// </summary>
- internal static string ReflectionModel_ImportCollectionIsReadOnlyThrewException {
- get {
- return ResourceManager.GetString("ReflectionModel_ImportCollectionIsReadOnlyThrewException", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Cannot populate the collection '{0}' because it does not implement ICollection<T> or is read-only. If the collection is not IEnumerable<T> or T[] it must implement ICollection<T> and be either pre-initialized or be writable with a default constructor..
- /// </summary>
- internal static string ReflectionModel_ImportCollectionNotWritable {
- get {
- return ResourceManager.GetString("ReflectionModel_ImportCollectionNotWritable", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Cannot populate the value of enumerable member '{0}' because it is null (Nothing in Visual Basic). If the collection is not IEnumerable<T> or T[] it must implement ICollection<T> and be either pre-initialized or be writable with a default constructor..
- /// </summary>
- internal static string ReflectionModel_ImportCollectionNull {
- get {
- return ResourceManager.GetString("ReflectionModel_ImportCollectionNull", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The importing constructor on type '{0}' is using ImportManyAttribute on parameter '{1}' with a non-assignable type. On constructor parameters the ImportManyAttribute only supports importing into types T[] or IEnumerable<T>..
- /// </summary>
- internal static string ReflectionModel_ImportManyOnParameterCanOnlyBeAssigned {
- get {
- return ResourceManager.GetString("ReflectionModel_ImportManyOnParameterCanOnlyBeAssigned", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The export '{0}' is not assignable to type '{1}'..
- /// </summary>
- internal static string ReflectionModel_ImportNotAssignableFromExport {
- get {
- return ResourceManager.GetString("ReflectionModel_ImportNotAssignableFromExport", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Cannot set the value of '{0}' because the member is not writable. If the member is a property, it must have an accessible setter; otherwise, if it is a field, it must not be read-only..
- /// </summary>
- internal static string ReflectionModel_ImportNotWritable {
- get {
- return ResourceManager.GetString("ReflectionModel_ImportNotWritable", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to An exception occurred while trying to set the value of property '{0}'..
- /// </summary>
- internal static string ReflectionModel_ImportThrewException {
- get {
- return ResourceManager.GetString("ReflectionModel_ImportThrewException", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to ExportDefinition of type '{0}' cannot be used in this context. Only export definitions produced by the ReflectionModelServices.CreateExportDefinition are supported..
- /// </summary>
- internal static string ReflectionModel_InvalidExportDefinition {
- get {
- return ResourceManager.GetString("ReflectionModel_InvalidExportDefinition", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to ImportDefinition of type '{0}' cannot be used in this context. Only import definitions produced by the ReflectionModelServices.CreateImportDefinition are supported..
- /// </summary>
- internal static string ReflectionModel_InvalidImportDefinition {
- get {
- return ResourceManager.GetString("ReflectionModel_InvalidImportDefinition", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to ImportDefinition of type '{0}' cannot be used in this context. Only import definitions produced by the ReflectionModelServices.CreateImportDefinition based on members are supported. Use ReflectionModelServices.IsImportingParameter to determine whether a given import definition is based on a member or a parameter..
- /// </summary>
- internal static string ReflectionModel_InvalidMemberImportDefinition {
- get {
- return ResourceManager.GetString("ReflectionModel_InvalidMemberImportDefinition", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to ImportDefinition of type '{0}' cannot be used in this context. Only import definitions produced by the ReflectionModelServices.CreateImportDefinition based on parameters are supported. Use ReflectionModelServices.IsImportingParameter to determine whether a given import definition is based on a member or a parameter..
- /// </summary>
- internal static string ReflectionModel_InvalidParameterImportDefinition {
- get {
- return ResourceManager.GetString("ReflectionModel_InvalidParameterImportDefinition", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to ComposablePartDefinition of type '{0}' cannot be used in this context. Only part definitions produced by the ReflectionModelServices.CreatePartDefinition are supported..
- /// </summary>
- internal static string ReflectionModel_InvalidPartDefinition {
- get {
- return ResourceManager.GetString("ReflectionModel_InvalidPartDefinition", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Cannot create an instance of type '{0}' because a constructor could not be selected for construction. Ensure that the type either has a default constructor, or a single constructor marked with the 'System.ComponentModel.Composition.ImportingConstructorAttribute'..
- /// </summary>
- internal static string ReflectionModel_PartConstructorMissing {
- get {
- return ResourceManager.GetString("ReflectionModel_PartConstructorMissing", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to An exception occurred while trying to create an instance of type '{0}'..
- /// </summary>
- internal static string ReflectionModel_PartConstructorThrewException {
- get {
- return ResourceManager.GetString("ReflectionModel_PartConstructorThrewException", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to An exception occurred while calling the 'OnImportsSatisfied' method on type '{0}'..
- /// </summary>
- internal static string ReflectionModel_PartOnImportsSatisfiedThrewException {
- get {
- return ResourceManager.GetString("ReflectionModel_PartOnImportsSatisfiedThrewException", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to {0} (Types='{1}')..
- /// </summary>
- internal static string TypeCatalog_DisplayNameFormat {
- get {
- return ResourceManager.GetString("TypeCatalog_DisplayNameFormat", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to <Empty>.
- /// </summary>
- internal static string TypeCatalog_Empty {
- get {
- return ResourceManager.GetString("TypeCatalog_Empty", resourceCulture);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Strings.resx b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Strings.resx deleted file mode 100644 index db6341d4ba7..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/Strings.resx +++ /dev/null @@ -1,408 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="ArgumentException_EmptyString" xml:space="preserve">
- <value>'{0}' cannot be an empty string ("").</value>
- </data>
- <data name="ArgumentOutOfRange_InvalidEnum" xml:space="preserve">
- <value>The value of argument '{0}' ({1}) is invalid for Enum type '{2}'.</value>
- </data>
- <data name="ArgumentValueType" xml:space="preserve">
- <value>The argument was a value type which is not supported.</value>
- </data>
- <data name="Argument_AssemblyReflectionOnly" xml:space="preserve">
- <value>'{0}' is a reflection-only assembly which is not supported.</value>
- </data>
- <data name="Argument_NullElement" xml:space="preserve">
- <value>'{0}' cannot contain a null (Nothing in Visual Basic) element.</value>
- </data>
- <data name="AssemblyFileNotFoundOrWrongType" xml:space="preserve">
- <value>Assembly file {0} is either not found or not a dll or exe file.</value>
- </data>
- <data name="CardinalityMismatch_NoExports" xml:space="preserve">
- <value>No valid exports were found that match the constraint '{0}', invalid exports may have been rejected.</value>
- </data>
- <data name="CardinalityMismatch_TooManyExports" xml:space="preserve">
- <value>More than one export was found that matches the constraint '{0}'.</value>
- </data>
- <data name="ImportEngine_ComposeTookTooManyIterations" xml:space="preserve">
- <value>The composition failed because it did not complete within '{0:N0}' iterations. This is most likely caused by a cycle in the dependency graph of a part which is marked with a non-shared creation policy.</value>
- </data>
- <data name="ContractMismatch_ExportedValueCannotBeCastToT" xml:space="preserve">
- <value>Cannot cast the underlying exported value of type '{0}' to type '{1}'.</value>
- </data>
- <data name="DirectoryNotFound" xml:space="preserve">
- <value>Directory '{0}' could not be found.</value>
- </data>
- <data name="ReflectionModel_PartConstructorThrewException" xml:space="preserve">
- <value>An exception occurred while trying to create an instance of type '{0}'.</value>
- </data>
- <data name="ReflectionModel_ExportThrewException" xml:space="preserve">
- <value>An exception occurred while trying to get the value of property '{0}'.</value>
- </data>
- <data name="ReflectionModel_PartOnImportsSatisfiedThrewException" xml:space="preserve">
- <value>An exception occurred while calling the 'OnImportsSatisfied' method on type '{0}'.</value>
- </data>
- <data name="ReflectionModel_ImportThrewException" xml:space="preserve">
- <value>An exception occurred while trying to set the value of property '{0}'.</value>
- </data>
- <data name="ExportDefinitionNotOnThisComposablePart" xml:space="preserve">
- <value>{0} did not originate from the ExportDefinitions property on this ComposablePart or its ComposablePartDefinition.</value>
- </data>
- <data name="ReflectionModel_ImportCollectionNotWritable" xml:space="preserve">
- <value>Cannot populate the collection '{0}' because it does not implement ICollection<T> or is read-only. If the collection is not IEnumerable<T> or T[] it must implement ICollection<T> and be either pre-initialized or be writable with a default constructor.</value>
- </data>
- <data name="ReflectionModel_ImportCollectionNull" xml:space="preserve">
- <value>Cannot populate the value of enumerable member '{0}' because it is null (Nothing in Visual Basic). If the collection is not IEnumerable<T> or T[] it must implement ICollection<T> and be either pre-initialized or be writable with a default constructor.</value>
- </data>
- <data name="ImportEngine_PartCycle" xml:space="preserve">
- <value>Cannot compose part '{0}' because a cycle exists in the dependencies between the exports being composed. To break this cycle, consider changing some imports from constructor to property injection.</value>
- </data>
- <data name="ImportDefinitionNotOnThisComposablePart" xml:space="preserve">
- <value>{0} did not originate from the ImportDefinitions property on this ComposablePart or its ComposablePartDefinition.</value>
- </data>
- <data name="ImportNotSetOnPart" xml:space="preserve">
- <value>Could not finishing composing object of type '{0}'. The import '{1}' was not satisfied.</value>
- </data>
- <data name="ReflectionModel_ImportNotWritable" xml:space="preserve">
- <value>Cannot set the value of '{0}' because the member is not writable. If the member is a property, it must have an accessible setter; otherwise, if it is a field, it must not be read-only.</value>
- </data>
- <data name="InternalExceptionMessage" xml:space="preserve">
- <value>Internal error occurred. Additional information: '{0}'.</value>
- </data>
- <data name="InvalidMetadataView" xml:space="preserve">
- <value>The Type '{0}' supplied is not a valid Metadata View.</value>
- </data>
- <data name="InvalidOperationReentrantCompose" xml:space="preserve">
- <value>A call to Compose occurred during a call to Compose on the same CompositionContainer object. Use the IsComposing property on CompositionContainer to ensure a composition is not already in progress before calling Compose.</value>
- </data>
- <data name="MetadataItemNotSupported" xml:space="preserve">
- <value>This export does not support the metadata item '{0}'.</value>
- </data>
- <data name="NotSupportedInterfaceMetadataView" xml:space="preserve">
- <value>Interface '{0}' is not a valid MetadataView; MetadataViews do not support non-public interfaces, and interfaces that contain members that are not properties.</value>
- </data>
- <data name="ReflectionModel_PartConstructorMissing" xml:space="preserve">
- <value>Cannot create an instance of type '{0}' because a constructor could not be selected for construction. Ensure that the type either has a default constructor, or a single constructor marked with the 'System.ComponentModel.Composition.ImportingConstructorAttribute'.</value>
- </data>
- <data name="NotImplemented_NotOverriddenByDerived" xml:space="preserve">
- <value>The {0} member must be overridden by a derived class.</value>
- </data>
- <data name="NotSupportedReadOnlyDictionary" xml:space="preserve">
- <value>The underlying dictionary is read-only.</value>
- </data>
- <data name="ObjectAlreadyInitialized" xml:space="preserve">
- <value>This property cannot be set after the object's public surface has been accessed.</value>
- </data>
- <data name="ObjectMustBeInitialized" xml:space="preserve">
- <value>This object has not been initialized - the property '{0}' must be set.</value>
- </data>
- <data name="ReflectionModel_ImportNotAssignableFromExport" xml:space="preserve">
- <value>The export '{0}' is not assignable to type '{1}'.</value>
- </data>
- <data name="ReflectionModel_ExportNotReadable" xml:space="preserve">
- <value>Cannot get the value of property '{0}', because the member is not readable. The property must have an accessible getter.</value>
- </data>
- <data name="Argument_ElementReflectionOnlyType" xml:space="preserve">
- <value>'{0}' contains a reflection-only type which is not supported.</value>
- </data>
- <data name="InvalidOperation_DefinitionCannotBeRecomposed" xml:space="preserve">
- <value>'definition' cannot be set after Activate has been called because ImportDefinition.IsRecomposable is false.</value>
- </data>
- <data name="Argument_ExportsEmpty" xml:space="preserve">
- <value>'exports' cannot be empty when ImportDefinition.ImportCardinality is ImportCardinality.ExactlyOne.</value>
- </data>
- <data name="Argument_ExportsTooMany" xml:space="preserve">
- <value>'exports' cannot contain more than one element when ImportDefinition.ImportCardinality is ImportCardinality.ZeroOrOne or ImportCardinality.ExactlyOne.</value>
- </data>
- <data name="CompositionElement_UnknownOrigin" xml:space="preserve">
- <value>Unknown Origin</value>
- </data>
- <data name="ImportEngine_PartCannotActivate" xml:space="preserve">
- <value>Cannot activate part '{0}'.</value>
- </data>
- <data name="ImportEngine_PartCannotSetImport" xml:space="preserve">
- <value>Cannot set import '{0}' on part '{1}'.</value>
- </data>
- <data name="ImportEngine_PartCannotGetExportedValue" xml:space="preserve">
- <value>Cannot get export '{0}' from part '{1}'.</value>
- </data>
- <data name="TypeCatalog_Empty" xml:space="preserve">
- <value><Empty></value>
- </data>
- <data name="InvalidOperation_GetExportedValueBeforePrereqImportSet" xml:space="preserve">
- <value>GetExportedValue cannot be called before prerequisite import '{0}' has been set.</value>
- </data>
- <data name="CompositionException_ErrorPrefix" xml:space="preserve">
- <value>Resulting in:</value>
- </data>
- <data name="CompositionException_MultipleErrorsWithMultiplePaths" xml:space="preserve">
- <value>The composition produced multiple composition errors, with {0:N0} root causes. The root causes are provided below.</value>
- </data>
- <data name="CompositionException_ReviewErrorProperty" xml:space="preserve">
- <value>Review the CompositionException.Errors property for more detailed information.</value>
- </data>
- <data name="CompositionException_SingleErrorWithMultiplePaths" xml:space="preserve">
- <value>The composition produced a single composition error, with {0:N0} root causes. The root causes are provided below.</value>
- </data>
- <data name="CompositionException_SingleErrorWithSinglePath" xml:space="preserve">
- <value>The composition produced a single composition error. The root cause is provided below.</value>
- </data>
- <data name="ReflectionModel_ImportCollectionGetThrewException" xml:space="preserve">
- <value>Cannot populate the collection '{0}' because an exception occurred while trying to access the collection value. If the collection is not IEnumerable<T> or T[] it must implement ICollection<T> and be either pre-initialized or be writable with a default constructor.</value>
- </data>
- <data name="ReflectionModel_ImportCollectionAddThrewException" xml:space="preserve">
- <value>Cannot populate the collection '{0}' because an exception occurred while calling the Add method on the type '{1}'.</value>
- </data>
- <data name="ReflectionModel_ImportCollectionClearThrewException" xml:space="preserve">
- <value>Cannot populate the collection '{0}' because an exception occurred while calling the Clear method on the type '{1}'.</value>
- </data>
- <data name="ReflectionModel_ImportCollectionIsReadOnlyThrewException" xml:space="preserve">
- <value>Cannot populate the collection '{0}' because an exception occurred while reading the IsReadOnly property on the type '{1}'.</value>
- </data>
- <data name="ReflectionModel_ImportCollectionConstructionThrewException" xml:space="preserve">
- <value>Cannot populate the collection '{0}' because an exception occurred while calling the default constructor on the type '{1}'.</value>
- </data>
- <data name="CompositionTrace_Discovery_MemberMarkedWithMultipleImportAndImportMany" xml:space="preserve">
- <value>The member or parameter '{0}' is marked with multiple Import and ImportMany attributes. Only the first attribute encountered will be respected.</value>
- </data>
- <data name="Discovery_MetadataContainsValueWithInvalidType" xml:space="preserve">
- <value>Property '{0}' has type '{1}' which is an invalid metadata type. Metadata can only contain values with a type that is available to be embedded at compile-time into attributes. For more details of what types are valid reference section 17.1.3 in the C# specification.</value>
- </data>
- <data name="Discovery_DuplicateMetadataNameValues" xml:space="preserve">
- <value>Member or Type '{0}' contains multiple metadata entries with the name '{1}'. The metadata entries could be coming from the ExportMetadataAttribute or from a property of a custom metadata attribute. Either remove the duplicate entries or enable the metadata entry with name '{1}' to allow multiple entries via the IsMultiple property on ExportMetadataAttribute or AttributeUsage.AllowMultiple on custom metadata attributes.</value>
- </data>
- <data name="Discovery_ReservedMetadataNameUsed" xml:space="preserve">
- <value>Member or Type '{0}' contains a metadata entry with the name '{1}', which is a reserved metadata key name. Either remove this metadata entry or change the name associated with the entry.</value>
- </data>
- <data name="ReflectionModel_InvalidExportDefinition" xml:space="preserve">
- <value>ExportDefinition of type '{0}' cannot be used in this context. Only export definitions produced by the ReflectionModelServices.CreateExportDefinition are supported.</value>
- </data>
- <data name="ImportEngine_PreventedByExistingImport" xml:space="preserve">
- <value>Change in exports prevented by non-recomposable import '{0}' on part '{1}'.</value>
- </data>
- <data name="ReflectionModel_InvalidImportDefinition" xml:space="preserve">
- <value>ImportDefinition of type '{0}' cannot be used in this context. Only import definitions produced by the ReflectionModelServices.CreateImportDefinition are supported.</value>
- </data>
- <data name="ReflectionModel_InvalidPartDefinition" xml:space="preserve">
- <value>ComposablePartDefinition of type '{0}' cannot be used in this context. Only part definitions produced by the ReflectionModelServices.CreatePartDefinition are supported.</value>
- </data>
- <data name="ArgumentOutOfRange_InvalidEnumInSet" xml:space="preserve">
- <value>The value of argument '{0}' ({1}) is not supported. Allowed values are : '{2}'.</value>
- </data>
- <data name="ReflectionModel_InvalidMemberImportDefinition" xml:space="preserve">
- <value>ImportDefinition of type '{0}' cannot be used in this context. Only import definitions produced by the ReflectionModelServices.CreateImportDefinition based on members are supported. Use ReflectionModelServices.IsImportingParameter to determine whether a given import definition is based on a member or a parameter.</value>
- </data>
- <data name="ReflectionModel_InvalidParameterImportDefinition" xml:space="preserve">
- <value>ImportDefinition of type '{0}' cannot be used in this context. Only import definitions produced by the ReflectionModelServices.CreateImportDefinition based on parameters are supported. Use ReflectionModelServices.IsImportingParameter to determine whether a given import definition is based on a member or a parameter.</value>
- </data>
- <data name="LazyMemberInfo_AccessorsNull" xml:space="preserve">
- <value>Accessors must not be null (Nothing in Visual Basic).</value>
- </data>
- <data name="LazyMemberInfo_InvalidAccessorOnSimpleMember" xml:space="preserve">
- <value>A member of type '{0}' must have exactly a single accessor of type '{0}'</value>
- </data>
- <data name="LazyMemberinfo_InvalidEventAccessors_AccessorType" xml:space="preserve">
- <value>All event accessors must be methods.</value>
- </data>
- <data name="LazyMemberInfo_InvalidEventAccessors_Cardinality" xml:space="preserve">
- <value>An event must have exactly three accessors.</value>
- </data>
- <data name="LazyMemberinfo_InvalidPropertyAccessors_AccessorType" xml:space="preserve">
- <value>All property accessors must be methods.</value>
- </data>
- <data name="LazyMemberInfo_InvalidPropertyAccessors_Cardinality" xml:space="preserve">
- <value>A property must have exactly two accessors.</value>
- </data>
- <data name="LazyMemberInfo_NoAccessors" xml:space="preserve">
- <value>A member must have at least one accessor.</value>
- </data>
- <data name="LazyServices_LazyResolvesToNull" xml:space="preserve">
- <value>The lazily evaluated value of type '{0}' passed to the ReflectionModelServices API as part of the argument '{1}' must not return null (Nothing in Visual Basic).</value>
- </data>
- <data name="InvalidMetadataValue" xml:space="preserve">
- <value>Metadata can only contain values with a type that is available to be embedded at compile-time into attributes. For more details of what types are valid reference section 17.1.3 in the C# specification.</value>
- </data>
- <data name="ContractMismatch_InvalidCastOnMetadataField" xml:space="preserve">
- <value>Unable to create an Instance of the Metadata view '{0}' because the exporter exported the metadata for the item '{1}' with the value '{2}' as type '{3}' but the view imports it as type '{4}'.</value>
- </data>
- <data name="ContractMismatch_NullReferenceOnMetadataField" xml:space="preserve">
- <value>Unable to create an Instance of the Metadata view '{0}' because the exporter exported the metadata for the item '{1}' with a null value and null is not a valid value for type '{2}'.</value>
- </data>
- <data name="InvalidSetterOnMetadataField" xml:space="preserve">
- <value>The MetadataView '{0}' is invalid because property '{1}' has a property set method.</value>
- </data>
- <data name="CompositionException_ChangesRejected" xml:space="preserve">
- <value>The composition remains unchanged. The changes were rejected because of the following error(s): {0}</value>
- </data>
- <data name="ImportEngine_InvalidStateForRecomposition" xml:space="preserve">
- <value>The ComposablePart of type '{0}' cannot be recomposed because it is in an invalid state. It can only be recomposed if it has already been fully previewed or composed.</value>
- </data>
- <data name="AtomicComposition_AlreadyCompleted" xml:space="preserve">
- <value>The atomicComposition can no longer be changed because the atomicComposition has already been completed.</value>
- </data>
- <data name="AtomicComposition_PartOfAnotherAtomicComposition" xml:space="preserve">
- <value>The atomicComposition contains another inner atomicComposition and cannot be changed until the that inner atomicComposition has been completed.</value>
- </data>
- <data name="AtomicComposition_AlreadyNested" xml:space="preserve">
- <value>The atomicComposition is already contains an inner atomicComposition and cannot contain more than one atomicComposition at a time.</value>
- </data>
- <data name="ReentrantCompose" xml:space="preserve">
- <value>Currently composing another batch in this ComposablePartExportProvider. Only one batch can be composed at a time.</value>
- </data>
- <data name="ReflectionModel_ImportManyOnParameterCanOnlyBeAssigned" xml:space="preserve">
- <value>The importing constructor on type '{0}' is using ImportManyAttribute on parameter '{1}' with a non-assignable type. On constructor parameters the ImportManyAttribute only supports importing into types T[] or IEnumerable<T>.</value>
- </data>
- <data name="CompositionException_ElementPrefix" xml:space="preserve">
- <value>Element: {0}</value>
- </data>
- <data name="CompositionException_OriginSeparator" xml:space="preserve">
- <value>--> </value>
- </data>
- <data name="CompositionTrace_Rejection_DefinitionRejected" xml:space="preserve">
- <value>The ComposablePartDefinition '{0}' has been rejected. {1}</value>
- </data>
- <data name="CompositionTrace_Rejection_DefinitionResurrected" xml:space="preserve">
- <value>The ComposablePartDefinition '{0}' that was previously rejected has been resurrected.</value>
- </data>
- <data name="CompositionTrace_Discovery_AssemblyLoadFailed" xml:space="preserve">
- <value>The catalog '{0}' could not load assembly '{1}'. {2}</value>
- </data>
- <data name="CompositionTrace_Discovery_DefinitionContainsGenericParameters" xml:space="preserve">
- <value>The ComposablePartDefinition '{0}' was ignored because it is an open generic type.</value>
- </data>
- <data name="CompositionTrace_Discovery_DefinitionContainsNoExports" xml:space="preserve">
- <value>The ComposablePartDefinition '{0}' was ignored because it contains no exports.</value>
- </data>
- <data name="CompositionTrace_Discovery_DefinitionMarkedWithPartNotDiscoverableAttribute" xml:space="preserve">
- <value>The ComposablePartDefinition '{0}' was ignored because it was marked with PartNotDiscoverableAttribute.</value>
- </data>
- <data name="CompositionException_MetadataViewInvalidConstructor" xml:space="preserve">
- <value>Unable to create an instance of the Metadata view '{0}' because a constructor could not be selected. Ensure that the type implements a constructor which takes an argument of type IDictionary<string, object>.</value>
- </data>
- <data name="CompositionException_PathsCountSeparator" xml:space="preserve">
- <value>)</value>
- </data>
- <data name="CompositionException_OriginFormat" xml:space="preserve">
- <value> {0} {1}</value>
- </data>
- <data name="TypeCatalog_DisplayNameFormat" xml:space="preserve">
- <value>{0} (Types='{1}').</value>
- </data>
-</root>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/SuppressMessages.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/SuppressMessages.cs deleted file mode 100644 index dbe413bdbd6..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/SuppressMessages.cs +++ /dev/null @@ -1,10 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Diagnostics.CodeAnalysis;
-
-[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System.ComponentModel.Composition.ReflectionModel")]
-[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System")]
-[assembly: SuppressMessage("Microsoft.MSInternal", "CA905:SystemNamespacesRequireApproval", Scope = "namespace", Target = "System.ComponentModel.Composition.ReflectionModel", Justification = "Approved by Framework")]
-
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/SuppressMessagesBaselined.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/SuppressMessagesBaselined.cs deleted file mode 100644 index b2f62f7b20d..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/SuppressMessagesBaselined.cs +++ /dev/null @@ -1,659 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Diagnostics.CodeAnalysis;
-
-// The following are untriaged violations, do not add to this list unless you hit a bug in Code Analysis. Any explicitly
-// suppressed violations should either be applied against the member or type itself, or if raised against a namespace,
-// resource or assembly, placed in SuppressMessages.cs.
-
-// Code Analysis Bug: ValidateArgumentsOfPublicMethods should not fire on protected members
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#GetExportsCore(System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AggregateExportProvider.#GetExportsCore(System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-
-// Code Analysis Bug: ValidateArgumentsOfPublicMethods should not fire on usage of Requires.NotNull
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModelServices.#AddExportedValue`1(System.ComponentModel.Composition.Hosting.CompositionBatch,System.String,!!0)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModelServices.#AddPart(System.ComponentModel.Composition.Hosting.CompositionBatch,System.Object)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModelServices.#ComposeExportedValue`1(System.ComponentModel.Composition.Hosting.CompositionContainer,System.String,!!0)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModelServices.#ComposeExportedValue`1(System.ComponentModel.Composition.Hosting.CompositionContainer,!!0)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModelServices.#ComposeParts(System.ComponentModel.Composition.Hosting.CompositionContainer,System.Object[])")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModelServices.#SatisfyImportsOnce(System.ComponentModel.Composition.ICompositionService,System.Object)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider+CatalogChangeProxy.#GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#SourceProvider")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ComposablePartCatalog.#GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ComposablePartException.#GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#Compose(System.ComponentModel.Composition.Hosting.CompositionBatch)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionContainer.#ReleaseExports(System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.Export>)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionContainer.#ReleaseExports`2(System.Collections.Generic.IEnumerable`1<System.Lazy`2<!!0,!!1>>)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionContainer.#ReleaseExports`1(System.Collections.Generic.IEnumerable`1<System.Lazy`1<!!0>>)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.CompositionError.#.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.CompositionError.#GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition.#IsConstraintSatisfiedBy(System.ComponentModel.Composition.Primitives.ExportDefinition)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#OnExportsChanged(System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#OnExportsChanging(System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#.ctor(System.ComponentModel.Composition.Hosting.ExportProvider,System.Boolean)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo.#.ctor(System.Reflection.MemberInfo)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.#GetExportingMember(System.ComponentModel.Composition.Primitives.ExportDefinition)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.#GetImportingMember(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.#GetImportingParameter(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.#GetPartType(System.ComponentModel.Composition.Primitives.ComposablePartDefinition)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.#IsDisposalRequired(System.ComponentModel.Composition.Primitives.ComposablePartDefinition)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.#IsImportingParameter(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
-[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.TypeCatalog.#GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
-
-// DevDiv 10: 583413 AsmMeta: No longer finds APTCA bit on assemblies
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.Lazy`2", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.AttributedModelServices", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.ChangeRejectedException", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.CompositionContractMismatchException", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.CompositionError", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.CompositionException", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.CreationPolicy", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.ExportAttribute", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.ExportMetadataAttribute", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.ImportAttribute", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.ImportCardinalityMismatchException", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.ImportingConstructorAttribute", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.ImportManyAttribute", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.InheritedExportAttribute", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.MetadataAttributeAttribute", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.PartCreationPolicyAttribute", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.PartMetadataAttribute", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.PartNotDiscoverableAttribute", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.AdaptingExportProvider", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.AggregateCatalog", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.AggregateExportProvider", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.AssemblyCatalog", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.CompositionBatch", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.CompositionConstants", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.CompositionContainer", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Primitives.ExportedDelegate", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.ExportProvider", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.ImportEngine", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.TypeCatalog", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Primitives.Export", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Primitives.ExportDefinition", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Primitives.ComposablePart", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Primitives.ComposablePartCatalog", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Primitives.ComposablePartDefinition", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Primitives.ComposablePartException", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Primitives.ImportCardinality", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Primitives.ImportDefinition", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices", Justification = "Razzle mscorlib is not APTCA")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AggregateCatalog.#.ctor(System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePartCatalog>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AggregateCatalog.#Dispose(System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AggregateCatalog.#GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AggregateExportProvider.#.ctor(System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Hosting.ExportProvider>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AggregateExportProvider.#.ctor(System.ComponentModel.Composition.Hosting.ExportProvider[])")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AggregateExportProvider.#Dispose()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AggregateExportProvider.#Dispose(System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AggregateExportProvider.#GetExportsCore(System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AssemblyCatalog.#.ctor(System.Reflection.Assembly,System.ComponentModel.Composition.Primitives.ICompositionElement)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AssemblyCatalog.#Dispose(System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AssemblyCatalog.#GetDisplayName()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AssemblyCatalog.#InnerCatalog")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AssemblyCatalog.#LoadAssembly(System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AssemblyCatalogDebuggerProxy.#.ctor(System.ComponentModel.Composition.Hosting.AssemblyCatalog)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Assumes+InternalErrorException.#.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Assumes+InternalErrorException.#.ctor(System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Assumes.#NotNullOrEmpty(System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition.#AddCompleteAction(System.Action)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition.#AddRevertAction(System.Action)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition.#.ctor(System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition.#ContainsInnerAtomicComposition")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition.#CopyComplete()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition.#Dispose()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition.#Dispose(System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition.#FinalComplete()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition.#SetValueInternal(System.Object,System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition.#ThrowIfCompleteed()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition.#ThrowIfContainsInnerAtomicComposition()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition.#TryGetValueInternal`1(System.Object,System.Boolean,!!0&)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicCompositionExtensions.#AddCompleteActionAllowNull(System.ComponentModel.Composition.Hosting.AtomicComposition,System.Action)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicCompositionExtensions.#AddRevertActionAllowNull(System.ComponentModel.Composition.Hosting.AtomicComposition,System.Action)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModel.AttributedExportDefinition.#Metadata")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModel.AttributedModelDiscovery.#CreatePart(System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModel.AttributedModelDiscovery.#GetImportDefinitionCreationInfo(System.ComponentModel.Composition.ReflectionModel.ReflectionItem,System.Reflection.ICustomAttributeProvider)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModelServices.#AddExportedValue`1(System.ComponentModel.Composition.Hosting.CompositionBatch,System.String,!!0)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModelServices.#AddExportedValue`1(System.ComponentModel.Composition.Hosting.CompositionBatch,!!0)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModelServices.#ComposeParts(System.ComponentModel.Composition.Hosting.CompositionContainer,System.Object[])")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.#.ctor(System.Type,System.ComponentModel.Composition.PartCreationPolicyAttribute,System.Boolean,System.ComponentModel.Composition.Primitives.ICompositionElement)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.#GetConstructor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.#GetExportDefinitions()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.#GetImportDefinitions()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.#GetLazyPartType()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.#HasExports()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.#IsDisposalRequired")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.#IsPartDiscoverable()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.#SelectPartConstructor(System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.AttributeServices.#GetAttributes`1(System.Reflection.ICustomAttributeProvider)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.AttributeServices.#GetAttributes`1(System.Reflection.ICustomAttributeProvider,System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.AttributeServices.#GetFirstAttribute`1(System.Reflection.ICustomAttributeProvider)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.AttributeServices.#GetFirstAttribute`1(System.Reflection.ICustomAttributeProvider,System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.AttributeServices.#IsAttributeDefined`1(System.Reflection.ICustomAttributeProvider)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.AttributeServices.#IsAttributeDefined`1(System.Reflection.ICustomAttributeProvider,System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider+CatalogChangeProxy.#.ctor(System.ComponentModel.Composition.Primitives.ComposablePartCatalog,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePartDefinition>,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePartDefinition>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider+CatalogChangeProxy.#GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider+CatalogChangeProxy.#Parts")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#.ctor(System.ComponentModel.Composition.Primitives.ComposablePartCatalog,System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#DetermineRejection(System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#Dispose()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#Dispose(System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#EnsureCanRun()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#EnsureCanSet`1(!!0)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#EnsureRunning()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#GetAtomicCompositionQuery(System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#GetComposablePart(System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#GetExportsCore(System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#GetSharedPart(System.ComponentModel.Composition.Primitives.ComposablePartDefinition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#IsRejected(System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#OnCatalogChanging(System.Object,System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#OnExportsChangingInternal(System.Object,System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#ReleasePart(System.Object,System.ComponentModel.Composition.Primitives.ComposablePart,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#SetConditionalReferenceForRecomposablePart(System.Object,System.ComponentModel.Composition.Primitives.ComposablePart)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#SourceProvider")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#UpdateAtomicCompositionQuery(System.ComponentModel.Composition.Hosting.AtomicComposition,System.Func`2<System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.Boolean>,System.ComponentModel.Composition.Hosting.CatalogExportProvider+AtomicCompositionQueryState)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#UpdateRejections(System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ExportDefinition>,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ChangeRejectedException.#Message")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices.#AsArray`1(System.Collections.Generic.IEnumerable`1<!!0>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices+CollectionOfObject`1.#Add(System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices+CollectionOfObject`1.#Clear()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices+CollectionOfObject`1.#.ctor(System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices+CollectionOfObject`1.#IsReadOnly")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices+CollectionOfObjectList.#Add(System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices+CollectionOfObjectList.#Clear()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices+CollectionOfObjectList.#.ctor(System.Collections.IList)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices+CollectionOfObjectList.#IsReadOnly")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices.#ConcatAllowingNull`1(System.Collections.Generic.IEnumerable`1<!!0>,System.Collections.Generic.IEnumerable`1<!!0>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices.#Copy`1(System.Collections.Generic.Stack`1<!!0>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices.#FastAny`1(System.Collections.Generic.IEnumerable`1<!!0>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices.#ForEach`1(System.Collections.Generic.IEnumerable`1<!!0>,System.Action`1<!!0>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices.#GetCardinality`1(System.Collections.Generic.IEnumerable`1<!!0>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices.#GetCollectionElementType(System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices.#GetCollectionWrapper(System.Type,System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices.#GetEnumerableElementType(System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices.#ToReadOnlyCollection`1(System.Collections.Generic.IEnumerable`1<!!0>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices.#WhereNotNull`1(System.Collections.Generic.IEnumerable`1<!!0>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ComposablePart.#.ctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ComposablePartCatalog.#.ctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ComposablePartCatalog.#Dispose()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ComposablePartCatalog.#GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs.#.ctor(System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePartDefinition>,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePartDefinition>,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#Add(System.ComponentModel.Composition.Primitives.ComposablePartCatalog)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#Changed")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#Changing")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#Clear()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#.ctor(System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePartCatalog>,System.Action`1<System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs>,System.Action`1<System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#Contains(System.ComponentModel.Composition.Primitives.ComposablePartCatalog)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#CopyTo(System.ComponentModel.Composition.Primitives.ComposablePartCatalog[],System.Int32)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#Count")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#Dispose()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#Dispose(System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#GetEnumerator()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#HasChanged")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#OnChanged(System.Object,System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#OnChanging(System.Object,System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#OnContainedCatalogChanged(System.Object,System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#OnContainedCatalogChanging(System.Object,System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#RaiseChangedEvent(System.Lazy`1<System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePartDefinition>>,System.Lazy`1<System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePartDefinition>>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#RaiseChangingEvent(System.Lazy`1<System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePartDefinition>>,System.Lazy`1<System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePartDefinition>>,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#Remove(System.ComponentModel.Composition.Primitives.ComposablePartCatalog)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#SubscribeToCatalogNotifications(System.ComponentModel.Composition.Primitives.ComposablePartCatalog)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#SubscribeToCatalogNotifications(System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePartCatalog>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#UnsubscribeFromCatalogNotifications(System.ComponentModel.Composition.Primitives.ComposablePartCatalog)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#UnsubscribeFromCatalogNotifications(System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePartCatalog>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ComposablePartCatalogDebuggerProxy.#.ctor(System.ComponentModel.Composition.Primitives.ComposablePartCatalog)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ComposablePartDefinition.#.ctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ComposablePartException.#.ctor(System.ComponentModel.Composition.CompositionErrorId,System.String,System.ComponentModel.Composition.Primitives.ICompositionElement,System.Exception)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ComposablePartException.#.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ComposablePartException.#GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#.ctor(System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#Compose(System.ComponentModel.Composition.Hosting.CompositionBatch)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#CreateExport(System.ComponentModel.Composition.Primitives.ComposablePart,System.ComponentModel.Composition.Primitives.ExportDefinition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#Dispose()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#Dispose(System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#EnsureCanRun()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#EnsureCanSet`1(!!0)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#EnsureRunning()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#GetExportsCore(System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#GetUpdatedPartsList(System.ComponentModel.Composition.Hosting.CompositionBatch)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#Recompose(System.ComponentModel.Composition.Hosting.CompositionBatch,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#SourceProvider")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#ThrowIfDisposed()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionBatch.#AddPart(System.ComponentModel.Composition.Primitives.ComposablePart)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionBatch.#.ctor(System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePart>,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePart>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionBatch.#PartsToAdd")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionBatch.#PartsToRemove")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionBatch.#RemovePart(System.ComponentModel.Composition.Primitives.ComposablePart)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionBatch+SingleExportComposablePart.#ImportDefinitions")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionContainer.#.ctor(System.ComponentModel.Composition.Primitives.ComposablePartCatalog,System.Boolean,System.ComponentModel.Composition.Hosting.ExportProvider[])")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionContainer.#Dispose()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionContainer.#Dispose(System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionContainer.#ReleaseExport(System.ComponentModel.Composition.Primitives.Export)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionContainer.#ReleaseExport`1(System.Lazy`1<!!0>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionContainer.#ReleaseExports(System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.Export>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionContainer.#ReleaseExports`2(System.Collections.Generic.IEnumerable`1<System.Lazy`2<!!0,!!1>>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionContainer.#ReleaseExports`1(System.Collections.Generic.IEnumerable`1<System.Lazy`1<!!0>>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionContractMismatchException.#.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionContractMismatchException.#.ctor(System.String,System.Exception)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.CompositionElement.#.ctor(System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.CompositionElementDebuggerProxy.#.ctor(System.ComponentModel.Composition.Primitives.CompositionElement)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.CompositionElementExtensions.#GetDisplayNameCore(System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionError.#.ctor(System.ComponentModel.Composition.CompositionErrorId,System.String,System.ComponentModel.Composition.Primitives.ICompositionElement,System.Exception)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionError.#.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionError.#Create(System.ComponentModel.Composition.CompositionErrorId,System.ComponentModel.Composition.Primitives.ICompositionElement,System.Exception,System.String,System.Object[])")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionError.#GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionErrorDebuggerProxy.#.ctor(System.ComponentModel.Composition.CompositionError)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#BuildDefaultMessage()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#CalculatePaths(System.ComponentModel.Composition.CompositionException)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#.ctor(System.String,System.Exception,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.CompositionError>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#Message")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#VisitCompositionException(System.ComponentModel.Composition.CompositionException,System.ComponentModel.Composition.CompositionException+VisitContext)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#VisitError(System.ComponentModel.Composition.CompositionError,System.ComponentModel.Composition.CompositionException+VisitContext)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#VisitException(System.Exception,System.ComponentModel.Composition.CompositionException+VisitContext)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#WriteElementGraph(System.Text.StringBuilder,System.ComponentModel.Composition.Primitives.ICompositionElement)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#WriteError(System.Text.StringBuilder,System.ComponentModel.Composition.CompositionError)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#WriteHeader(System.Text.StringBuilder,System.Int32,System.Int32)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#WritePath(System.Text.StringBuilder,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.CompositionError>,System.Int32)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#WritePaths(System.Text.StringBuilder,System.Collections.Generic.IEnumerable`1<System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.CompositionError>>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionLock.#.cctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionLock.#.ctor(System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionLock+CompositionLockHolder.#.ctor(System.ComponentModel.Composition.Hosting.CompositionLock)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionLock+CompositionLockHolder.#Dispose()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionLock.#Dispose()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionLock+EmptyLockHolder.#.ctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionLock.#EnterCompositionLock()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionLock.#ExitCompositionLock()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionResult.#Errors")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionResult`1.#Errors")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#.cctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#GetContractNameFromExport(System.Reflection.MemberInfo,System.ComponentModel.Composition.ExportAttribute)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#GetContractNameFromImport(System.ComponentModel.Composition.IAttributedImport,System.ComponentModel.Composition.ReflectionModel.ImportType)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#GetContractTypeFromImport(System.ComponentModel.Composition.IAttributedImport,System.ComponentModel.Composition.ReflectionModel.ImportType)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#GetDefaultTypeFromMember(System.Reflection.MemberInfo)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#GetPartMetadataForType(System.Type,System.ComponentModel.Composition.CreationPolicy)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#GetRequiredMetadata(System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#GetTypeIdentityFromExport(System.Reflection.MemberInfo,System.ComponentModel.Composition.ExportAttribute)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#GetTypeIdentityFromImport(System.ComponentModel.Composition.IAttributedImport,System.ComponentModel.Composition.ReflectionModel.ImportType)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#IsRecomposable(System.ComponentModel.Composition.Primitives.ComposablePart)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#IsValidAttributeType(System.Type,System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices+MetadataList.#Add(System.Object,System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices+MetadataList.#InferArrayType(System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices+MetadataList.#.ctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices+MetadataList.#.cctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices+MetadataList.#ToArray()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#TryContributeMetadataValue(System.Collections.Generic.IDictionary`2<System.String,System.Object>,System.String,System.Object,System.Type,System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#TryExportMetadataForMember(System.Reflection.MemberInfo,System.Collections.Generic.IDictionary`2<System.String,System.Object>&)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#TryFire`1(System.EventHandler`1<!!0>,System.Object,!!0)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#TryInvoke(System.Action)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#TryInvoke`1(System.Func`1<!!0>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Diagnostics.CompositionTrace.#AssemblyLoadFailed(System.ComponentModel.Composition.Hosting.DirectoryCatalog,System.String,System.Exception)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Diagnostics.CompositionTrace.#PartDefinitionRejected(System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.ComponentModel.Composition.ChangeRejectedException)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ConstraintServices.#AndAlso`1(System.Linq.Expressions.Expression`1<System.Func`2<!!0,System.Boolean>>,System.Linq.Expressions.Expression`1<System.Func`2<!!0,System.Boolean>>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ConstraintServices.#.cctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ConstraintServices.#CreateConstraint(System.Collections.Generic.IEnumerable`1<System.Collections.Generic.KeyValuePair`2<System.String,System.Type>>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ConstraintServices.#CreateConstraint(System.String,System.String,System.Collections.Generic.IEnumerable`1<System.Collections.Generic.KeyValuePair`2<System.String,System.Type>>,System.ComponentModel.Composition.CreationPolicy)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ConstraintServices.#CreateContractConstraintBody(System.String,System.Linq.Expressions.ParameterExpression)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ConstraintServices.#CreateCreationPolicyContraint(System.ComponentModel.Composition.CreationPolicy,System.Linq.Expressions.ParameterExpression)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ConstraintServices.#CreateMetadataConstraintBody(System.Collections.Generic.IEnumerable`1<System.Collections.Generic.KeyValuePair`2<System.String,System.Type>>,System.Linq.Expressions.ParameterExpression)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ConstraintServices.#CreateMetadataContainsKeyExpression(System.Linq.Expressions.ParameterExpression,System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ConstraintServices.#CreateMetadataOfTypeExpression(System.Linq.Expressions.ParameterExpression,System.String,System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ConstraintServices.#CreateMetadataValueEqualsExpression(System.Linq.Expressions.ParameterExpression,System.Object,System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ConstraintServices.#CreateTypeIdentityContraint(System.String,System.Linq.Expressions.ParameterExpression)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition.#.ctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition.#.ctor(System.String,System.String,System.Collections.Generic.IEnumerable`1<System.Collections.Generic.KeyValuePair`2<System.String,System.Type>>,System.ComponentModel.Composition.Primitives.ImportCardinality,System.Boolean,System.Boolean,System.ComponentModel.Composition.CreationPolicy)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition.#IsConstraintSatisfiedBy(System.ComponentModel.Composition.Primitives.ExportDefinition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition.#MatchRequiredMatadata(System.ComponentModel.Composition.Primitives.ExportDefinition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#FindArrayElementType(System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#FindGenericTypeName(System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#GetGenericArity(System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#GetTypeIdentity(System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#GetTypeIdentityFromMethod(System.Reflection.MethodInfo)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#TypeIdentityCache")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#WriteArrayType(System.Text.StringBuilder,System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#WriteArrayTypeDimensions(System.Text.StringBuilder,System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#WriteByRefType(System.Text.StringBuilder,System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#WriteCustomModifiers(System.Text.StringBuilder,System.String,System.Type[])")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#WriteGenericType(System.Text.StringBuilder,System.Type,System.Boolean,System.Collections.Generic.Queue`1<System.Type>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#WriteGenericTypeName(System.Text.StringBuilder,System.Type,System.Boolean,System.Collections.Generic.Queue`1<System.Type>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#WriteNonGenericType(System.Text.StringBuilder,System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#WritePointerType(System.Text.StringBuilder,System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#WriteType(System.Text.StringBuilder,System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#WriteTypeArgumentsString(System.Text.StringBuilder,System.Int32,System.Boolean,System.Collections.Generic.Queue`1<System.Type>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#WriteTypeWithNamespace(System.Text.StringBuilder,System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ContractServices.#.ctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ContractServices.#TryCast(System.Type,System.Object,System.Object&)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#Changed")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#Changing")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#DiffChanges(System.String[],System.String[],System.Collections.Generic.List`1<System.Tuple`2<System.String,System.ComponentModel.Composition.Hosting.AssemblyCatalog>>&,System.Collections.Generic.List`1<System.Tuple`2<System.String,System.ComponentModel.Composition.Hosting.AssemblyCatalog>>&)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog+DirectoryCatalogDebuggerProxy.#Assemblies")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog+DirectoryCatalogDebuggerProxy.#.ctor(System.ComponentModel.Composition.Hosting.DirectoryCatalog)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#Dispose(System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#GetDisplayName()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#GetFiles()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#GetFullPath(System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#Initialize(System.String,System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#LoadedFiles")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#OnChanged(System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#OnChanging(System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#Refresh()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.DisposableReflectionComposablePart.#System.IDisposable.Dispose()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.DisposableReflectionComposablePart.#ReleaseInstanceIfNecessary(System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ErrorBuilder.#CreateImportCardinalityMismatch(System.ComponentModel.Composition.ImportCardinalityMismatchException,System.ComponentModel.Composition.Primitives.ImportDefinition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExceptionBuilder.#CreateContainsNullElement(System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExceptionBuilder.#CreateDiscoveryException(System.String,System.String[])")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExceptionBuilder.#CreateExportDefinitionNotOnThisComposablePart(System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExceptionBuilder.#CreateImportDefinitionNotOnThisComposablePart(System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExceptionBuilder.#CreateNotOverriddenByDerived(System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExceptionBuilder.#CreateObjectDisposed(System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExceptionBuilder.#Format(System.String,System.String[])")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.Export.#.cctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.Export.#.ctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.Export.#.ctor(System.ComponentModel.Composition.Primitives.ExportDefinition,System.Func`1<System.Object>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.Export.#GetExportedValueCore()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.Export.#Value")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportAttribute.#.ctor(System.String,System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ExportDefinition.#.ctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ExportDefinition.#.ctor(System.String,System.Collections.Generic.IDictionary`2<System.String,System.Object>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ExportedDelegate.#ConvertMethodInfoToFuncOrActionType(System.Reflection.MethodInfo)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ExportedDelegate.#CreateDelegate(System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ExportedDelegate.#.ctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ExportedDelegate.#.cctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ExportedDelegate.#.ctor(System.Object,System.Reflection.MethodInfo)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ExportingMember.#EnsureReadable()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ExportingMember.#.ctor(System.ComponentModel.Composition.Primitives.ExportDefinition,System.ComponentModel.Composition.ReflectionModel.ReflectionMember)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ExportingMember.#GetExportedValue(System.Object,System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportMetadataAttribute.#.ctor(System.String,System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#BuildImportDefinition(System.Type,System.Type,System.String,System.ComponentModel.Composition.Primitives.ImportCardinality)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#.ctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#ExportsChanged")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#ExportsChanging")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#GetExportCore`2(System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#GetExportCore`1(System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#GetExportedValueCore`1(System.String,System.ComponentModel.Composition.Primitives.ImportCardinality)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#GetExportedValuesCore`1(System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#GetExports(System.Type,System.Type,System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#GetExportsCore(System.Type,System.Type,System.String,System.ComponentModel.Composition.Primitives.ImportCardinality)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#GetExportsCore`2(System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#GetExportsCore`1(System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#TryGetExportsCore(System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.Export>&)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs.#ChangedContractNames")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs.#.ctor(System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ExportDefinition>,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ExportDefinition>,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportServices.#CreateSemiStronglyTypedExport`2(System.ComponentModel.Composition.Primitives.Export)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportServices.#CreateSemiStronglyTypedExportFactory(System.Type,System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportServices.#CreateStronglyTypedExportFactory(System.Type,System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportServices.#CreateStronglyTypedExportOfT`1(System.ComponentModel.Composition.Primitives.Export)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportServices.#CreateStronglyTypedExportOfTM`2(System.ComponentModel.Composition.Primitives.Export)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportServices+DisposableLazy`2.#System.IDisposable.Dispose()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportServices+DisposableLazy`1.#.ctor(System.Func`1<!0>,System.IDisposable)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportServices+DisposableLazy`1.#System.IDisposable.Dispose()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportServices.#.cctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportServices.#GetExportedValueFromLazy`1(System.ComponentModel.Composition.Primitives.Export)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportServices.#IsDefaultMetadataViewType(System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportServices.#IsDictionaryConstructorViewType(System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#AddItemToLocalDictionary(System.Reflection.Emit.ILGenerator,System.Reflection.Emit.LocalBuilder,System.Object,System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#AddLocalToLocalDictionary(System.Reflection.Emit.ILGenerator,System.Reflection.Emit.LocalBuilder,System.Object,System.Reflection.Emit.LocalBuilder)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#CreateGeneratorForPublicConstructor(System.Reflection.Emit.TypeBuilder,System.Type[])")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#.cctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#GetExceptionDataAndStoreInLocal(System.Reflection.Emit.ILGenerator,System.Reflection.Emit.LocalBuilder,System.Reflection.Emit.LocalBuilder)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#IsBoxingRequiredForValue(System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#LoadDouble(System.Reflection.Emit.ILGenerator,System.Double)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#LoadEnumerable(System.Reflection.Emit.ILGenerator,System.Collections.IEnumerable)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#LoadFloat(System.Reflection.Emit.ILGenerator,System.Single)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#LoadInt(System.Reflection.Emit.ILGenerator,System.Int32)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#LoadLong(System.Reflection.Emit.ILGenerator,System.Int64)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#LoadNull(System.Reflection.Emit.ILGenerator)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#LoadString(System.Reflection.Emit.ILGenerator,System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#LoadTypeOf(System.Reflection.Emit.ILGenerator,System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#LoadValue(System.Reflection.Emit.ILGenerator,System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ImportAttribute.#.ctor(System.String,System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ImportCardinalityMismatchException.#.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ImportCardinalityMismatchException.#.ctor(System.String,System.Exception)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ImportDefinition.#.ctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ImportDefinition.#.ctor(System.String,System.ComponentModel.Composition.Primitives.ImportCardinality,System.Boolean,System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ImportDefinition.#IsConstraintSatisfiedBy(System.ComponentModel.Composition.Primitives.ExportDefinition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ImportDefinition.#ToString()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#Dispose()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#Dispose(System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+EngineContext.#AddPartManager(System.ComponentModel.Composition.Hosting.ImportEngine+PartManager)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+EngineContext.#Complete()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+EngineContext.#.ctor(System.ComponentModel.Composition.Hosting.ImportEngine,System.ComponentModel.Composition.Hosting.ImportEngine+EngineContext)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+EngineContext.#RemovePartManager(System.ComponentModel.Composition.Hosting.ImportEngine+PartManager)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#GetEngineContext(System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#GetPartManager(System.ComponentModel.Composition.Primitives.ComposablePart,System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#.ctor(System.ComponentModel.Composition.Hosting.ExportProvider,System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#InPrerequisiteLoop()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#OnExportsChanging(System.Object,System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+PartManager.#DisposeAllDependencies()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+PartManager.#GetImportedContractNames()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+PartManager.#GetSavedImport(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+PartManager.#.ctor(System.ComponentModel.Composition.Hosting.ImportEngine,System.ComponentModel.Composition.Primitives.ComposablePart)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+PartManager.#SetSavedImport(System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Primitives.Export[],System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+PartManager.#State")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+PartManager.#UpdateDisposableDependencies(System.ComponentModel.Composition.Primitives.ImportDefinition,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.Export>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#PreviewImports(System.ComponentModel.Composition.Primitives.ComposablePart,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+RecompositionManager.#AddIndexEntries(System.ComponentModel.Composition.Hosting.ImportEngine+PartManager)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+RecompositionManager.#GetAffectedImports(System.ComponentModel.Composition.Primitives.ComposablePart,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ExportDefinition>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+RecompositionManager.#GetAffectedParts(System.Collections.Generic.IEnumerable`1<System.String>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+RecompositionManager.#GetPartsImporting(System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+RecompositionManager.#IsAffectedImport(System.ComponentModel.Composition.Primitives.ImportDefinition,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ExportDefinition>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+RecompositionManager.#.ctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+RecompositionManager.#RemoveIndexEntries(System.ComponentModel.Composition.Hosting.ImportEngine+PartManager)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+RecompositionManager.#UpdateImportIndex()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#ReleaseImports(System.ComponentModel.Composition.Primitives.ComposablePart,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#SatisfyImports(System.ComponentModel.Composition.Primitives.ComposablePart)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#SatisfyImportsOnce(System.ComponentModel.Composition.Primitives.ComposablePart)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#StopSatisfyingImports(System.ComponentModel.Composition.Hosting.ImportEngine+PartManager,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#TryPreviewImportsStateMachine(System.ComponentModel.Composition.Hosting.ImportEngine+PartManager,System.ComponentModel.Composition.Primitives.ComposablePart,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#TryRecomposeImport(System.ComponentModel.Composition.Hosting.ImportEngine+PartManager,System.Boolean,System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#TryRecomposeImports(System.ComponentModel.Composition.Hosting.ImportEngine+PartManager,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ExportDefinition>,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#TrySatisfyImports(System.ComponentModel.Composition.Hosting.ImportEngine+PartManager,System.ComponentModel.Composition.Primitives.ComposablePart,System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#TrySatisfyImportsStateMachine(System.ComponentModel.Composition.Hosting.ImportEngine+PartManager,System.ComponentModel.Composition.Primitives.ComposablePart)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#TrySatisfyImportSubset(System.ComponentModel.Composition.Hosting.ImportEngine+PartManager,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ImportDefinition>,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ImportingConstructorAttribute.#.ctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportingItem.#Cast(System.Type,System.ComponentModel.Composition.Primitives.Export)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportingItem.#CastExportsToCollectionImportType(System.ComponentModel.Composition.Primitives.Export[])")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportingItem.#.ctor(System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition,System.ComponentModel.Composition.ReflectionModel.ImportType)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportingMember.#EnsureCollectionIsWritable(System.Collections.Generic.ICollection`1<System.Object>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportingMember.#EnsureWritable()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportingMember.#GetNormalizedCollection(System.Type,System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportingMember.#PopulateCollection(System.Collections.Generic.ICollection`1<System.Object>,System.Collections.IEnumerable)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportingMember.#SetCollectionMemberValue(System.Object,System.Collections.IEnumerable)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportingMember.#SetSingleMemberValue(System.Object,System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ImportManyAttribute.#.ctor(System.String,System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportType.#CreateLazyType(System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportType.#GetStronglyTypedExport(System.ComponentModel.Composition.Primitives.Export)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportType.#.ctor(System.Type,System.ComponentModel.Composition.Primitives.ImportCardinality)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportType.#IsTypeAssignableCollectionType(System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportType+SpecificLazyType.#.ctor(System.Type,System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.Lazy`2.#.ctor(System.Func`1<!0>,!1)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.Lazy`2.#.ctor(System.Func`1<!0>,!1,System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.Lazy`2.#.ctor(!1)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.Lazy`2.#.ctor(!1,System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo.#AreAccessorsValid(System.Reflection.MemberTypes,System.Reflection.MemberInfo[],System.String&)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo.#Equals(System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo.#GetAccessors()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo.#GetHashCode()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo.#.ctor(System.Reflection.MemberInfo)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo.#.ctor(System.Reflection.MemberTypes,System.Reflection.MemberInfo[])")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo.#op_Inequality(System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo,System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo.#op_Equality(System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo,System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.LazyServices.#AsLazy`1(!!0)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.LazyServices.#GetNotNullValue`1(System.Lazy`1<!!0>,System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Lock.#Dispose()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Lock.#EnterReadLock()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Lock.#EnterWriteLock()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Lock.#ExitReadLock()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Lock.#ExitWriteLock()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Lock.#.ctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.MetadataAttributeAttribute.#.ctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.MetadataServices.#GetValue`1(System.Collections.Generic.IDictionary`2<System.String,System.Object>,System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.MetadataViewGenerator.#GenerateFieldAssignmentFromLocalValue(System.Reflection.Emit.ILGenerator,System.Reflection.Emit.LocalBuilder,System.Reflection.Emit.FieldBuilder)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.MetadataViewGenerator.#GenerateInterfaceViewProxyType(System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.MetadataViewGenerator.#GenerateLocalAssignmentFromDefaultAttribute(System.Reflection.Emit.ILGenerator,System.ComponentModel.DefaultValueAttribute[],System.Reflection.Emit.LocalBuilder)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.MetadataViewGenerator.#GenerateLocalAssignmentFromFlag(System.Reflection.Emit.ILGenerator,System.Reflection.Emit.LocalBuilder,System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.MetadataViewGenerator.#GenerateView(System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.MetadataViewGenerator.#.cctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.MetadataViewProvider.#GetMetadataView`1(System.Collections.Generic.IDictionary`2<System.String,System.Object>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.MetadataViewProvider.#IsViewTypeValid(System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.PartCreationPolicyAttribute.#.ctor(System.ComponentModel.Composition.CreationPolicy)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.PartMetadataAttribute.#.ctor(System.String,System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.PartNotDiscoverableAttribute.#.ctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReadLock.#Dispose()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#Contains(System.Collections.Generic.KeyValuePair`2<!0,!1>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#ContainsKey(!0)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#CopyTo(System.Collections.Generic.KeyValuePair`2<!0,!1>[],System.Int32)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#Count")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#GetEnumerator()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#System.Collections.Generic.ICollection`1<System.Collections.Generic.KeyValuePair`2<!0,!1>>.Add(System.Collections.Generic.KeyValuePair`2<!0,!1>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#System.Collections.Generic.ICollection`1<System.Collections.Generic.KeyValuePair`2<!0,!1>>.Clear()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#System.Collections.Generic.ICollection`1<System.Collections.Generic.KeyValuePair`2<!0,!1>>.Remove(System.Collections.Generic.KeyValuePair`2<!0,!1>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#System.Collections.Generic.IDictionary`2<!0,!1>.Add(!0,!1)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#System.Collections.Generic.IDictionary`2<!0,!1>.Remove(!0)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#System.Collections.IEnumerable.GetEnumerator()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#Keys")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#.ctor(System.Collections.Generic.IDictionary`2<!0,!1>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#Item[!0]")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#TryGetValue(!0,!1&)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#Values")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionaryDebuggerProxy`2.#Items")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionaryDebuggerProxy`2.#.ctor(Microsoft.Internal.Collections.ReadOnlyDictionary`2<!0,!1>)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#Activate()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#CachedInstance")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#CreateInstance(System.Reflection.ConstructorInfo,System.Object[])")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#EnsureCardinality(System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Primitives.Export[])")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#EnsureGettable()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#EnsureSettable(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#GetConstructorArguments()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#GetExportedValue(System.ComponentModel.Composition.Primitives.ExportDefinition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#GetExportingMemberFromDefinition(System.ComponentModel.Composition.Primitives.ExportDefinition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#GetImportingItemFromDefinition(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#GetInstanceActivatingIfNeeded()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#NotifyImportSatisfied()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#.ctor(System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePartDefinition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#.ctor(System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePartDefinition,System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#RequiresActivation()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#SetImport(System.ComponentModel.Composition.ReflectionModel.ImportingItem,System.ComponentModel.Composition.Primitives.Export[])")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#SetNonPrerequisiteImports()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#TryGetImportValue(System.ComponentModel.Composition.Primitives.ImportDefinition,System.Object&)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#UseImportedValues`1(System.Collections.Generic.IEnumerable`1<!!0>,System.Action`3<System.ComponentModel.Composition.ReflectionModel.ImportingItem,!!0,System.Object>,System.Boolean)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePartDefinition.#ExportDefinitions")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePartDefinition.#GetConstructor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePartDefinition.#ImportDefinitions")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePartDefinition.#Metadata")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePartDefinition.#.ctor(System.ComponentModel.Composition.ReflectionModel.IReflectionPartCreationInfo)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionExtensions.#CreateReflectionProperty(System.Reflection.MethodInfo,System.Reflection.MethodInfo)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionExtensions.#ToLazyMember(System.Reflection.MemberInfo)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionExtensions.#ToLazyMember(System.ComponentModel.Composition.ReflectionModel.ReflectionMember)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionExtensions.#ToReflectionProperty(System.Reflection.PropertyInfo)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionExtensions.#ToReflectionWritableMember(System.Reflection.MemberInfo)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionField.#CanWrite")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionField.#GetValue(System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionField.#RequiresInstance")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionField.#ReturnType")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionField.#SetValue(System.Object,System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionItem.#.ctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionMember.#DeclaringType")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionMember.#Name")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionMemberExportDefinition.#GetDisplayName()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionMemberImportDefinition.#GetDisplayName()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionMethod.#RequiresInstance")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionMethod.#ReturnType")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.#GetExportingMember(System.ComponentModel.Composition.Primitives.ExportDefinition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.#GetImportingMember(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.#GetImportingParameter(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.#GetPartType(System.ComponentModel.Composition.Primitives.ComposablePartDefinition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.#IsDisposalRequired(System.ComponentModel.Composition.Primitives.ComposablePartDefinition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.#IsImportingParameter(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices+LazyExportDefinition.#Metadata")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices+ReflectionPartCreationInfo.#GetConstructor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices+ReflectionPartCreationInfo.#GetMetadata()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices+ReflectionPartCreationInfo.#.ctor(System.Lazy`1<System.Type>,System.Boolean,System.Lazy`1<System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ImportDefinition>>,System.Lazy`1<System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ExportDefinition>>,System.Lazy`1<System.Collections.Generic.IDictionary`2<System.String,System.Object>>,System.ComponentModel.Composition.Primitives.ICompositionElement)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionParameter.#GetDisplayName()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionParameter.#Name")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionParameter.#ReturnType")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionParameterImportDefinition.#GetDisplayName()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionParameterImportDefinition.#ToImportingItem()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionProperty.#CanRead")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionProperty.#CanWrite")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionProperty.#GetValue(System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionProperty.#Name")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionProperty.#.ctor(System.Reflection.MethodInfo,System.Reflection.MethodInfo)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionProperty.#RequiresInstance")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionProperty.#ReturnType")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionProperty.#SetValue(System.Object,System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionServices.#GetAllProperties(System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionServices.#GetDisplayName(System.Reflection.MemberInfo)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionServices.#GetDisplayName(System.Type,System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionServices.#TryGetGenericInterfaceType(System.Type,System.Type,System.Type&)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Requires.#IsInMembertypeSet(System.Reflection.MemberTypes,System.String,System.Reflection.MemberTypes)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Requires.#NotNull`1(!!0,System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Requires.#NotNullElements`1(System.Collections.Generic.IEnumerable`1<!!0>,System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Requires.#NotNullElements`2(System.Collections.Generic.IEnumerable`1<System.Collections.Generic.KeyValuePair`2<!!0,!!1>>,System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Requires.#NotNullOrEmpty(System.String,System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.SerializableCompositionElement.#.ctor(System.String,System.ComponentModel.Composition.Primitives.ICompositionElement)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Runtime.Serialization.SerializationServices.#GetValue`1(System.Runtime.Serialization.SerializationInfo,System.String)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.StringComparers.#ContractName")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.StringComparers.#MetadataKeyNames")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Diagnostics.TraceSourceTraceWriter.#CanWriteError")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Diagnostics.TraceSourceTraceWriter.#CanWriteInformation")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Diagnostics.TraceSourceTraceWriter.#CanWriteWarning")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Diagnostics.TraceSourceTraceWriter.#.cctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Diagnostics.TraceSourceTraceWriter.#WriteEvent(System.Diagnostics.TraceEventType,System.ComponentModel.Composition.Diagnostics.CompositionTraceId,System.String,System.Object[])")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Diagnostics.TraceWriter.#.ctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.TypeCatalog.#CreateIndex()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.TypeCatalog.#GetCandidateParts(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.TypeCatalog.#GetDisplayName()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.TypeCatalog.#GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.TypeCatalog.#GetTypesDisplay()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.TypeCatalog.#PartsInternal")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.TypeCatalog.#.ctor(System.Collections.Generic.IEnumerable`1<System.Type>,System.ComponentModel.Composition.Primitives.ICompositionElement)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.WeakReferenceCollection`1.#Add(!0)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.WeakReferenceCollection`1.#AliveItemsToList()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.WeakReferenceCollection`1.#CleanupDeadReferences()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.WeakReferenceCollection`1.#Clear()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.WeakReferenceCollection`1.#IndexOf(!0)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.WeakReferenceCollection`1.#Remove(!0)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.WeakReferenceCollection`1.#.ctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.WriteLock.#Dispose()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition.#ValidateRequiredMetadata()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.LazyExportDefinition.#Metadata")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionInvoke.#DemandMemberAccess(System.Reflection.MemberInfo)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionInvoke.#DemandMemberAccessIfNeeded(System.Type)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionInvoke.#DemandRestrictedMemberAccess(System.Reflection.MemberInfo)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionInvoke.#.cctor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionInvoke.#SafeCreateInstance(System.Type,System.Object[])")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionInvoke.#SafeGetValue(System.Reflection.FieldInfo,System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionInvoke.#SafeInvoke(System.Reflection.ConstructorInfo,System.Object[])")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionInvoke.#SafeInvoke(System.Reflection.MethodInfo,System.Object,System.Object[])")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionInvoke.#SafeSetValue(System.Reflection.FieldInfo,System.Object,System.Object)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionInvoke.#UnsafePermissionSet(System.Reflection.Assembly)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionPartCreationInfo.#GetConstructor()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionPartCreationInfo.#GetMetadata()")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionPartCreationInfo.#.ctor(System.Lazy`1<System.Type>,System.Boolean,System.Lazy`1<System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ImportDefinition>>,System.Lazy`1<System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ExportDefinition>>,System.Lazy`1<System.Collections.Generic.IDictionary`2<System.String,System.Object>>,System.ComponentModel.Composition.Primitives.ICompositionElement)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionServices.#Assembly(System.Reflection.MemberInfo)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionServices.#IsVisible(System.Reflection.ConstructorInfo)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionServices.#IsVisible(System.Reflection.FieldInfo)")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionServices.#IsVisible(System.Reflection.MethodInfo)")]
-[module: SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors", Scope = "type", Target = "System.ComponentModel.Composition.ChangeRejectedException")]
-[module: SuppressMessage("Microsoft.Usage", "CA2240:ImplementISerializableCorrectly", Scope = "type", Target = "System.ComponentModel.Composition.CompositionException")]
-[module: SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors", Scope = "type", Target = "System.ComponentModel.Composition.CompositionException")]
-[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException+CompositionExceptionData.#System.Runtime.Serialization.ISafeSerializationData.CompleteDeserialization(System.Object)")]
-
-
-
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/.gitattributes b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/.gitattributes deleted file mode 100644 index 8381eda809e..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -/Lazy.cs -crlf -/LazyOfTTMetadata.cs -crlf -/Tuple.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/.gitattributes b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/.gitattributes deleted file mode 100644 index cd15fcf2076..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/.gitattributes +++ /dev/null @@ -1,38 +0,0 @@ -/AttributedModelServices.cs -crlf -/ChangeRejectedException.cs -crlf -/CompositionContractMismatchException.cs -crlf -/CompositionError.cs -crlf -/CompositionErrorDebuggerProxy.cs -crlf -/CompositionErrorId.cs -crlf -/CompositionException.cs -crlf -/CompositionResult.cs -crlf -/CompositionResultOfT.cs -crlf -/ConstraintServices.cs -crlf -/ContractNameServices.cs -crlf -/CreationPolicy.cs -crlf -/ErrorBuilder.cs -crlf -/ExceptionBuilder.cs -crlf -/ExportAttribute.cs -crlf -/ExportCardinalityCheckResult.cs -crlf -/ExportMetadataAttribute.cs -crlf -/ExportServices.DisposableLazy.cs -crlf -/ExportServices.cs -crlf -/IAttributedImport.cs -crlf -/ICompositionError.cs -crlf -/ICompositionService.cs -crlf -/IPartImportsSatisfiedNotification.cs -crlf -/ImportAttribute.cs -crlf -/ImportCardinalityMismatchException.cs -crlf -/ImportManyAttribute.cs -crlf -/ImportingConstructorAttribute.cs -crlf -/InheritedExportAttribute.cs -crlf -/MetadataAttributeAttribute.cs -crlf -/MetadataServices.cs -crlf -/MetadataViewGenerator.cs -crlf -/MetadataViewProvider.cs -crlf -/PartCreationPolicyAttribute.cs -crlf -/PartCreatorOfT.cs -crlf -/PartCreatorOfTTMetadata.cs -crlf -/PartLifetimeContextOfT.cs -crlf -/PartMetadataAttribute.cs -crlf -/PartNotDiscoverableAttribute.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/AttributedModel/.gitattributes b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/AttributedModel/.gitattributes deleted file mode 100644 index 64069f9372e..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/AttributedModel/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -/AttributedExportDefinition.cs -crlf -/AttributedModelDiscovery.cs -crlf -/AttributedPartCreationInfo.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/AttributedModel/AttributedExportDefinition.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/AttributedModel/AttributedExportDefinition.cs deleted file mode 100644 index c06732adf8a..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/AttributedModel/AttributedExportDefinition.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.AttributedModel;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.ReflectionModel;
-using System.Globalization;
-using System.Linq;
-using System.Reflection;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-using System.Threading;
-
-namespace System.ComponentModel.Composition.AttributedModel
-{
- internal class AttributedExportDefinition : ExportDefinition
- {
- private readonly AttributedPartCreationInfo _partCreationInfo;
- private readonly MemberInfo _member;
- private readonly ExportAttribute _exportAttribute;
-
- private IDictionary<string, object> _metadata;
-
- public AttributedExportDefinition(AttributedPartCreationInfo partCreationInfo, MemberInfo member, ExportAttribute exportAttribute)
- : base(member.GetContractNameFromExport(exportAttribute), (IDictionary<string, object>)null)
- {
- Assumes.NotNull(partCreationInfo);
- Assumes.NotNull(member);
- Assumes.NotNull(exportAttribute);
-
- this._partCreationInfo = partCreationInfo;
- this._member = member;
- this._exportAttribute = exportAttribute;
- }
-
- public override IDictionary<string, object> Metadata
- {
- get
- {
- if (this._metadata == null)
- {
- IDictionary<string, object> metadata;
- this._member.TryExportMetadataForMember(out metadata);
-
- string typeIdentity = this._member.GetTypeIdentityFromExport(this._exportAttribute);
- metadata.Add(CompositionConstants.ExportTypeIdentityMetadataName, typeIdentity);
-
- var partMetadata = this._partCreationInfo.GetMetadata();
- if (partMetadata != null && partMetadata.ContainsKey(CompositionConstants.PartCreationPolicyMetadataName))
- {
- metadata.Add(CompositionConstants.PartCreationPolicyMetadataName, partMetadata[CompositionConstants.PartCreationPolicyMetadataName]);
- }
-
- this._metadata = metadata;
- }
- return this._metadata;
- }
- }
- }
-
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/AttributedModel/AttributedModelDiscovery.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/AttributedModel/AttributedModelDiscovery.cs deleted file mode 100644 index ed5fbb4b9bd..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/AttributedModel/AttributedModelDiscovery.cs +++ /dev/null @@ -1,138 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Diagnostics;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.ReflectionModel;
-using System.Reflection;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.AttributedModel
-{
- internal static class AttributedModelDiscovery
- {
- public static ComposablePartDefinition CreatePartDefinitionIfDiscoverable(Type type, ICompositionElement origin)
- {
- AttributedPartCreationInfo creationInfo = new AttributedPartCreationInfo(type, null, false, origin);
- if (!creationInfo.IsPartDiscoverable())
- {
- return null;
- }
-
- return new ReflectionComposablePartDefinition(creationInfo);
- }
-
- public static ReflectionComposablePartDefinition CreatePartDefinition(Type type, PartCreationPolicyAttribute partCreationPolicy, bool ignoreConstructorImports, ICompositionElement origin)
- {
- Assumes.NotNull(type);
-
- AttributedPartCreationInfo creationInfo = new AttributedPartCreationInfo(type, partCreationPolicy, ignoreConstructorImports, origin);
-
- return new ReflectionComposablePartDefinition(creationInfo);
- }
-
- public static ReflectionComposablePart CreatePart(object attributedPart)
- {
- Assumes.NotNull(attributedPart);
-
- // If given an instance then we want to pass the default composition options because we treat it as a shared part
- // TODO: ICompositionElement Give this def an origin indicating that it was added directly to the ComposablePartExportProvider.
-
- ReflectionComposablePartDefinition definition = AttributedModelDiscovery.CreatePartDefinition(attributedPart.GetType(), PartCreationPolicyAttribute.Shared, true, (ICompositionElement)null);
-
- return new ReflectionComposablePart(definition, attributedPart);
- }
-
- public static ReflectionParameterImportDefinition CreateParameterImportDefinition(ParameterInfo parameter, ICompositionElement origin)
- {
- Requires.NotNull(parameter, "parameter");
-
- ReflectionParameter reflectionParameter = parameter.ToReflectionParameter();
- IAttributedImport attributedImport = AttributedModelDiscovery.GetAttributedImport(reflectionParameter, parameter);
- ImportType importType = new ImportType(reflectionParameter.ReturnType, attributedImport.Cardinality);
-
- if (importType.IsPartCreator)
- {
- return new PartCreatorParameterImportDefinition(
- new Lazy<ParameterInfo>(() => parameter),
- origin,
- new ContractBasedImportDefinition(
- attributedImport.GetContractNameFromImport(importType),
- attributedImport.GetTypeIdentityFromImport(importType),
- CompositionServices.GetRequiredMetadata(importType.MetadataViewType),
- attributedImport.Cardinality,
- false,
- true,
- CreationPolicy.NonShared));
- }
- else
- {
- return new ReflectionParameterImportDefinition(
- new Lazy<ParameterInfo>(() => parameter),
- attributedImport.GetContractNameFromImport(importType),
- attributedImport.GetTypeIdentityFromImport(importType),
- CompositionServices.GetRequiredMetadata(importType.MetadataViewType),
- attributedImport.Cardinality,
- attributedImport.RequiredCreationPolicy,
- origin);
- }
- }
-
- public static ReflectionMemberImportDefinition CreateMemberImportDefinition(MemberInfo member, ICompositionElement origin)
- {
- Requires.NotNull(member, "member");
-
- ReflectionWritableMember reflectionMember = member.ToReflectionWritableMember();
- IAttributedImport attributedImport = AttributedModelDiscovery.GetAttributedImport(reflectionMember, member);
- ImportType importType = new ImportType(reflectionMember.ReturnType, attributedImport.Cardinality);
-
- if (importType.IsPartCreator)
- {
- return new PartCreatorMemberImportDefinition(
- new LazyMemberInfo(member),
- origin,
- new ContractBasedImportDefinition(
- attributedImport.GetContractNameFromImport(importType),
- attributedImport.GetTypeIdentityFromImport(importType),
- CompositionServices.GetRequiredMetadata(importType.MetadataViewType),
- attributedImport.Cardinality,
- attributedImport.AllowRecomposition,
- false,
- CreationPolicy.NonShared));
- }
- else
- {
- return new ReflectionMemberImportDefinition(
- new LazyMemberInfo(member),
- attributedImport.GetContractNameFromImport(importType),
- attributedImport.GetTypeIdentityFromImport(importType),
- CompositionServices.GetRequiredMetadata(importType.MetadataViewType),
- attributedImport.Cardinality,
- attributedImport.AllowRecomposition,
- attributedImport.RequiredCreationPolicy,
- origin);
- }
- }
-
- private static IAttributedImport GetAttributedImport(ReflectionItem item, ICustomAttributeProvider attributeProvider)
- {
- IAttributedImport[] imports = attributeProvider.GetAttributes<IAttributedImport>(false);
-
- // For constructor parameters they may not have an ImportAttribute
- if (imports.Length == 0)
- {
- return new ImportAttribute();
- }
-
- if (imports.Length > 1)
- {
- CompositionTrace.MemberMarkedWithMultipleImportAndImportMany(item);
- }
-
- // Regardless of how many imports, always return the first one
- return imports[0];
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/AttributedModel/AttributedPartCreationInfo.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/AttributedModel/AttributedPartCreationInfo.cs deleted file mode 100644 index 9bc3d2f705b..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/AttributedModel/AttributedPartCreationInfo.cs +++ /dev/null @@ -1,446 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Diagnostics;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.ReflectionModel;
-using System.Linq;
-using System.Reflection;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-
-namespace System.ComponentModel.Composition.AttributedModel
-{
- internal class AttributedPartCreationInfo : IReflectionPartCreationInfo
- {
- private readonly Type _type;
- private readonly bool _ignoreConstructorImports = false;
- private readonly ICompositionElement _origin;
- private PartCreationPolicyAttribute _partCreationPolicy = null;
- private ConstructorInfo _constructor;
- private IEnumerable<ExportDefinition> _exports;
- private IEnumerable<ImportDefinition> _imports;
- private HashSet<string> _contractNamesOnNonInterfaces;
-
- public AttributedPartCreationInfo(Type type, PartCreationPolicyAttribute partCreationPolicy, bool ignoreConstructorImports, ICompositionElement origin)
- {
- Assumes.NotNull(type);
- this._type = type;
- this._ignoreConstructorImports = ignoreConstructorImports;
- this._partCreationPolicy = partCreationPolicy;
- this._origin = origin;
- }
-
- public Type GetPartType()
- {
- return this._type;
- }
-
- public Lazy<Type> GetLazyPartType()
- {
- return new Lazy<Type>(this.GetPartType, false);
- }
-
- public ConstructorInfo GetConstructor()
- {
- if (this._constructor == null && !this._ignoreConstructorImports)
- {
- this._constructor = SelectPartConstructor(this._type);
- }
- return this._constructor;
- }
-
- public IDictionary<string, object> GetMetadata()
- {
- return this._type.GetPartMetadataForType(this.CreationPolicy);
- }
-
- public IEnumerable<ExportDefinition> GetExports()
- {
- DiscoverExportsAndImports();
- return this._exports;
- }
-
- public IEnumerable<ImportDefinition> GetImports()
- {
- DiscoverExportsAndImports();
- return this._imports;
- }
-
- public bool IsDisposalRequired
- {
- get
- {
- return typeof(IDisposable).IsAssignableFrom(this.GetPartType());
- }
- }
-
- public bool IsPartDiscoverable()
- {
- if (this._type.IsAttributeDefined<PartNotDiscoverableAttribute>())
- {
- CompositionTrace.DefinitionMarkedWithPartNotDiscoverableAttribute(this._type);
- return false;
- }
-
- if (this._type.ContainsGenericParameters)
- {
- CompositionTrace.DefinitionContainsGenericsParameters(this._type);
- return false;
- }
-
- if (!HasExports())
- {
- CompositionTrace.DefinitionContainsNoExports(this._type);
- return false;
- }
-
- return true;
- }
-
- private bool HasExports()
- {
- return GetExportMembers(this._type).Any() ||
- GetInheritedExports(this._type).Any();
- }
-
- string ICompositionElement.DisplayName
- {
- get { return this.GetDisplayName(); }
- }
-
- ICompositionElement ICompositionElement.Origin
- {
- get { return this._origin; }
- }
-
- public override string ToString()
- {
- return GetDisplayName();
- }
-
- private string GetDisplayName()
- {
- return this.GetPartType().GetDisplayName();
- }
-
- private CreationPolicy CreationPolicy
- {
- get
- {
- if (this._partCreationPolicy == null)
- {
- this._partCreationPolicy = this._type.GetFirstAttribute<PartCreationPolicyAttribute>() ?? PartCreationPolicyAttribute.Default;
- }
- return this._partCreationPolicy.CreationPolicy;
- }
- }
-
- private static ConstructorInfo SelectPartConstructor(Type type)
- {
- Assumes.NotNull(type);
-
- if (type.IsAbstract)
- {
- return null;
- }
-
- // Only deal with non-static constructors
- BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
-
- ConstructorInfo[] constructors = type.GetConstructors(flags);
-
- // Should likely only happen for static or abstract types
- if (constructors.Length == 0)
- {
- return null;
- }
-
- // Optimize single default constructor.
- if (constructors.Length == 1 && constructors[0].GetParameters().Length == 0)
- {
- return constructors[0];
- }
-
- // Select the marked constructor if there is exactly one marked
- IEnumerable<ConstructorInfo> importingConstructors = constructors.Where(
- ctor => ctor.IsAttributeDefined<ImportingConstructorAttribute>());
-
- switch (importingConstructors.GetCardinality())
- {
- case EnumerableCardinality.One:
- {
- return importingConstructors.First();
- }
-
- case EnumerableCardinality.TwoOrMore:
- {
- // Return null, the part will error on instantiation.
- return null;
- }
- }
-
- // If there are no marked constructors then select the default constructor
- IEnumerable<ConstructorInfo> defaultConstructors = constructors.Where(
- ctor => ctor.GetParameters().Length == 0);
-
- // There should only ever be zero or one default constructors
- return defaultConstructors.SingleOrDefault();
- }
-
- private void DiscoverExportsAndImports()
- {
- // NOTE : in most cases both of these will be null or not null at the same time
- // the only situation when that is not the case is when there was a failure during the previous discovery
- // and one of them ended up not being set. In that case we will force the discovery again so that the same exception is thrown.
- if ((this._exports != null) && (this._imports != null))
- {
- return;
- }
-
- this._exports = GetExportDefinitions();
- this._imports = GetImportDefinitions();
- }
-
- private IEnumerable<ExportDefinition> GetExportDefinitions()
- {
- List<ExportDefinition> exports = new List<ExportDefinition>();
-
- this._contractNamesOnNonInterfaces = new HashSet<string>();
-
- // GetExportMembers should only contain the type itself along with the members declared on it,
- // it should not contain any base types, members on base types or interfaces on the type.
- foreach (MemberInfo member in GetExportMembers(this._type))
- {
- foreach (ExportAttribute exportAttribute in member.GetAttributes<ExportAttribute>())
- {
- var attributedExportDefinition = new AttributedExportDefinition(this, member, exportAttribute);
-
- if (exportAttribute.GetType() == CompositionServices.InheritedExportAttributeType)
- {
- // Any InheritedExports on the type itself are contributed during this pass
- // and we need to do the book keeping for those.
- if (!this._contractNamesOnNonInterfaces.Contains(attributedExportDefinition.ContractName))
- {
- exports.Add(new ReflectionMemberExportDefinition(member.ToLazyMember(), attributedExportDefinition, this));
- this._contractNamesOnNonInterfaces.Add(attributedExportDefinition.ContractName);
- }
- }
- else
- {
- exports.Add(new ReflectionMemberExportDefinition(member.ToLazyMember(), attributedExportDefinition, this));
- }
- }
- }
-
- // GetInheritedExports should only contain InheritedExports on base types or interfaces.
- // The order of types returned here is important because it is used as a
- // priority list of which InhertedExport to choose if multiple exists with
- // the same contract name. Therefore ensure that we always return the types
- // in the hiearchy from most derived to the lowest base type, followed
- // by all the interfaces that this type implements.
- foreach (Type type in GetInheritedExports(this._type))
- {
- foreach (InheritedExportAttribute exportAttribute in type.GetAttributes<InheritedExportAttribute>())
- {
- var attributedExportDefinition = new AttributedExportDefinition(this, type, exportAttribute);
-
- if (!this._contractNamesOnNonInterfaces.Contains(attributedExportDefinition.ContractName))
- {
- exports.Add(new ReflectionMemberExportDefinition(type.ToLazyMember(), attributedExportDefinition, this));
-
- if (!type.IsInterface)
- {
- this._contractNamesOnNonInterfaces.Add(attributedExportDefinition.ContractName);
- }
- }
- }
- }
-
- this._contractNamesOnNonInterfaces = null; // No need to hold this state around any longer
-
- return exports;
- }
-
- private IEnumerable<MemberInfo> GetExportMembers(Type type)
- {
- BindingFlags flags = BindingFlags.DeclaredOnly | BindingFlags.Public |
- BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static;
-
- // If the type is abstract only find local static exports
- if (type.IsAbstract)
- {
- flags &= ~BindingFlags.Instance;
- }
- else if (IsExport(type))
- {
- yield return type;
- }
-
- // Walk the fields
- foreach (var member in type.GetFields(flags))
- {
- if (IsExport(member))
- {
- yield return member;
- }
- }
-
- // Walk the properties
- foreach (var member in type.GetProperties(flags))
- {
- if (IsExport(member))
- {
- yield return member;
- }
- }
-
- // Walk the methods
- foreach (var member in type.GetMethods(flags))
- {
- if (IsExport(member))
- {
- yield return member;
- }
- }
- }
-
- private IEnumerable<Type> GetInheritedExports(Type type)
- {
- // If the type is abstract we aren't interested in type level exports
- if (type.IsAbstract)
- {
- yield break;
- }
-
- // The order of types returned here is important because it is used as a
- // priority list of which InhertedExport to choose if multiple exists with
- // the same contract name. Therefore ensure that we always return the types
- // in the hiearchy from most derived to the lowest base type, followed
- // by all the interfaces that this type implements.
-
- Type currentType = type.BaseType;
-
- if (currentType == null)
- {
- yield break;
- }
-
- // Stopping at object instead of null to help with performance. It is a noticable performance
- // gain (~5%) if we don't have to try and pull the attributes we know don't exist on object.
- // We also need the null check in case we're passed a type that doesn't live in the runtime context.
- while (currentType != null && currentType != CompositionServices.ObjectType)
- {
- if (IsInheritedExport(currentType))
- {
- yield return currentType;
- }
- currentType = currentType.BaseType;
- }
-
- foreach (Type iface in type.GetInterfaces())
- {
- if (IsInheritedExport(iface))
- {
- yield return iface;
- }
- }
- }
-
- private static bool IsExport(ICustomAttributeProvider attributeProvider)
- {
- return attributeProvider.IsAttributeDefined<ExportAttribute>(false);
- }
-
- private static bool IsInheritedExport(ICustomAttributeProvider attributedProvider)
- {
- return attributedProvider.IsAttributeDefined<InheritedExportAttribute>(false);
- }
-
- private IEnumerable<ImportDefinition> GetImportDefinitions()
- {
- List<ImportDefinition> imports = new List<ImportDefinition>();
-
- foreach (MemberInfo member in GetImportMembers(this._type))
- {
- ReflectionMemberImportDefinition importDefinition = AttributedModelDiscovery.CreateMemberImportDefinition(member, this);
- imports.Add(importDefinition);
- }
-
- var constructor = this.GetConstructor();
-
- if (constructor != null)
- {
- foreach (ParameterInfo parameter in constructor.GetParameters())
- {
- ReflectionParameterImportDefinition importDefinition = AttributedModelDiscovery.CreateParameterImportDefinition(parameter, this);
- imports.Add(importDefinition);
- }
- }
-
- return imports;
- }
-
- private IEnumerable<MemberInfo> GetImportMembers(Type type)
- {
- if (type.IsAbstract)
- {
- yield break;
- }
-
- foreach (MemberInfo member in GetDeclaredOnlyImportMembers(type))
- {
- yield return member;
- }
-
- // Walk up the type chain until you hit object.
- if (type.BaseType != null)
- {
- Type baseType = type.BaseType;
-
- // Stopping at object instead of null to help with performance. It is a noticable performance
- // gain (~5%) if we don't have to try and pull the attributes we know don't exist on object.
- // We also need the null check in case we're passed a type that doesn't live in the runtime context.
- while (baseType != null && baseType != CompositionServices.ObjectType)
- {
- foreach (MemberInfo member in GetDeclaredOnlyImportMembers(baseType))
- {
- yield return member;
- }
- baseType = baseType.BaseType;
- }
- }
- }
-
- private IEnumerable<MemberInfo> GetDeclaredOnlyImportMembers(Type type)
- {
- BindingFlags flags = BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
-
- // Walk the fields
- foreach (var member in type.GetFields(flags))
- {
- if (IsImport(member))
- {
- yield return member;
- }
- }
-
- // Walk the properties
- foreach (var member in type.GetProperties(flags))
- {
- if (IsImport(member))
- {
- yield return member;
- }
- }
- }
-
- private static bool IsImport(ICustomAttributeProvider attributeProvider)
- {
- return attributeProvider.IsAttributeDefined<IAttributedImport>(false);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/AttributedModelServices.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/AttributedModelServices.cs deleted file mode 100644 index b2be75773a2..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/AttributedModelServices.cs +++ /dev/null @@ -1,161 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Runtime.Serialization;
-using System.ComponentModel.Composition.AttributedModel;
-using System.Reflection;
-using System.Linq;
-using Microsoft.Internal;
-using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
-
-namespace System.ComponentModel.Composition
-{
- public static class AttributedModelServices
- {
- [SuppressMessage("Microsoft.Design", "CA1004")]
- public static TMetadataView GetMetadataView<TMetadataView>(IDictionary<string, object> metadata)
- {
- Requires.NotNull(metadata, "metadata");
-
- return MetadataViewProvider.GetMetadataView<TMetadataView>(metadata);
- }
-
- public static ComposablePart CreatePart(object attributedPart)
- {
- Requires.NotNull(attributedPart, "attributedPart");
- return AttributedModelDiscovery.CreatePart(attributedPart);
- }
-
- public static ComposablePartDefinition CreatePartDefinition(Type type, ICompositionElement origin)
- {
- Requires.NotNull(type, "type");
- return AttributedModelServices.CreatePartDefinition(type, origin, false);
- }
-
- public static ComposablePartDefinition CreatePartDefinition(Type type, ICompositionElement origin, bool ensureIsDiscoverable)
- {
- Requires.NotNull(type, "type");
- if (ensureIsDiscoverable)
- {
- return AttributedModelDiscovery.CreatePartDefinitionIfDiscoverable(type, origin);
- }
- else
- {
- return AttributedModelDiscovery.CreatePartDefinition(type, null, false, origin);
- }
- }
-
- public static string GetTypeIdentity(Type type)
- {
- Requires.NotNull(type, "type");
-
- return ContractNameServices.GetTypeIdentity(type);
- }
-
- public static string GetTypeIdentity(MethodInfo method)
- {
- Requires.NotNull(method, "method");
-
- return ContractNameServices.GetTypeIdentityFromMethod(method);
- }
-
- public static string GetContractName(Type type)
- {
- return AttributedModelServices.GetTypeIdentity(type);
- }
-
- public static ComposablePart AddExportedValue<T>(this CompositionBatch batch, T exportedValue)
- {
- Requires.NotNull(batch, "batch");
- string contractName = AttributedModelServices.GetContractName(typeof(T));
-
- return batch.AddExportedValue<T>(contractName, exportedValue);
- }
-
- public static void ComposeExportedValue<T>(this CompositionContainer container, T exportedValue)
- {
- Requires.NotNull(container, "container");
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddExportedValue<T>(exportedValue);
- container.Compose(batch);
- }
-
- public static ComposablePart AddExportedValue<T>(this CompositionBatch batch, string contractName, T exportedValue)
- {
- Requires.NotNull(batch, "batch");
-
- string typeIdentity = AttributedModelServices.GetTypeIdentity(typeof(T));
-
- IDictionary<string, object> metadata = new Dictionary<string, object>();
- metadata.Add(CompositionConstants.ExportTypeIdentityMetadataName, typeIdentity);
-
- return batch.AddExport(new Export(contractName, metadata, () => exportedValue));
- }
-
- public static void ComposeExportedValue<T>(this CompositionContainer container, string contractName, T exportedValue)
- {
- Requires.NotNull(container, "container");
-
- CompositionBatch batch = new CompositionBatch();
- batch.AddExportedValue<T>(contractName, exportedValue);
- container.Compose(batch);
- }
-
- public static ComposablePart AddPart(this CompositionBatch batch, object attributedPart)
- {
- Requires.NotNull(batch, "batch");
- Requires.NotNull(attributedPart, "attributedPart");
-
- ComposablePart part = AttributedModelServices.CreatePart(attributedPart);
-
- batch.AddPart(part);
-
- return part;
- }
-
- public static void ComposeParts(this CompositionContainer container, params object[] attributedParts)
- {
- Requires.NotNull(container, "container");
- Requires.NotNullOrNullElements(attributedParts, "attributedParts");
-
- CompositionBatch batch = new CompositionBatch(
- attributedParts.Select(attributedPart => AttributedModelServices.CreatePart(attributedPart)).ToArray(),
- Enumerable.Empty<ComposablePart>());
-
- container.Compose(batch);
- }
-
- /// <summary>
- /// Satisfies the imports of the specified attributed object exactly once and they will not
- /// ever be recomposed.
- /// </summary>
- /// <param name="part">
- /// The attributed object to set the imports.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="attributedPart"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="CompositionException">
- /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
- /// contain a collection of errors that occurred.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="ICompositionService"/> has been disposed of.
- /// </exception>
- public static ComposablePart SatisfyImportsOnce(this ICompositionService compositionService, object attributedPart)
- {
- Requires.NotNull(compositionService, "compositionService");
- Requires.NotNull(attributedPart, "attributedPart");
-
- ComposablePart part = AttributedModelServices.CreatePart(attributedPart);
- compositionService.SatisfyImportsOnce(part);
-
- return part;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ChangeRejectedException.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ChangeRejectedException.cs deleted file mode 100644 index db81e13fbd4..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ChangeRejectedException.cs +++ /dev/null @@ -1,69 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Security.Permissions;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition
-{
- /// <summary>
- /// The exception that is thrown when one or more recoverable errors occur during
- /// composition which results in those changes being rejected.
- /// </summary>
- [Serializable]
- public class ChangeRejectedException : CompositionException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ChangeRejectedException"/> class.
- /// </summary>
- public ChangeRejectedException()
- : this((string)null, (Exception)null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ChangeRejectedException"/> class.
- /// </summary>
- public ChangeRejectedException(string message)
- : this(message, (Exception)null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ChangeRejectedException"/> class.
- /// </summary>
- public ChangeRejectedException(string message, Exception innerException)
- : base(message, innerException, (IEnumerable<CompositionError>)null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ChangeRejectedException"/> class.
- /// </summary>
- /// <param name="errors">List of errors that occured while applying the changes.</param>
- public ChangeRejectedException(IEnumerable<CompositionError> errors)
- : base((string)null, (Exception)null, errors)
- {
- }
-
- /// <summary>
- /// Gets a message that describes the exception.
- /// </summary>
- /// <value>
- /// A <see cref="String"/> containing a message that describes the
- /// <see cref="ChangeRejectedException"/>.
- /// </value>
- public override string Message
- {
- get
- {
- return string.Format(CultureInfo.CurrentCulture,
- Strings.CompositionException_ChangesRejected,
- base.Message);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/CompositionContractMismatchException.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/CompositionContractMismatchException.cs deleted file mode 100644 index f1a5f4968b8..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/CompositionContractMismatchException.cs +++ /dev/null @@ -1,90 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Runtime.Serialization;
-
-namespace System.ComponentModel.Composition
-{
- /// <summary>
- /// The exception that is thrown when the underlying exported value or metadata of an
- /// <see cref="Lazy{T}"/> or <see cref="Lazy{T, TMetadataView}"/> object cannot be
- /// cast to <c>T</c> or <c>TMetadataView</c>, respectively.
- /// </summary>
- [Serializable]
- public class CompositionContractMismatchException : Exception
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="CompositionContractMismatchException"/> class.
- /// </summary>
- public CompositionContractMismatchException()
- : this((string)null, (Exception)null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CompositionContractMismatchException"/> class
- /// with the specified error message.
- /// </summary>
- /// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
- /// <see cref="CompositionContractMismatchException"/>; or <see langword="null"/> to set
- /// the <see cref="Exception.Message"/> property to its default value.
- /// </param>
- public CompositionContractMismatchException(string message)
- : this(message, (Exception)null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CompositionContractMismatchException"/> class
- /// with the specified error message and exception that is the cause of the
- /// exception.
- /// </summary>
- /// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
- /// <see cref="CompositionContractMismatchException"/>; or <see langword="null"/> to set
- /// the <see cref="Exception.Message"/> property to its default value.
- /// </param>
- /// <param name="innerException">
- /// The <see cref="Exception"/> that is the underlying cause of the
- /// <see cref="CompositionContractMismatchException"/>; or <see langword="null"/> to set
- /// the <see cref="Exception.InnerException"/> property to <see langword="null"/>.
- /// </param>
- public CompositionContractMismatchException(string message, Exception innerException)
- : base(message, innerException)
- {
- }
-
-#if !SILVERLIGHT
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CompositionContractMismatchException"/> class
- /// with the specified serialization data.
- /// </summary>
- /// <param name="info">
- /// The <see cref="SerializationInfo"/> that holds the serialized object data about the
- /// <see cref="CompositionContractMismatchException"/>.
- /// </param>
- /// <param name="context">
- /// The <see cref="StreamingContext"/> that contains contextual information about the
- /// source or destination.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="info"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="SerializationException">
- /// <paramref name="info"/> is missing a required value.
- /// </exception>
- /// <exception cref="InvalidCastException">
- /// <paramref name="info"/> contains a value that cannot be cast to the correct type.
- /// </exception>
- [System.Security.SecuritySafeCritical]
- protected CompositionContractMismatchException(SerializationInfo info, StreamingContext context)
- : base(info, context)
- {
- }
-
-#endif
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/CompositionError.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/CompositionError.cs deleted file mode 100644 index d5237502bc2..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/CompositionError.cs +++ /dev/null @@ -1,188 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Diagnostics;
-using System.Globalization;
-using System.Security.Permissions;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition
-{
- /// <summary>
- /// Represents an error that occurs during composition in a <see cref="CompositionContainer"/>.
- /// </summary>
- [Serializable]
- [DebuggerTypeProxy(typeof(CompositionErrorDebuggerProxy))]
- public class CompositionError : ICompositionError
- {
- private readonly CompositionErrorId _id;
- private readonly string _description;
- private readonly Exception _exception;
-
- private readonly ICompositionElement _element;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CompositionError"/> class
- /// with the specified error message.
- /// </summary>
- /// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
- /// <see cref="CompositionError"/>; or <see langword="null"/> to set the
- /// <see cref="Description"/> property to an empty string ("").
- /// </param>
- public CompositionError(string message)
- : this(CompositionErrorId.Unknown, message, (ICompositionElement)null, (Exception)null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CompositionError"/> class
- /// with the specified error message and composition element that is the
- /// cause of the composition error.
- /// </summary>
- /// <param name="element">
- /// The <see cref="ICompositionElement"/> that is the cause of the
- /// <see cref="CompositionError"/>; or <see langword="null"/> to set
- /// the <see cref="CompositionError.Element"/> property to
- /// <see langword="null"/>.
- /// </param>
- /// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
- /// <see cref="CompositionError"/>; or <see langword="null"/> to set the
- /// <see cref="Description"/> property to an empty string ("").
- /// </param>
- public CompositionError(string message, ICompositionElement element)
- : this(CompositionErrorId.Unknown, message, element, (Exception)null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CompositionError"/> class
- /// with the specified error message and exception that is the cause of the
- /// composition error.
- /// </summary>
- /// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
- /// <see cref="CompositionError"/>; or <see langword="null"/> to set the
- /// <see cref="Description"/> property to an empty string ("").
- /// </param>
- /// <param name="exception">
- /// The <see cref="Exception"/> that is the underlying cause of the
- /// <see cref="CompositionError"/>; or <see langword="null"/> to set
- /// the <see cref="CompositionError.Exception"/> property to <see langword="null"/>.
- /// </param>
- public CompositionError(string message, Exception exception)
- : this(CompositionErrorId.Unknown, message, (ICompositionElement)null, exception)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CompositionError"/> class
- /// with the specified error message, and composition element and exception that
- /// is the cause of the composition error.
- /// </summary>
- /// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
- /// <see cref="CompositionError"/>; or <see langword="null"/> to set the
- /// <see cref="Description"/> property to an empty string ("").
- /// </param>
- /// <param name="element">
- /// The <see cref="ICompositionElement"/> that is the cause of the
- /// <see cref="CompositionError"/>; or <see langword="null"/> to set
- /// the <see cref="CompositionError.Element"/> property to
- /// <see langword="null"/>.
- /// </param>
- /// <param name="exception">
- /// The <see cref="Exception"/> that is the underlying cause of the
- /// <see cref="CompositionError"/>; or <see langword="null"/> to set
- /// the <see cref="CompositionError.Exception"/> property to <see langword="null"/>.
- /// </param>
- public CompositionError(string message, ICompositionElement element, Exception exception)
- : this(CompositionErrorId.Unknown, message, element, exception)
- {
- }
-
- internal CompositionError(CompositionErrorId id, string description, ICompositionElement element, Exception exception)
- {
- _id = id;
- _description = description ?? string.Empty;
- _element = element;
- _exception = exception;
- }
-
- /// <summary>
- /// Gets the composition element that is the cause of the error.
- /// </summary>
- /// <value>
- /// The <see cref="ICompositionElement"/> that is the cause of the
- /// <see cref="CompositionError"/>. The default is <see langword="null"/>.
- /// </value>
- public ICompositionElement Element
- {
- get { return _element; }
- }
-
- /// <summary>
- /// Gets the message that describes the composition error.
- /// </summary>
- /// <value>
- /// A <see cref="String"/> containing a message that describes the
- /// <see cref="CompositionError"/>.
- /// </value>
- public string Description
- {
- get { return _description; }
- }
-
- /// <summary>
- /// Gets the exception that is the underlying cause of the composition error.
- /// </summary>
- /// <value>
- /// The <see cref="Exception"/> that is the underlying cause of the
- /// <see cref="CompositionError"/>. The default is <see langword="null"/>.
- /// </value>
- public Exception Exception
- {
- get { return _exception; }
- }
-
- CompositionErrorId ICompositionError.Id
- {
- get { return _id; }
- }
-
- Exception ICompositionError.InnerException
- {
- get { return Exception; }
- }
-
- /// <summary>
- /// Returns a string representation of the composition error.
- /// </summary>
- /// <returns>
- /// A <see cref="String"/> containing the <see cref="Description"/> property.
- /// </returns>
- public override string ToString()
- {
- return this.Description;
- }
-
- internal static CompositionError Create(CompositionErrorId id, string format, params object[] parameters)
- {
- return Create(id, (ICompositionElement)null, (Exception)null, format, parameters);
- }
-
- internal static CompositionError Create(CompositionErrorId id, ICompositionElement element, string format, params object[] parameters)
- {
- return Create(id, element, (Exception)null, format, parameters);
- }
-
- internal static CompositionError Create(CompositionErrorId id, ICompositionElement element, Exception exception, string format, params object[] parameters)
- {
- return new CompositionError(id, string.Format(CultureInfo.CurrentCulture, format, parameters), element, exception);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/CompositionErrorDebuggerProxy.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/CompositionErrorDebuggerProxy.cs deleted file mode 100644 index eafbc0c20ba..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/CompositionErrorDebuggerProxy.cs +++ /dev/null @@ -1,37 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition
-{
- internal class CompositionErrorDebuggerProxy
- {
- private readonly CompositionError _error;
-
- public CompositionErrorDebuggerProxy(CompositionError error)
- {
- Requires.NotNull(error, "error");
-
- this._error = error;
- }
-
- public string Description
- {
- get { return this._error.Description; }
- }
-
- public Exception Exception
- {
- get { return this._error.Exception; }
- }
-
- public ICompositionElement Element
- {
- get { return this._error.Element; }
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/CompositionErrorId.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/CompositionErrorId.cs deleted file mode 100644 index b9eb3b6d16e..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/CompositionErrorId.cs +++ /dev/null @@ -1,41 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-
-namespace System.ComponentModel.Composition
-{
- internal enum CompositionErrorId : int
- {
- Unknown = 0,
- InvalidExportMetadata,
- RequiredMetadataNotFound,
- UnsupportedExportType,
- ImportNotSetOnPart,
- ImportEngine_ComposeTookTooManyIterations,
- ImportEngine_ImportCardinalityMismatch,
- ImportEngine_PartCycle,
- ImportEngine_PartCannotSetImport,
- ImportEngine_PartCannotGetExportedValue,
- ImportEngine_PartCannotActivate,
- ImportEngine_PreventedByExistingImport,
- ImportEngine_InvalidStateForRecomposition,
- ReflectionModel_PartConstructorMissing,
- ReflectionModel_PartConstructorThrewException,
- ReflectionModel_PartOnImportsSatisfiedThrewException,
- ReflectionModel_ExportNotReadable,
- ReflectionModel_ExportThrewException,
- ReflectionModel_ExportMethodTooManyParameters,
- ReflectionModel_ImportNotWritable,
- ReflectionModel_ImportThrewException,
- ReflectionModel_ImportNotAssignableFromExport,
- ReflectionModel_ImportCollectionNull,
- ReflectionModel_ImportCollectionNotWritable,
- ReflectionModel_ImportCollectionConstructionThrewException,
- ReflectionModel_ImportCollectionGetThrewException,
- ReflectionModel_ImportCollectionIsReadOnlyThrewException,
- ReflectionModel_ImportCollectionClearThrewException,
- ReflectionModel_ImportCollectionAddThrewException,
- ReflectionModel_ImportManyOnParameterCanOnlyBeAssigned,
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/CompositionException.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/CompositionException.cs deleted file mode 100644 index 39491ad433b..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/CompositionException.cs +++ /dev/null @@ -1,340 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Globalization;
-using System.Linq;
-using System.Runtime.Serialization;
-using System.Security.Permissions;
-using System.Text;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-
-namespace System.ComponentModel.Composition
-{
-
- /// <summary>
- /// The exception that is thrown when one or more errors occur during composition in
- /// a <see cref="CompositionContainer"/>.
- /// </summary>
- [Serializable]
- public class CompositionException : Exception
- {
- const string ErrorsKey = "Errors";
- private ReadOnlyCollection<CompositionError> _errors;
-
-#if CLR40 && !SILVERLIGHT
- [Serializable]
- private struct CompositionExceptionData : ISafeSerializationData
- {
- public CompositionError[] _errors;
-
- void ISafeSerializationData.CompleteDeserialization(object obj)
- {
- CompositionException exception = obj as CompositionException;
-
- exception._errors = new ReadOnlyCollection<CompositionError>(this._errors);
- }
- }
-#endif
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CompositionException"/> class.
- /// </summary>
- public CompositionException()
- : this((string)null, (Exception)null, (IEnumerable<CompositionError>)null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CompositionException"/> class
- /// with the specified error message.
- /// </summary>
- /// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
- /// <see cref="CompositionException"/>; or <see langword="null"/> to set
- /// the <see cref="Exception.Message"/> property to its default value.
- /// </param>
- public CompositionException(string message)
- : this(message, (Exception)null, (IEnumerable<CompositionError>)null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CompositionException"/> class
- /// with the specified error message and exception that is the cause of the
- /// exception.
- /// </summary>
- /// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
- /// <see cref="CompositionException"/>; or <see langword="null"/> to set
- /// the <see cref="Exception.Message"/> property to its default value.
- /// </param>
- /// <param name="innerException">
- /// The <see cref="Exception"/> that is the underlying cause of the
- /// <see cref="ComposablePartException"/>; or <see langword="null"/> to set
- /// the <see cref="Exception.InnerException"/> property to <see langword="null"/>.
- /// </param>
- public CompositionException(string message, Exception innerException)
- : this(message, innerException, (IEnumerable<CompositionError>)null)
- {
- }
-
- internal CompositionException(CompositionError error)
- : this(new CompositionError[] { error })
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CompositionException"/> class
- /// with the specified errors.
- /// </summary>
- /// <param name="errors">
- /// An <see cref="IEnumerable{T}"/> of <see cref="CompositionError"/> objects
- /// representing the errors that are the cause of the
- /// <see cref="CompositionException"/>; or <see langword="null"/> to set the
- /// <see cref="Errors"/> property to an empty <see cref="IEnumerable{T}"/>.
- /// </param>
- /// <exception cref="ArgumentException">
- /// <paramref name="errors"/> contains an element that is <see langword="null"/>.
- /// </exception>
- public CompositionException(IEnumerable<CompositionError> errors)
- : this((string)null, (Exception)null, errors)
- {
- }
-
- internal CompositionException(string message, Exception innerException, IEnumerable<CompositionError> errors)
- : base(message, innerException)
- {
- Requires.NullOrNotNullElements(errors, "errors");
-#if CLR40 && !SILVERLIGHT
- SerializeObjectState += delegate(object exception, SafeSerializationEventArgs eventArgs)
- {
- var data = new CompositionExceptionData();
- if(this._errors != null)
- {
- data._errors = this._errors.Select(error => new CompositionError(
- ((ICompositionError)error).Id,
- error.Description,
- error.Element.ToSerializableElement(),
- error.Exception)).ToArray();
- }
- else
- {
- data._errors = new CompositionError[0];
- }
-
- eventArgs.AddSerializedState(data);
- };
-#endif
- _errors = new ReadOnlyCollection<CompositionError>(errors == null ? new CompositionError[0] : errors.ToArray<CompositionError>());
- }
-
- /// <summary>
- /// Gets the errors that are the cause of the exception.
- /// </summary>
- /// <value>
- /// An <see cref="IEnumerable{T}"/> of <see cref="CompositionError"/> objects
- /// representing the errors that are the cause of the
- /// <see cref="CompositionException"/>.
- /// </value>
- public ReadOnlyCollection<CompositionError> Errors
- {
- get { return _errors; }
- }
-
- /// <summary>
- /// Gets a message that describes the exception.
- /// </summary>
- /// <value>
- /// A <see cref="String"/> containing a message that describes the
- /// <see cref="CompositionException"/>.
- /// </value>
- public override string Message
- {
- [System.Security.SecuritySafeCritical]
- get
- {
- if (this.Errors.Count == 0)
- { // If there are no errors, then we simply return base.Message,
- // which will either use the default Exception message, or if
- // one was specified; the user supplied message.
-
- return base.Message;
- }
-
- return BuildDefaultMessage();
- }
- }
-
- private string BuildDefaultMessage()
- {
- IEnumerable<IEnumerable<CompositionError>> paths = CalculatePaths(this);
-
- StringBuilder writer = new StringBuilder();
-
- WriteHeader(writer, this.Errors.Count, paths.Count());
- WritePaths(writer, paths);
-
- return writer.ToString();
- }
-
- private static void WriteHeader(StringBuilder writer, int errorsCount, int pathCount)
- {
- if (errorsCount > 1 && pathCount > 1)
- {
- // The composition produced multiple composition errors, with {0} root causes. The root causes are provided below.
- writer.AppendFormat(
- CultureInfo.CurrentCulture,
- Strings.CompositionException_MultipleErrorsWithMultiplePaths,
- pathCount);
- }
- else if (errorsCount == 1 && pathCount > 1)
- {
- // The composition produced a single composition error, with {0} root causes. The root causes are provided below.
- writer.AppendFormat(
- CultureInfo.CurrentCulture,
- Strings.CompositionException_SingleErrorWithMultiplePaths,
- pathCount);
- }
- else
- {
- Assumes.IsTrue(errorsCount == 1);
- Assumes.IsTrue(pathCount == 1);
-
- // The composition produced a single composition error. The root cause is provided below.
- writer.AppendFormat(
- CultureInfo.CurrentCulture,
- Strings.CompositionException_SingleErrorWithSinglePath,
- pathCount);
- }
-
- writer.Append(' ');
- writer.AppendLine(Strings.CompositionException_ReviewErrorProperty);
- }
-
- private static void WritePaths(StringBuilder writer, IEnumerable<IEnumerable<CompositionError>> paths)
- {
- int ordinal = 0;
- foreach (IEnumerable<CompositionError> path in paths)
- {
- ordinal++;
- WritePath(writer, path, ordinal);
- }
- }
-
- private static void WritePath(StringBuilder writer, IEnumerable<CompositionError> path, int ordinal)
- {
- writer.AppendLine();
- writer.Append(ordinal.ToString(CultureInfo.CurrentCulture));
- writer.Append(Strings.CompositionException_PathsCountSeparator);
- writer.Append(' ');
-
- WriteError(writer, path.First());
-
- foreach (CompositionError error in path.Skip(1))
- {
- writer.AppendLine();
- writer.Append(Strings.CompositionException_ErrorPrefix);
- writer.Append(' ');
- WriteError(writer, error);
- }
- }
-
- private static void WriteError(StringBuilder writer, CompositionError error)
- {
- writer.AppendLine(error.Description);
-
- if (error.Element != null)
- {
- WriteElementGraph(writer, error.Element);
- }
- }
-
- private static void WriteElementGraph(StringBuilder writer, ICompositionElement element)
- {
- // Writes the composition element and its origins in the format:
- // Element: Export --> Part --> PartDefinition --> Catalog
-
- writer.AppendFormat(CultureInfo.CurrentCulture, Strings.CompositionException_ElementPrefix, element.DisplayName);
-
- while ((element = element.Origin) != null)
- {
- writer.AppendFormat(CultureInfo.CurrentCulture, Strings.CompositionException_OriginFormat, Strings.CompositionException_OriginSeparator, element.DisplayName);
- }
-
- writer.AppendLine();
- }
-
- private static IEnumerable<IEnumerable<CompositionError>> CalculatePaths(CompositionException exception)
- {
- List<IEnumerable<CompositionError>> paths = new List<IEnumerable<CompositionError>>();
-
- VisitContext context = new VisitContext();
- context.Path = new Stack<CompositionError>();
- context.LeafVisitor = path =>
- {
- // Take a snapshot of the path
- paths.Add(path.Copy());
- };
-
- VisitCompositionException(exception, context);
-
- return paths;
- }
-
- private static void VisitCompositionException(CompositionException exception, VisitContext context)
- {
- foreach (CompositionError error in exception.Errors)
- {
- VisitError(error, context);
- }
-
- if (exception.InnerException != null)
- {
- VisitException(exception.InnerException, context);
- }
- }
-
- private static void VisitError(CompositionError error, VisitContext context)
- {
- context.Path.Push(error);
-
- if (error.Exception == null)
- { // This error is a root cause, so write
- // out the stack from this point
-
- context.LeafVisitor(context.Path);
- }
- else
- {
- VisitException(error.Exception, context);
- }
-
- context.Path.Pop();
- }
-
- private static void VisitException(Exception exception, VisitContext context)
- {
- CompositionException composition = exception as CompositionException;
- if (composition != null)
- {
- VisitCompositionException(composition, context);
- }
- else
- {
- VisitError(new CompositionError(exception.Message, exception.InnerException), context);
- }
- }
-
- private struct VisitContext
- {
- public Stack<CompositionError> Path;
- public Action<Stack<CompositionError>> LeafVisitor;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/CompositionResult.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/CompositionResult.cs deleted file mode 100644 index 3cdda7123bf..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/CompositionResult.cs +++ /dev/null @@ -1,86 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
-using System.Linq;
-using Microsoft.Internal.Collections;
-using System.ComponentModel.Composition.Hosting;
-
-namespace System.ComponentModel.Composition
-{
- internal struct CompositionResult
- {
- public static readonly CompositionResult SucceededResult = new CompositionResult();
- private readonly IEnumerable<CompositionError> _errors;
-
- public CompositionResult(params CompositionError[] errors)
- : this((IEnumerable<CompositionError>)errors)
- {
- }
-
- public CompositionResult(IEnumerable<CompositionError> errors)
- {
- this._errors = errors;
- }
-
- public bool Succeeded
- {
- get { return this._errors == null || !this._errors.FastAny(); }
- }
-
- public IEnumerable<CompositionError> Errors
- {
- get { return this._errors ?? Enumerable.Empty<CompositionError>(); }
- }
-
- public CompositionResult MergeResult(CompositionResult result)
- {
- if (this.Succeeded)
- {
- return result;
- }
- if (result.Succeeded)
- {
- return this;
- }
- return MergeErrors(result._errors);
- }
-
- public CompositionResult MergeError(CompositionError error)
- {
- return MergeErrors(new CompositionError[] { error });
- }
-
- public CompositionResult MergeErrors(IEnumerable<CompositionError> errors)
- {
- return new CompositionResult(this._errors.ConcatAllowingNull(errors));
- }
-
- public CompositionResult<T> ToResult<T>(T value)
- {
- return new CompositionResult<T>(value, this._errors);
- }
-
- public void ThrowOnErrors()
- {
- ThrowOnErrors(null);
- }
-
- public void ThrowOnErrors(AtomicComposition atomicComposition)
- {
- if (!this.Succeeded)
- {
- if (atomicComposition == null)
- {
- throw new CompositionException(this._errors);
- }
- else
- {
- throw new ChangeRejectedException(this._errors);
- }
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/CompositionResultOfT.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/CompositionResultOfT.cs deleted file mode 100644 index a891a841360..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/CompositionResultOfT.cs +++ /dev/null @@ -1,79 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
-using System.Linq;
-using Microsoft.Internal.Collections;
-
-namespace System.ComponentModel.Composition
-{
- internal struct CompositionResult<T>
- {
- private readonly IEnumerable<CompositionError> _errors;
- private readonly T _value;
-
- public CompositionResult(T value)
- : this(value, (CompositionError[])null)
- {
- }
-
- public CompositionResult(params CompositionError[] errors)
- : this(default(T), (IEnumerable<CompositionError>)errors)
- {
- }
-
- public CompositionResult(IEnumerable<CompositionError> errors)
- : this(default(T), errors)
- {
- }
-
- internal CompositionResult(T value, IEnumerable<CompositionError> errors)
- {
- this._errors = errors;
- this._value = value;
- }
-
- public bool Succeeded
- {
- get { return this._errors == null || !this._errors.FastAny(); }
- }
-
- public IEnumerable<CompositionError> Errors
- {
- get { return this._errors ?? Enumerable.Empty<CompositionError>(); }
- }
-
- /// <summary>
- /// Gets the value from the result, throwing a CompositionException if there are any errors.
- /// </summary>
- public T Value
- {
- get
- {
- ThrowOnErrors();
-
- return this._value;
- }
- }
-
- internal CompositionResult<TValue> ToResult<TValue>()
- {
- return new CompositionResult<TValue>(this._errors);
- }
-
- internal CompositionResult ToResult()
- {
- return new CompositionResult(this._errors);
- }
-
- private void ThrowOnErrors()
- {
- if (!this.Succeeded)
- {
- throw new CompositionException(this._errors);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ConstraintServices.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ConstraintServices.cs deleted file mode 100644 index 9f321e8bc64..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ConstraintServices.cs +++ /dev/null @@ -1,214 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Reflection;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition
-{
- internal static class ConstraintServices
- {
- // NOTE : these are here as Reflection member search is pretty expensive, and we want that to be done once.
- // Also, making these static would cause this class to fail loading if we rename members of ExportDefinition.
- private static readonly PropertyInfo _exportDefinitionContractNameProperty = typeof(ExportDefinition).GetProperty("ContractName");
- private static readonly PropertyInfo _exportDefinitionMetadataProperty = typeof(ExportDefinition).GetProperty("Metadata");
- private static readonly MethodInfo _metadataContainsKeyMethod = typeof(IDictionary<string, object>).GetMethod("ContainsKey");
- private static readonly MethodInfo _metadataItemMethod = typeof(IDictionary<string, object>).GetMethod("get_Item");
- private static readonly MethodInfo _metadataEqualsMethod = typeof(object).GetMethod("Equals", new Type[] { typeof(object) });
- private static readonly MethodInfo _typeIsInstanceOfTypeMethod = typeof(Type).GetMethod("IsInstanceOfType");
-
- public static Expression<Func<ExportDefinition, bool>> CreateConstraint(IEnumerable<KeyValuePair<string, Type>> requiredMetadata)
- {
- ParameterExpression parameter = Expression.Parameter(typeof(ExportDefinition), "exportDefinition");
- Expression metadataConstraintBody = null;
-
- if (requiredMetadata != null)
- {
- metadataConstraintBody = ConstraintServices.CreateMetadataConstraintBody(requiredMetadata, parameter);
- }
-
- if (metadataConstraintBody != null)
- {
- return Expression.Lambda<Func<ExportDefinition, bool>>(metadataConstraintBody, parameter);
- }
-
- return null;
- }
-
- public static Expression<Func<ExportDefinition, bool>> CreateConstraint(string contractName, string requiredTypeIdentity, IEnumerable<KeyValuePair<string, Type>> requiredMetadata, CreationPolicy requiredCreationPolicy)
- {
- ParameterExpression parameter = Expression.Parameter(typeof(ExportDefinition), "exportDefinition");
-
- Expression constraintBody = ConstraintServices.CreateContractConstraintBody(contractName, parameter);
-
- if (!string.IsNullOrEmpty(requiredTypeIdentity))
- {
- Expression typeIdentityConstraintBody = ConstraintServices.CreateTypeIdentityContraint(requiredTypeIdentity, parameter);
-
- constraintBody = Expression.AndAlso(constraintBody, typeIdentityConstraintBody);
- }
-
- if (requiredMetadata != null)
- {
- Expression metadataConstraintBody = ConstraintServices.CreateMetadataConstraintBody(requiredMetadata, parameter);
- if (metadataConstraintBody != null)
- {
- constraintBody = Expression.AndAlso(constraintBody, metadataConstraintBody);
- }
- }
-
- if (requiredCreationPolicy != CreationPolicy.Any)
- {
- Expression policyConstraintBody = ConstraintServices.CreateCreationPolicyContraint(requiredCreationPolicy, parameter);
-
- constraintBody = Expression.AndAlso(constraintBody, policyConstraintBody);
- }
-
- Expression<Func<ExportDefinition, bool>> constraint = Expression.Lambda<Func<ExportDefinition, bool>>(constraintBody, parameter);
- return constraint;
- }
-
- private static Expression CreateContractConstraintBody(string contractName, ParameterExpression parameter)
- {
- Assumes.NotNull(parameter);
-
- // export.ContractName=<contract>;
- return Expression.Equal(
- Expression.Property(parameter, ConstraintServices._exportDefinitionContractNameProperty),
- Expression.Constant(contractName ?? string.Empty, typeof(string)));
- }
-
- private static Expression CreateMetadataConstraintBody(IEnumerable<KeyValuePair<string, Type>> requiredMetadata, ParameterExpression parameter)
- {
- Assumes.NotNull(requiredMetadata);
- Assumes.NotNull(parameter);
-
- Expression body = null;
- foreach (KeyValuePair<string, Type> requiredMetadataItem in requiredMetadata)
- {
- // export.Metadata.ContainsKey(<metadataItem>)
- Expression metadataItemExpression = CreateMetadataContainsKeyExpression(parameter, requiredMetadataItem.Key);
-
- body = (body != null) ? Expression.AndAlso(body, metadataItemExpression) : metadataItemExpression;
- body = Expression.AndAlso(body, CreateMetadataOfTypeExpression(parameter, requiredMetadataItem.Key, requiredMetadataItem.Value));
- }
-
- return body;
- }
-
- private static Expression CreateCreationPolicyContraint(CreationPolicy policy, ParameterExpression parameter)
- {
- Assumes.IsTrue(policy != CreationPolicy.Any);
- Assumes.NotNull(parameter);
-
- // !definition.Metadata.ContainsKey(CompositionConstants.PartCreationPolicyMetadataName) ||
- // CreationPolicy.Any.Equals(definition.Metadata[CompositionConstants.PartCreationPolicyMetadataName]) ||
- // policy.Equals(definition.Metadata[CompositionConstants.PartCreationPolicyMetadataName]);
-
- return Expression.MakeBinary(ExpressionType.OrElse,
- Expression.MakeBinary(ExpressionType.OrElse,
- Expression.Not(CreateMetadataContainsKeyExpression(parameter, CompositionConstants.PartCreationPolicyMetadataName)),
- CreateMetadataValueEqualsExpression(parameter, CreationPolicy.Any, CompositionConstants.PartCreationPolicyMetadataName)),
- CreateMetadataValueEqualsExpression(parameter, policy, CompositionConstants.PartCreationPolicyMetadataName));
- }
-
- private static Expression CreateTypeIdentityContraint(string requiredTypeIdentity, ParameterExpression parameter)
- {
- Assumes.NotNull(requiredTypeIdentity);
- Assumes.NotNull(parameter);
-
- // definition.Metadata.ContainsKey(CompositionServices.ExportTypeIdentity) &&
- // requiredTypeIdentity.Equals(definition.Metadata[CompositionConstants.ExportTypeIdentityMetadataName]);
-
- return Expression.MakeBinary(ExpressionType.AndAlso,
- CreateMetadataContainsKeyExpression(parameter, CompositionConstants.ExportTypeIdentityMetadataName),
- CreateMetadataValueEqualsExpression(parameter, requiredTypeIdentity, CompositionConstants.ExportTypeIdentityMetadataName));
- }
-
- private static Expression CreateMetadataContainsKeyExpression(ParameterExpression parameter, string constantKey)
- {
- Assumes.NotNull(parameter, constantKey);
-
- // definition.Metadata.ContainsKey(constantKey)
- return Expression.Call(
- Expression.Property(parameter, ConstraintServices._exportDefinitionMetadataProperty),
- ConstraintServices._metadataContainsKeyMethod,
- Expression.Constant(constantKey));
- }
-
- private static Expression CreateMetadataOfTypeExpression(ParameterExpression parameter, string constantKey, Type constantType)
- {
- Assumes.NotNull(parameter, constantKey);
- Assumes.NotNull(parameter, constantType);
-
- // constantType.IsInstanceOfType(definition.Metadata[constantKey])
- return Expression.Call(
- Expression.Constant(constantType, typeof(Type)),
- ConstraintServices._typeIsInstanceOfTypeMethod,
- Expression.Call(
- Expression.Property(parameter, ConstraintServices._exportDefinitionMetadataProperty),
- ConstraintServices._metadataItemMethod,
- Expression.Constant(constantKey))
- );
- }
-
- private static Expression CreateMetadataValueEqualsExpression(ParameterExpression parameter, object constantValue, string metadataName)
- {
- Assumes.NotNull(parameter, constantValue);
-
- // constantValue.Equals(definition.Metadata[CompositionServices.PartCreationPolicyMetadataName])
- return Expression.Call(
- Expression.Constant(constantValue),
- ConstraintServices._metadataEqualsMethod,
- Expression.Call(
- Expression.Property(parameter, ConstraintServices._exportDefinitionMetadataProperty),
- ConstraintServices._metadataItemMethod,
- Expression.Constant(metadataName)));
- }
-
- public static Expression<Func<ExportDefinition, bool>> CreatePartCreatorConstraint(Expression<Func<ExportDefinition, bool>> baseConstraint, ImportDefinition productImportDefinition)
- {
- ParameterExpression exportDefinitionParameter = baseConstraint.Parameters[0];
-
- // exportDefinition.Metadata
- Expression metadataExpression = Expression.Property(exportDefinitionParameter, ConstraintServices._exportDefinitionMetadataProperty);
-
- // exportDefinition.Metadata.ContainsKey("ProductDefinition")
- Expression containsProductExpression = Expression.Call(
- metadataExpression,
- ConstraintServices._metadataContainsKeyMethod,
- Expression.Constant(CompositionConstants.ProductDefinitionMetadataName));
-
- // exportDefinition.Metadata["ProductDefinition"]
- Expression productExportDefinitionExpression = Expression.Call(
- metadataExpression,
- ConstraintServices._metadataItemMethod,
- Expression.Constant(CompositionConstants.ProductDefinitionMetadataName));
-
- // ProductImportDefinition.Contraint((ExportDefinition)exportDefinition.Metadata["ProductDefinition"])
- Expression productMatchExpression =
- Expression.Invoke(productImportDefinition.Constraint,
- Expression.Convert(productExportDefinitionExpression, typeof(ExportDefinition)));
-
- // baseContraint(exportDefinition) &&
- // exportDefinition.Metadata.ContainsKey("ProductDefinition") &&
- // ProductImportDefinition.Contraint((ExportDefinition)exportDefinition.Metadata["ProductDefinition"])
- Expression<Func<ExportDefinition, bool>> constraint =
- Expression.Lambda<Func<ExportDefinition, bool>>(
- Expression.AndAlso(
- baseConstraint.Body,
- Expression.AndAlso(
- containsProductExpression,
- productMatchExpression)),
- exportDefinitionParameter);
-
- return constraint;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ContractNameServices.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ContractNameServices.cs deleted file mode 100644 index 4285722dec6..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ContractNameServices.cs +++ /dev/null @@ -1,310 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Reflection;
-using System.Text;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition
-{
- internal static class ContractNameServices
- {
- const char NamespaceSeparator = '.';
- const char ArrayOpeningBracket = '[';
- const char ArrayClosingBracket = ']';
- const char ArraySeparator = ',';
- const char PointerSymbol = '*';
- const char ReferenceSymbol = '&';
- const char GenericArityBackQuote = '`';
- const char NestedClassSeparator = '+';
- const char ContractNameGenericOpeningBracket = '(';
- const char ContractNameGenericClosingBracket = ')';
- const char ContractNameGenericArgumentSeparator = ',';
- const char CustomModifiersSeparator = ' ';
-
- [ThreadStatic]
- private static Dictionary<Type, string> typeIdentityCache;
-
- private static Dictionary<Type, string> TypeIdentityCache
- {
- get
- {
- return typeIdentityCache = typeIdentityCache ?? new Dictionary<Type, string>();
- }
- }
-
- internal static string GetTypeIdentity(Type type)
- {
- Assumes.NotNull(type);
- string typeIdentity = null;
-
- if (!TypeIdentityCache.TryGetValue(type, out typeIdentity))
- {
- if (!type.IsAbstract && type.IsSubclassOf(typeof(Delegate)))
- {
- MethodInfo method = type.GetMethod("Invoke");
- typeIdentity = ContractNameServices.GetTypeIdentityFromMethod(method);
- }
- else
- {
- StringBuilder typeIdentityStringBuilder = new StringBuilder();
- WriteTypeWithNamespace(typeIdentityStringBuilder, type);
- typeIdentity = typeIdentityStringBuilder.ToString();
- }
-
- TypeIdentityCache.Add(type, typeIdentity);
- }
-
- return typeIdentity;
- }
-
- internal static string GetTypeIdentityFromMethod(MethodInfo method)
- {
- StringBuilder methodNameStringBuilder = new StringBuilder();
-
- WriteTypeWithNamespace(methodNameStringBuilder, method.ReturnType);
-
- methodNameStringBuilder.Append("(");
-
- ParameterInfo[] parameters = method.GetParameters();
-
- for (int i = 0; i < parameters.Length; i++)
- {
- if (i != 0)
- {
- methodNameStringBuilder.Append(",");
- }
-
- WriteTypeWithNamespace(methodNameStringBuilder, parameters[i].ParameterType);
- }
- methodNameStringBuilder.Append(")");
-
- return methodNameStringBuilder.ToString();
- }
-
- private static void WriteTypeWithNamespace(StringBuilder typeName, Type type)
- {
- // Writes type with namesapce
- if (!string.IsNullOrEmpty(type.Namespace))
- {
- typeName.Append(type.Namespace);
- typeName.Append(NamespaceSeparator);
- }
- WriteType(typeName, type);
- }
-
- private static void WriteType(StringBuilder typeName, Type type)
- {
- // Writes type name
- if (type.IsGenericType)
- {
- //
- // Reflection format stores all the generic arguments (including the ones for parent types) on the leaf type.
- // These arguments are placed in a queue and are written out based on generic arity (`X) of each type
- //
- Queue<Type> genericTypeArguments = new Queue<Type>(type.GetGenericArguments());
- WriteGenericType(typeName, type, type.IsGenericTypeDefinition, genericTypeArguments);
- Assumes.IsTrue(genericTypeArguments.Count == 0, "Expecting genericTypeArguments queue to be empty.");
- }
- else
- {
- WriteNonGenericType(typeName, type);
- }
- }
-
- private static void WriteNonGenericType(StringBuilder typeName, Type type)
- {
- //
- // Writes non-generic type
- //
- if (type.DeclaringType != null)
- {
- WriteType(typeName, type.DeclaringType);
- typeName.Append(NestedClassSeparator);
- }
- if (type.IsArray)
- {
- WriteArrayType(typeName, type);
- }
- else if (type.IsPointer)
- {
- WritePointerType(typeName, type);
- }
- else if (type.IsByRef)
- {
- WriteByRefType(typeName, type);
- }
- else
- {
- typeName.Append(type.Name);
- }
- }
-
- private static void WriteArrayType(StringBuilder typeName, Type type)
- {
- //
- // Writes array type e.g <TypeName>[]
- // Note that jagged arrays are stored in reverse order
- // e.g. C#: Int32[][,] Reflection: Int32[,][]
- // we are following C# order for arrays
- //
- Type rootElementType = FindArrayElementType(type);
- WriteType(typeName, rootElementType);
- Type elementType = type;
- do
- {
- WriteArrayTypeDimensions(typeName, elementType);
- }
- while ((elementType = elementType.GetElementType()) != null && elementType.IsArray);
- }
-
- private static void WritePointerType(StringBuilder typeName, Type type)
- {
- //
- // Writes pointer type e.g <TypeName>*
- //
- WriteType(typeName, type.GetElementType());
- typeName.Append(PointerSymbol);
- }
-
- private static void WriteByRefType(StringBuilder typeName, Type type)
- {
- //
- // Writes by ref type e.g <TypeName>&
- //
- WriteType(typeName, type.GetElementType());
- typeName.Append(ReferenceSymbol);
- }
-
- private static void WriteArrayTypeDimensions(StringBuilder typeName, Type type)
- {
- //
- // Writes array type dimensions e.g. [,,]
- //
- typeName.Append(ArrayOpeningBracket);
- int rank = type.GetArrayRank();
- for (int i = 1; i < rank; i++)
- {
- typeName.Append(ArraySeparator);
- }
- typeName.Append(ArrayClosingBracket);
- }
-
- private static void WriteGenericType(StringBuilder typeName, Type type, bool isDefinition, Queue<Type> genericTypeArguments)
- {
- //
- // Writes generic type including parent generic types
- // genericTypeArguments contains type arguments obtained from the most nested type
- // isDefinition parameter indicates if we are dealing with generic type definition
- //
- if (type.DeclaringType != null)
- {
- if (type.DeclaringType.IsGenericType)
- {
- WriteGenericType(typeName, type.DeclaringType, isDefinition, genericTypeArguments);
- }
- else
- {
- WriteNonGenericType(typeName, type.DeclaringType);
- }
- typeName.Append(NestedClassSeparator);
- }
- WriteGenericTypeName(typeName, type, isDefinition, genericTypeArguments);
- }
-
- private static void WriteGenericTypeName(StringBuilder typeName, Type type, bool isDefinition, Queue<Type> genericTypeArguments)
- {
- //
- // Writes generic type name, e.g. generic name and generic arguments
- //
- Assumes.IsTrue(type.IsGenericType, "Expecting type to be a generic type");
- int genericArity = GetGenericArity(type);
- string genericTypeName = FindGenericTypeName(type.GetGenericTypeDefinition().Name);
- typeName.Append(genericTypeName);
- WriteTypeArgumentsString(typeName, genericArity, isDefinition, genericTypeArguments);
- }
-
- private static void WriteTypeArgumentsString(StringBuilder typeName, int argumentsCount, bool isDefinition, Queue<Type> genericTypeArguments)
- {
- //
- // Writes type arguments in brackets, e.g. (<contract_name1>, <contract_name2>, ...)
- //
- if (argumentsCount == 0)
- {
- return;
- }
- typeName.Append(ContractNameGenericOpeningBracket);
- for (int i = 0; i < argumentsCount; i++)
- {
- Assumes.IsTrue(genericTypeArguments.Count > 0, "Expecting genericTypeArguments to contain at least one Type");
- Type genericTypeArgument = genericTypeArguments.Dequeue();
- if (!isDefinition)
- {
- WriteTypeWithNamespace(typeName, genericTypeArgument);
- }
- typeName.Append(ContractNameGenericArgumentSeparator);
- }
- typeName.Remove(typeName.Length - 1, 1);
- typeName.Append(ContractNameGenericClosingBracket);
- }
-
- //internal for testability
- internal static void WriteCustomModifiers(StringBuilder typeName, string customKeyword, Type[] types)
- {
- //
- // Writes custom modifiers in the format: customKeyword(<contract_name>,<contract_name>,...)
- //
- typeName.Append(CustomModifiersSeparator);
- typeName.Append(customKeyword);
- Queue<Type> typeArguments = new Queue<Type>(types);
- WriteTypeArgumentsString(typeName, types.Length, false, typeArguments);
- Assumes.IsTrue(typeArguments.Count == 0, "Expecting genericTypeArguments queue to be empty.");
- }
-
- private static Type FindArrayElementType(Type type)
- {
- //
- // Gets array element type by calling GetElementType() until the element is not an array
- //
- Type elementType = type;
- while ((elementType = elementType.GetElementType()) != null && elementType.IsArray) { }
- return elementType;
- }
-
- private static string FindGenericTypeName(string genericName)
- {
- //
- // Gets generic type name omitting the backquote and arity indicator
- // List`1 -> List
- // Arity indicator is returned as output parameter
- //
- int indexOfBackQuote = genericName.IndexOf(GenericArityBackQuote);
- if (indexOfBackQuote > -1)
- {
- genericName = genericName.Substring(0, indexOfBackQuote);
- }
- return genericName;
- }
-
- private static int GetGenericArity(Type type)
- {
- if (type.DeclaringType == null)
- {
- return type.GetGenericArguments().Length;
- }
-
- // The generic arity is equal to the difference in the number of generic arguments
- // from the type and the declaring type.
-
- int delclaringTypeGenericArguments = type.DeclaringType.GetGenericArguments().Length;
- int typeGenericArguments = type.GetGenericArguments().Length;
-
- Assumes.IsTrue(typeGenericArguments >= delclaringTypeGenericArguments);
-
- return typeGenericArguments - delclaringTypeGenericArguments;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/CreationPolicy.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/CreationPolicy.cs deleted file mode 100644 index 5a8d4cb158b..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/CreationPolicy.cs +++ /dev/null @@ -1,36 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition
-{
- /// <summary>
- /// Option placed on a type that controls when the <see cref="CompositionContainer"/> creates
- /// a new instance of a <see cref="ComposablePart"/>.
- /// </summary>
- public enum CreationPolicy : int
- {
- /// <summary>
- /// Let the <see cref="CompositionContainer"/> choose the most appropriate <see cref="CreationPolicy"/>
- /// for the part given the current context. This is the default <see cref="CreationPolicy"/>, with
- /// the <see cref="CompositionContainer"/> choosing <see cref="CreationPolicy.Shared"/> by default
- /// unless the <see cref="ComposablePart"/> or importer requests <see cref="CreationPolicy.NonShared"/>.
- /// </summary>
- Any = 0,
-
- /// <summary>
- /// A single shared instance of the associated <see cref="ComposablePart"/> will be created
- /// by the <see cref="CompositionContainer"/> and shared by all requestors.
- /// </summary>
- Shared = 1,
-
- /// <summary>
- /// A new non-shared instance of the associated <see cref="ComposablePart"/> will be created
- /// by the <see cref="CompositionContainer"/> for every requestor.
- /// </summary>
- NonShared = 2,
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Diagnostics/.gitattributes b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Diagnostics/.gitattributes deleted file mode 100644 index 8ab95b78fe5..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Diagnostics/.gitattributes +++ /dev/null @@ -1,6 +0,0 @@ -/CompositionTrace.cs -crlf -/CompositionTraceId.cs -crlf -/CompositionTraceSource.cs -crlf -/SilverlightTraceWriter.cs -crlf -/TraceSourceTraceWriter.cs -crlf -/TraceWriter.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Diagnostics/CompositionTrace.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Diagnostics/CompositionTrace.cs deleted file mode 100644 index ed0cb4bcc51..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Diagnostics/CompositionTrace.cs +++ /dev/null @@ -1,106 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.ReflectionModel;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.Diagnostics
-{
- internal static class CompositionTrace
- {
- internal static void PartDefinitionResurrected(ComposablePartDefinition definition)
- {
- Assumes.NotNull(definition);
-
- if (CompositionTraceSource.CanWriteInformation)
- {
- CompositionTraceSource.WriteInformation(CompositionTraceId.Rejection_DefinitionResurrected,
- Strings.CompositionTrace_Rejection_DefinitionResurrected,
- definition.GetDisplayName());
- }
- }
-
- internal static void PartDefinitionRejected(ComposablePartDefinition definition, ChangeRejectedException exception)
- {
- Assumes.NotNull(definition, exception);
-
- if (CompositionTraceSource.CanWriteWarning)
- {
- CompositionTraceSource.WriteWarning(CompositionTraceId.Rejection_DefinitionRejected,
- Strings.CompositionTrace_Rejection_DefinitionRejected,
- definition.GetDisplayName(),
- exception.Message);
- }
- }
-
-#if !SILVERLIGHT
-
- internal static void AssemblyLoadFailed(DirectoryCatalog catalog, string fileName, Exception exception)
- {
- Assumes.NotNull(catalog, exception);
- Assumes.NotNullOrEmpty(fileName);
-
- if (CompositionTraceSource.CanWriteWarning)
- {
- CompositionTraceSource.WriteWarning(CompositionTraceId.Discovery_AssemblyLoadFailed,
- Strings.CompositionTrace_Discovery_AssemblyLoadFailed,
- catalog.GetDisplayName(),
- fileName,
- exception.Message);
- }
- }
-
-#endif
-
- internal static void DefinitionMarkedWithPartNotDiscoverableAttribute(Type type)
- {
- Assumes.NotNull(type);
-
- if (CompositionTraceSource.CanWriteInformation)
- {
- CompositionTraceSource.WriteInformation(CompositionTraceId.Discovery_DefinitionMarkedWithPartNotDiscoverableAttribute,
- Strings.CompositionTrace_Discovery_DefinitionMarkedWithPartNotDiscoverableAttribute,
- type.GetDisplayName());
- }
- }
-
- internal static void DefinitionContainsGenericsParameters(Type type)
- {
- Assumes.NotNull(type);
-
- if (CompositionTraceSource.CanWriteInformation)
- {
- CompositionTraceSource.WriteInformation(CompositionTraceId.Discovery_DefinitionContainsGenericParameters,
- Strings.CompositionTrace_Discovery_DefinitionContainsGenericParameters,
- type.GetDisplayName());
- }
- }
-
- internal static void DefinitionContainsNoExports(Type type)
- {
- Assumes.NotNull(type);
-
- if (CompositionTraceSource.CanWriteInformation)
- {
- CompositionTraceSource.WriteInformation(CompositionTraceId.Discovery_DefinitionContainsNoExports,
- Strings.CompositionTrace_Discovery_DefinitionContainsNoExports,
- type.GetDisplayName());
- }
- }
-
- internal static void MemberMarkedWithMultipleImportAndImportMany(ReflectionItem item)
- {
- Assumes.NotNull(item);
-
- if (CompositionTraceSource.CanWriteError)
- {
- CompositionTraceSource.WriteError(CompositionTraceId.Discovery_MemberMarkedWithMultipleImportAndImportMany,
- Strings.CompositionTrace_Discovery_MemberMarkedWithMultipleImportAndImportMany,
- item.GetDisplayName());
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Diagnostics/CompositionTraceId.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Diagnostics/CompositionTraceId.cs deleted file mode 100644 index 2fa8bcf45e8..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Diagnostics/CompositionTraceId.cs +++ /dev/null @@ -1,24 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-
-namespace System.ComponentModel.Composition.Diagnostics
-{
- // NOTE: Do not change the trace ids of values that have already shipped,
- // these leak out to TraceListerners which could take a dependency on them.
- // This enum is a ushort deliberately, the maximum value of a trace id is 65535.
- internal enum CompositionTraceId : ushort
- {
- // Rejection
-
- Rejection_DefinitionRejected = 1,
- Rejection_DefinitionResurrected = 2,
-
- Discovery_AssemblyLoadFailed = 3,
- Discovery_DefinitionMarkedWithPartNotDiscoverableAttribute = 4,
- Discovery_DefinitionContainsGenericParameters = 5,
- Discovery_DefinitionContainsNoExports = 6,
- Discovery_MemberMarkedWithMultipleImportAndImportMany = 7,
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Diagnostics/CompositionTraceSource.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Diagnostics/CompositionTraceSource.cs deleted file mode 100644 index bf5ba23580b..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Diagnostics/CompositionTraceSource.cs +++ /dev/null @@ -1,58 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.Diagnostics
-{
- internal static class CompositionTraceSource
- {
-#if SILVERLIGHT
- private static readonly SilverlightTraceWriter Source = new SilverlightTraceWriter();
-#else
- private static readonly TraceSourceTraceWriter Source = new TraceSourceTraceWriter();
-#endif
-
- public static bool CanWriteInformation
- {
- get { return Source.CanWriteInformation; }
- }
-
- public static bool CanWriteWarning
- {
- get { return Source.CanWriteWarning; }
- }
-
- public static bool CanWriteError
- {
- get { return Source.CanWriteError; }
- }
-
- public static void WriteInformation(CompositionTraceId traceId, string format, params object[] arguments)
- {
- EnsureEnabled(CanWriteInformation);
-
- Source.WriteInformation(traceId, format, arguments);
- }
-
- public static void WriteWarning(CompositionTraceId traceId, string format, params object[] arguments)
- {
- EnsureEnabled(CanWriteWarning);
-
- Source.WriteWarning(traceId, format, arguments);
- }
-
- public static void WriteError(CompositionTraceId traceId, string format, params object[] arguments)
- {
- EnsureEnabled(CanWriteError);
-
- Source.WriteError(traceId, format, arguments);
- }
-
- private static void EnsureEnabled(bool condition)
- {
- Assumes.IsTrue(condition, "To avoid unnecessary work when a trace level has not been enabled, check CanWriteXXX before calling this method.");
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Diagnostics/SilverlightTraceWriter.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Diagnostics/SilverlightTraceWriter.cs deleted file mode 100644 index 11bfabd31e9..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Diagnostics/SilverlightTraceWriter.cs +++ /dev/null @@ -1,90 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-#if SILVERLIGHT
-
-using System;
-using System.Diagnostics;
-using System.Globalization;
-using System.Text;
-
-namespace System.ComponentModel.Composition.Diagnostics
-{
- internal sealed class SilverlightTraceWriter : TraceWriter
- {
- private static readonly string SourceName = "System.ComponentModel.Composition";
-
- public override bool CanWriteInformation
- {
- get { return false; }
- }
-
- public override bool CanWriteWarning
- {
- get { return Debugger.IsLogging(); }
- }
-
- public override bool CanWriteError
- {
- get { return Debugger.IsLogging(); }
- }
-
- public override void WriteInformation(CompositionTraceId traceId, string format, params object[] arguments)
- {
- WriteEvent(TraceEventType.Information, traceId, format, arguments);
- }
-
- public override void WriteWarning(CompositionTraceId traceId, string format, params object[] arguments)
- {
- WriteEvent(TraceEventType.Warning, traceId, format, arguments);
- }
-
- public override void WriteError(CompositionTraceId traceId, string format, params object[] arguments)
- {
- WriteEvent(TraceEventType.Error, traceId, format, arguments);
- }
-
- private static void WriteEvent(TraceEventType eventType, CompositionTraceId traceId, string format, params object[] arguments)
- {
- if (!Debugger.IsLogging())
- {
- return;
- }
-
- string logMessage = CreateLogMessage(eventType, traceId, format, arguments);
- Debugger.Log(0, null, logMessage);
- }
-
- internal static string CreateLogMessage(TraceEventType eventType, CompositionTraceId traceId, string format, params object[] arguments)
- {
- StringBuilder messageBuilder = new StringBuilder();
-
- // Format taken from TraceListener.TraceEvent in full framework
- messageBuilder.AppendFormat(CultureInfo.InvariantCulture, "{0} {1}: {2} : ",
- SourceName, eventType.ToString(), (int)traceId);
-
- if (arguments == null)
- {
- messageBuilder.Append(format);
- }
- else
- {
- messageBuilder.AppendFormat(CultureInfo.InvariantCulture, format, arguments);
- }
-
- messageBuilder.AppendLine();
-
- return messageBuilder.ToString();
- }
-
- // Copied from TraceEventType in full framework
- internal enum TraceEventType
- {
- Error = 2,
- Warning = 4,
- Information = 8,
- }
- }
-}
-
-#endif
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Diagnostics/TraceSourceTraceWriter.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Diagnostics/TraceSourceTraceWriter.cs deleted file mode 100644 index b9ada437c2e..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Diagnostics/TraceSourceTraceWriter.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-#if !SILVERLIGHT
-
-using System;
-using System.Diagnostics;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.Diagnostics
-{
- // Represents a trace writer that writes to a System.Diagnostics TraceSource
- internal sealed class TraceSourceTraceWriter : TraceWriter
- {
- internal static readonly TraceSource Source = new TraceSource("System.ComponentModel.Composition", SourceLevels.Warning);
-
- public override bool CanWriteInformation
- {
- get { return Source.Switch.ShouldTrace(TraceEventType.Information); }
- }
-
- public override bool CanWriteWarning
- {
- get { return Source.Switch.ShouldTrace(TraceEventType.Warning); }
- }
-
- public override bool CanWriteError
- {
- get { return Source.Switch.ShouldTrace(TraceEventType.Error); }
- }
-
- public override void WriteInformation(CompositionTraceId traceId, string format, params object[] arguments)
- {
- WriteEvent(TraceEventType.Information, traceId, format, arguments);
- }
-
- public override void WriteWarning(CompositionTraceId traceId, string format, params object[] arguments)
- {
- WriteEvent(TraceEventType.Warning, traceId, format, arguments);
- }
-
- public override void WriteError(CompositionTraceId traceId, string format, params object[] arguments)
- {
- WriteEvent(TraceEventType.Error, traceId, format, arguments);
- }
-
- private static void WriteEvent(TraceEventType eventType, CompositionTraceId traceId, string format, params object[] arguments)
- {
- Source.TraceEvent(eventType, (int)traceId, format, arguments);
- }
- }
-}
-
-#endif
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Diagnostics/TraceWriter.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Diagnostics/TraceWriter.cs deleted file mode 100644 index da3415f677d..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Diagnostics/TraceWriter.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-
-using System;
-
-namespace System.ComponentModel.Composition.Diagnostics
-{
- internal abstract class TraceWriter
- {
- public abstract bool CanWriteInformation
- {
- get;
- }
-
- public abstract bool CanWriteWarning
- {
- get;
- }
-
- public abstract bool CanWriteError
- {
- get;
- }
-
- public abstract void WriteInformation(CompositionTraceId traceId, string format, params object[] arguments);
-
- public abstract void WriteWarning(CompositionTraceId traceId, string format, params object[] arguments);
-
- public abstract void WriteError(CompositionTraceId traceId, string format, params object[] arguments);
- }
-}
-
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ErrorBuilder.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ErrorBuilder.cs deleted file mode 100644 index 14ca13364e7..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ErrorBuilder.cs +++ /dev/null @@ -1,102 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition
-{
- internal static class ErrorBuilder
- {
- public static CompositionError PreventedByExistingImport(ComposablePart part, ImportDefinition import)
- {
- return CompositionError.Create(
- CompositionErrorId.ImportEngine_PreventedByExistingImport,
- Strings.ImportEngine_PreventedByExistingImport,
- import.ToElement().DisplayName,
- part.ToElement().DisplayName);
- }
-
- public static CompositionError InvalidStateForRecompposition(ComposablePart part)
- {
- return CompositionError.Create(
- CompositionErrorId.ImportEngine_InvalidStateForRecomposition,
- Strings.ImportEngine_InvalidStateForRecomposition,
- part.ToElement().DisplayName);
- }
-
- public static CompositionError ComposeTookTooManyIterations(int maximumNumberOfCompositionIterations)
- {
- return CompositionError.Create(
- CompositionErrorId.ImportEngine_ComposeTookTooManyIterations,
- Strings.ImportEngine_ComposeTookTooManyIterations,
- maximumNumberOfCompositionIterations);
- }
-
- public static CompositionError CreateImportCardinalityMismatch(ImportCardinalityMismatchException exception, ImportDefinition definition)
- {
- Assumes.NotNull(exception, definition);
-
- return CompositionError.Create(
- CompositionErrorId.ImportEngine_ImportCardinalityMismatch,
- exception.Message,
- definition.ToElement(),
- (Exception)null);
- }
-
- public static CompositionError CreatePartCannotActivate(ComposablePart part, Exception innerException)
- {
- Assumes.NotNull(part, innerException);
-
- ICompositionElement element = part.ToElement();
- return CompositionError.Create(
- CompositionErrorId.ImportEngine_PartCannotActivate,
- element,
- innerException,
- Strings.ImportEngine_PartCannotActivate,
- element.DisplayName);
- }
-
- public static CompositionError CreatePartCannotSetImport(ComposablePart part, ImportDefinition definition, Exception innerException)
- {
- Assumes.NotNull(part, definition, innerException);
-
- ICompositionElement element = definition.ToElement();
- return CompositionError.Create(
- CompositionErrorId.ImportEngine_PartCannotSetImport,
- element,
- innerException,
- Strings.ImportEngine_PartCannotSetImport,
- element.DisplayName,
- part.ToElement().DisplayName);
- }
-
- public static CompositionError CreateCannotGetExportedValue(ComposablePart part, ExportDefinition definition, Exception innerException)
- {
- Assumes.NotNull(part, definition, innerException);
-
- ICompositionElement element = definition.ToElement();
- return CompositionError.Create(
- CompositionErrorId.ImportEngine_PartCannotGetExportedValue,
- element,
- innerException,
- Strings.ImportEngine_PartCannotGetExportedValue,
- element.DisplayName,
- part.ToElement().DisplayName);
- }
-
- public static CompositionError CreatePartCycle(ComposablePart part)
- {
- Assumes.NotNull(part);
-
- ICompositionElement element = part.ToElement();
- return CompositionError.Create(
- CompositionErrorId.ImportEngine_PartCycle,
- element,
- Strings.ImportEngine_PartCycle,
- element.DisplayName);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ExceptionBuilder.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ExceptionBuilder.cs deleted file mode 100644 index ed42b30f5df..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ExceptionBuilder.cs +++ /dev/null @@ -1,78 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Globalization;
-using System.Reflection;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition
-{
- internal static class ExceptionBuilder
- {
- public static Exception CreateDiscoveryException(string messageFormat, params string[] arguments)
- {
- // DiscoveryError (Dev10:602872): This should go through the discovery error reporting when
- // we add a way to report discovery errors properly.
- return new InvalidOperationException(Format(messageFormat, arguments));
- }
-
- public static ArgumentException CreateContainsNullElement(string parameterName)
- {
- Assumes.NotNull(parameterName);
-
- string message = Format(Strings.Argument_NullElement, parameterName);
-
- return new ArgumentException(message, parameterName);
- }
-
- public static ObjectDisposedException CreateObjectDisposed(object instance)
- {
- Assumes.NotNull(instance);
-
- return new ObjectDisposedException(instance.GetType().ToString());
- }
-
- public static NotImplementedException CreateNotOverriddenByDerived(string memberName)
- {
- Assumes.NotNullOrEmpty(memberName);
-
- string message = Format(Strings.NotImplemented_NotOverriddenByDerived, memberName);
-
- return new NotImplementedException(message);
- }
-
- public static ArgumentException CreateExportDefinitionNotOnThisComposablePart(string parameterName)
- {
- Assumes.NotNullOrEmpty(parameterName);
-
- string message = Format(Strings.ExportDefinitionNotOnThisComposablePart, parameterName);
-
- return new ArgumentException(message, parameterName);
- }
-
- public static ArgumentException CreateImportDefinitionNotOnThisComposablePart(string parameterName)
- {
- Assumes.NotNullOrEmpty(parameterName);
-
- string message = Format(Strings.ImportDefinitionNotOnThisComposablePart, parameterName);
-
- return new ArgumentException(message, parameterName);
- }
-
- public static CompositionException CreateCannotGetExportedValue(ComposablePart part, ExportDefinition definition, Exception innerException)
- {
- Assumes.NotNull(part, definition, innerException);
-
- return new CompositionException(
- ErrorBuilder.CreateCannotGetExportedValue(part, definition, innerException));
- }
-
- private static string Format(string format, params string[] arguments)
- {
- return String.Format(CultureInfo.CurrentCulture, format, arguments);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ExportAttribute.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ExportAttribute.cs deleted file mode 100644 index 6882f92a494..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ExportAttribute.cs +++ /dev/null @@ -1,144 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Hosting;
-using System.Diagnostics.CodeAnalysis;
-
-namespace System.ComponentModel.Composition
-{
- /// <summary>
- /// Specifies that a type, property, field, or method provides a particular export.
- /// </summary>
- [SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
- [AttributeUsage(AttributeTargets.Class | AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method,
- AllowMultiple = true, Inherited = false)]
- public class ExportAttribute : Attribute
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
- /// type or member marked with this attribute under the default contract name.
- /// </summary>
- /// <remarks>
- /// <para>
- /// The default contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the type of the
- /// property or field, or the type itself, that is marked with this attribute.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- public ExportAttribute()
- : this((string)null, (Type)null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
- /// type or member marked with this attribute under a contract name derived from the
- /// specified type.
- /// </summary>
- /// <param name="contractType">
- /// A <see cref="Type"/> of which to derive the contract name to export the type or
- /// member marked with this attribute, under; or <see langword="null"/> to use the
- /// default contract name.
- /// </param>
- /// <remarks>
- /// <para>
- /// The contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on
- /// <paramref name="contractType"/>.
- /// </para>
- /// <para>
- /// The default contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the type of the
- /// property or field, or the type itself, that is marked with this attribute.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- public ExportAttribute(Type contractType)
- : this((string)null, contractType)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
- /// type or member marked with this attribute under the specified contract name.
- /// </summary>
- /// <param name="contractName">
- /// A <see cref="String"/> containing the contract name to export the type or member
- /// marked with this attribute, under; or <see langword="null"/> or an empty string
- /// ("") to use the default contract name.
- /// </param>
- /// <remarks>
- /// <para>
- /// The default contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the property or field
- /// type, or the type itself that this is marked with this attribute.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- public ExportAttribute(string contractName)
- : this(contractName, (Type)null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
- /// type or member marked with this attribute under the specified contract name.
- /// </summary>
- /// <param name="contractName">
- /// A <see cref="String"/> containing the contract name to export the type or member
- /// marked with this attribute, under; or <see langword="null"/> or an empty string
- /// ("") to use the default contract name.
- /// </param>
- /// <param name="contractType">
- /// A <see cref="Type"/> of which to derive the contract name to export the type or
- /// member marked with this attribute, under; or <see langword="null"/> to use the
- /// default contract name.
- /// </param>
- /// <remarks>
- /// <para>
- /// The default contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the property or field
- /// type, or the type itself that this is marked with this attribute.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- public ExportAttribute(string contractName, Type contractType)
- {
- this.ContractName = contractName;
- this.ContractType = contractType;
- }
-
- /// <summary>
- /// Gets the contract name to export the type or member under.
- /// </summary>
- /// <value>
- /// A <see cref="String"/> containing the contract name to export the type or member
- /// marked with this attribute, under. The default value is an empty string ("").
- /// </value>
- public string ContractName { get; private set; }
-
- /// <summary>
- /// Get the contract type that is exported by the member that this attribute is attached to.
- /// </summary>
- /// <value>
- /// A <see cref="Type"/> of the export that is be provided. The default value is
- /// <see langword="null"/> which means that the type will be obtained by looking at the type on
- /// the member that this export is attached to.
- /// </value>
- public Type ContractType { get; private set; }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ExportCardinalityCheckResult.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ExportCardinalityCheckResult.cs deleted file mode 100644 index 5786d48c5df..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ExportCardinalityCheckResult.cs +++ /dev/null @@ -1,14 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-
-namespace System.ComponentModel.Composition
-{
- internal enum ExportCardinalityCheckResult : int
- {
- Match,
- NoExports,
- TooManyExports
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ExportMetadataAttribute.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ExportMetadataAttribute.cs deleted file mode 100644 index 67a38cbd8f2..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ExportMetadataAttribute.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-
-namespace System.ComponentModel.Composition
-{
- /// <summary>
- /// Specifies metadata for a type, property, field, or method marked with the
- /// <see cref="ExportAttribute"/>.
- /// </summary>
- [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Property | AttributeTargets.Method | AttributeTargets.Field,
- AllowMultiple = true, Inherited = false)]
- public sealed class ExportMetadataAttribute : Attribute
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ExportMetadataAttribute"/> with the
- /// specified name and metadata value.
- /// </summary>
- /// <param name="name">
- /// A <see cref="String"/> containing the name of the metadata value; or
- /// <see langword="null"/> to set the <see cref="Name"/> property to an empty
- /// string ("").
- /// </param>
- /// <param name="value">
- /// An <see cref="object"/> containing the metadata value. This can be
- /// <see langword="null"/>.
- /// </param>
- public ExportMetadataAttribute(string name, object value)
- {
- this.Name = name ?? string.Empty;
- this.Value = value;
- }
-
- /// <summary>
- /// Gets the name of the metadata value.
- /// </summary>
- /// <value>
- /// A <see cref="String"/> containing the name of the metadata value.
- /// </value>
- public string Name
- {
- get;
- private set;
- }
-
- /// <summary>
- /// Gets the metadata value.
- /// </summary>
- /// <value>
- /// An <see cref="object"/> containing the metadata value.
- /// </value>
- public object Value
- {
- get;
- private set;
- }
-
- public bool IsMultiple
- {
- get;
- set;
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ExportServices.DisposableLazy.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ExportServices.DisposableLazy.cs deleted file mode 100644 index af8dc0ff8e6..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ExportServices.DisposableLazy.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Primitives;
-using System.Globalization;
-using Microsoft.Internal;
-using System.Collections.Generic;
-
-namespace System.ComponentModel.Composition
-{
- partial class ExportServices
- {
- private sealed class DisposableLazy<T, TMetadataView> : Lazy<T, TMetadataView>, IDisposable
- {
- private IDisposable _disposable;
-
- public DisposableLazy(Func<T> valueFactory, TMetadataView metadataView, IDisposable disposable)
- : base(valueFactory, metadataView)
- {
- Assumes.NotNull(disposable);
-
- this._disposable = disposable;
- }
-
- void IDisposable.Dispose()
- {
- this._disposable.Dispose();
- }
- }
-
- private sealed class DisposableLazy<T> : Lazy<T>, IDisposable
- {
- private IDisposable _disposable;
-
- public DisposableLazy(Func<T> valueFactory, IDisposable disposable)
- : base(valueFactory)
- {
- Assumes.NotNull(disposable);
-
- this._disposable = disposable;
- }
-
- void IDisposable.Dispose()
- {
- this._disposable.Dispose();
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ExportServices.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ExportServices.cs deleted file mode 100644 index 9aa11951d59..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ExportServices.cs +++ /dev/null @@ -1,249 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Diagnostics.CodeAnalysis;
-using System.Globalization;
-using System.Linq;
-using System.Reflection;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-
-namespace System.ComponentModel.Composition
-{
- // Provides helpers for creating and dealing with Exports
- internal static partial class ExportServices
- {
- private static readonly MethodInfo _createStronglyTypedLazyOfTM = typeof(ExportServices).GetMethod("CreateStronglyTypedLazyOfTM", BindingFlags.NonPublic | BindingFlags.Static);
- private static readonly MethodInfo _createStronglyTypedLazyOfT = typeof(ExportServices).GetMethod("CreateStronglyTypedLazyOfT", BindingFlags.NonPublic | BindingFlags.Static);
- private static readonly MethodInfo _createSemiStronglyTypedLazy = typeof(ExportServices).GetMethod("CreateSemiStronglyTypedLazy", BindingFlags.NonPublic | BindingFlags.Static);
- private static readonly MethodInfo _createStronglyTypedExportFactoryOfT = typeof(ExportServices).GetMethod("CreateStronglyTypedExportFactoryOfT", BindingFlags.NonPublic | BindingFlags.Static);
- private static readonly MethodInfo _createStronglyTypedExportFactoryOfTM = typeof(ExportServices).GetMethod("CreateStronglyTypedExportFactoryOfTM", BindingFlags.NonPublic | BindingFlags.Static);
-
- internal static readonly Type DefaultMetadataViewType = typeof(IDictionary<string, object>);
- internal static readonly Type DefaultExportedValueType = typeof(object);
-
- internal static bool IsDefaultMetadataViewType(Type metadataViewType)
- {
- Assumes.NotNull(metadataViewType);
-
- // Consider all types that IDictionary<string, object> derives from, such
- // as ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>
- // and IEnumerable, as default metadata view
- return metadataViewType.IsAssignableFrom(DefaultMetadataViewType);
- }
-
- internal static bool IsDictionaryConstructorViewType(Type metadataViewType)
- {
- Assumes.NotNull(metadataViewType);
-
- // Does the view type have a constructor that is a Dictionary<string, object>
- return metadataViewType.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
- Type.DefaultBinder,
- new Type[] { typeof(IDictionary<string, object>) },
- new ParameterModifier[0]) != null;
- }
-
- internal static Func<Export, object> CreateStronglyTypedLazyFactory(Type exportType, Type metadataViewType)
- {
- MethodInfo genericMethod = null;
- if (metadataViewType != null)
- {
- genericMethod = _createStronglyTypedLazyOfTM.MakeGenericMethod(exportType ?? ExportServices.DefaultExportedValueType, metadataViewType);
- }
- else
- {
- genericMethod = _createStronglyTypedLazyOfT.MakeGenericMethod(exportType ?? ExportServices.DefaultExportedValueType);
- }
- Assumes.NotNull(genericMethod);
- return (Func<Export, object>)Delegate.CreateDelegate(typeof(Func<Export, object>), genericMethod);
- }
-
- internal static Func<Export, Lazy<object, object>> CreateSemiStronglyTypedLazyFactory(Type exportType, Type metadataViewType)
- {
- MethodInfo genericMethod = _createSemiStronglyTypedLazy.MakeGenericMethod(
- exportType ?? ExportServices.DefaultExportedValueType,
- metadataViewType ?? ExportServices.DefaultMetadataViewType);
- Assumes.NotNull(genericMethod);
- return (Func<Export, Lazy<object, object>>)Delegate.CreateDelegate(typeof(Func<Export, Lazy<object,object>>), genericMethod);
- }
-
- [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
- internal static Lazy<T, M> CreateStronglyTypedLazyOfTM<T, M>(Export export)
- {
- IDisposable disposable = export as IDisposable;
- if (disposable != null)
- {
- return new DisposableLazy<T, M>(
- () => ExportServices.GetCastedExportedValue<T>(export),
- AttributedModelServices.GetMetadataView<M>(export.Metadata),
- disposable);
- }
- else
- {
- return new Lazy<T, M>(
- () => ExportServices.GetCastedExportedValue<T>(export),
- AttributedModelServices.GetMetadataView<M>(export.Metadata),
- false);
- }
- }
-
- [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
- internal static Lazy<T> CreateStronglyTypedLazyOfT<T>(Export export)
- {
- IDisposable disposable = export as IDisposable;
- if (disposable != null)
- {
- return new DisposableLazy<T>(
- () => ExportServices.GetCastedExportedValue<T>(export),
- disposable);
- }
- else
- {
- return new Lazy<T>(() => ExportServices.GetCastedExportedValue<T>(export), false);
-
- }
- }
-
- [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
- internal static Lazy<object, object> CreateSemiStronglyTypedLazy<T, M>(Export export)
- {
- IDisposable disposable = export as IDisposable;
- if (disposable != null)
- {
- return new DisposableLazy<object, object>(
- () => ExportServices.GetCastedExportedValue<T>(export),
- AttributedModelServices.GetMetadataView<M>(export.Metadata),
- disposable);
- }
- else
- {
- return new Lazy<object, object>(
- () => ExportServices.GetCastedExportedValue<T>(export),
- AttributedModelServices.GetMetadataView<M>(export.Metadata),
- false
- );
- }
- }
-
- internal static Func<Export, object> CreateStronglyTypedExportFactoryFactory(Type exportType, Type metadataType, ConstructorInfo constructor)
- {
- MethodInfo genericMethod = null;
- if (metadataType == null)
- {
- genericMethod = _createStronglyTypedExportFactoryOfT.MakeGenericMethod(exportType);
- }
- else
- {
- genericMethod = _createStronglyTypedExportFactoryOfTM.MakeGenericMethod(exportType, metadataType);
- }
-
- Assumes.NotNull(genericMethod);
- Func<Export, ConstructorInfo, object> exportFactoryFactory = (Func<Export, ConstructorInfo, object>)Delegate.CreateDelegate(typeof(Func<Export, ConstructorInfo, object>), genericMethod);
- return (e) => exportFactoryFactory.Invoke(e, constructor);
- }
-
- private static Tuple<T, Action> GetExportLifetimeContextFromExport<T>(Export export)
- {
- T exportedValue;
- Action disposeAction;
- IDisposable disposable = null;
-
- CatalogExportProvider.PartCreatorExport partCreatorExport = export as CatalogExportProvider.PartCreatorExport;
-
- if (partCreatorExport != null)
- {
- // PartCreatorExport is the more optimized route
- Export exportProduct = partCreatorExport.CreateExportProduct();
- exportedValue = GetCastedExportedValue<T>(exportProduct);
- disposable = exportProduct as IDisposable;
- }
- else
- {
- // If it comes from somewhere else we walk through the ComposablePartDefinition
- var factoryPartDefinition = GetCastedExportedValue<ComposablePartDefinition>(export);
- var part = factoryPartDefinition.CreatePart();
- var exportDef = factoryPartDefinition.ExportDefinitions.Single();
-
- exportedValue = CastExportedValue<T>(part.ToElement(), part.GetExportedValue(exportDef));
- disposable = part as IDisposable;
- }
-
- if (disposable != null)
- {
- disposeAction = () => disposable.Dispose();
- }
- else
- {
- disposeAction = () => { };
- }
-
- return new Tuple<T, Action>(exportedValue, disposeAction);
- }
-
- private static object CreateStronglyTypedExportFactoryOfT<T>(Export export, ConstructorInfo constructor)
- {
- Func<Tuple<T, Action>> exportLifetimeContextCreator = () => ExportServices.GetExportLifetimeContextFromExport<T>(export);
- return constructor.Invoke(new object[] { exportLifetimeContextCreator });
- }
-
- private static object CreateStronglyTypedExportFactoryOfTM<T, M>(Export export, ConstructorInfo constructor)
- {
- Func<Tuple<T, Action>> exportLifetimeContextCreator = () => ExportServices.GetExportLifetimeContextFromExport<T>(export);
- return constructor.Invoke(new object[] { exportLifetimeContextCreator, AttributedModelServices.GetMetadataView<M>(export.Metadata) });
- }
-
- internal static T GetCastedExportedValue<T>(Export export)
- {
- return CastExportedValue<T>(export.ToElement(), export.Value);
- }
-
- internal static T CastExportedValue<T>(ICompositionElement element, object exportedValue)
- {
- object typedExportedValue = null;
-
- bool succeeded = ContractServices.TryCast(typeof(T), exportedValue, out typedExportedValue);
- if (!succeeded)
- {
- throw new CompositionContractMismatchException(string.Format(CultureInfo.CurrentCulture,
- Strings.ContractMismatch_ExportedValueCannotBeCastToT,
- element.DisplayName,
- typeof(T)));
- }
-
- return (T)typedExportedValue;
- }
-
- internal static ExportCardinalityCheckResult CheckCardinality(ImportDefinition definition, IEnumerable<Export> exports)
- {
- EnumerableCardinality actualCardinality = exports.GetCardinality();
-
- switch (actualCardinality)
- {
- case EnumerableCardinality.Zero:
- if (definition.Cardinality == ImportCardinality.ExactlyOne)
- {
- return ExportCardinalityCheckResult.NoExports;
- }
- break;
-
- case EnumerableCardinality.TwoOrMore:
- if (definition.Cardinality.IsAtMostOne())
- {
- return ExportCardinalityCheckResult.TooManyExports;
- }
- break;
-
- default:
- Assumes.IsTrue(actualCardinality == EnumerableCardinality.One);
- break;
-
- }
-
- return ExportCardinalityCheckResult.Match;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/.gitattributes b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/.gitattributes deleted file mode 100644 index 3fab40e5ea1..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/.gitattributes +++ /dev/null @@ -1,30 +0,0 @@ -/AggregateCatalog.cs -crlf -/AggregateExportProvider.cs -crlf -/AssemblyCatalog.cs -crlf -/AssemblyCatalogDebuggerProxy.cs -crlf -/AtomicComposition.cs -crlf -/AtomicCompositionExtensions.cs -crlf -/CatalogExportProvider.CatalogChangeProxy.cs -crlf -/CatalogExportProvider.CatalogExport.cs -crlf -/CatalogExportProvider.PartCreatorExport.cs -crlf -/CatalogExportProvider.cs -crlf -/ComposablePartCatalogChangeEventArgs.cs -crlf -/ComposablePartCatalogCollection.cs -crlf -/ComposablePartExportProvider.cs -crlf -/CompositionBatch.SingleExportComposablePart.cs -crlf -/CompositionBatch.cs -crlf -/CompositionConstants.cs -crlf -/CompositionContainer.cs -crlf -/CompositionLock.cs -crlf -/CompositionServices.cs -crlf -/DirectoryCatalog.DirectoryCatalogDebuggerProxy.cs -crlf -/DirectoryCatalog.cs -crlf -/ExportProvider.GetExportOverrides.cs -crlf -/ExportProvider.cs -crlf -/ExportsChangeEventArgs.cs -crlf -/INotifyComposablePartCatalogChanged.cs -crlf -/ImportEngine.EngineContext.cs -crlf -/ImportEngine.PartManager.cs -crlf -/ImportEngine.RecompositionManager.cs -crlf -/ImportEngine.cs -crlf -/TypeCatalog.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/AggregateCatalog.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/AggregateCatalog.cs deleted file mode 100644 index aba950333da..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/AggregateCatalog.cs +++ /dev/null @@ -1,230 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-using System.Globalization;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Threading;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- /// <summary>
- /// A mutable collection of <see cref="ComposablePartCatalog"/>s.
- /// </summary>
- /// <remarks>
- /// This type is thread safe.
- /// </remarks>
- public class AggregateCatalog : ComposablePartCatalog, INotifyComposablePartCatalogChanged
- {
- private ComposablePartCatalogCollection _catalogs = null;
- private volatile int _isDisposed = 0;
- private IQueryable<ComposablePartDefinition> _partsQuery;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="AggregateCatalog"/> class.
- /// </summary>
- public AggregateCatalog()
- : this((IEnumerable<ComposablePartCatalog>)null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="AggregateCatalog"/> class
- /// with the specified catalogs.
- /// </summary>
- /// <param name="catalogs">
- /// An <see cref="Array"/> of <see cref="ComposablePartCatalog"/> objects to add to the
- /// <see cref="AggregateCatalog"/>.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="catalogs"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ArgumentException">
- /// <paramref name="catalogs"/> contains an element that is <see langword="null"/>.
- /// </exception>
- public AggregateCatalog(params ComposablePartCatalog[] catalogs)
- : this((IEnumerable<ComposablePartCatalog>)catalogs)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="AggregateCatalog"/> class
- /// with the specified catalogs.
- /// </summary>
- /// <param name="catalogs">
- /// An <see cref="IEnumerable{T}"/> of <see cref="ComposablePartCatalog"/> objects to add
- /// to the <see cref="AggregateCatalog"/>; or <see langword="null"/> to
- /// create an <see cref="AggregateCatalog"/> that is empty.
- /// </param>
- /// <exception cref="ArgumentException">
- /// <paramref name="catalogs"/> contains an element that is <see langword="null"/>.
- /// </exception>
- public AggregateCatalog(IEnumerable<ComposablePartCatalog> catalogs)
- {
- Requires.NullOrNotNullElements(catalogs, "catalogs");
-
- this._catalogs = new ComposablePartCatalogCollection(catalogs, this.OnChanged, this.OnChanging);
- this._partsQuery = this._catalogs.AsQueryable().SelectMany(catalog => catalog.Parts);
- }
-
- /// <summary>
- /// Notify when the contents of the Catalog has changed.
- /// </summary>
- public event EventHandler<ComposablePartCatalogChangeEventArgs> Changed
- {
- add
- {
- this._catalogs.Changed += value;
- }
- remove
- {
- this._catalogs.Changed -= value;
- }
- }
-
- /// <summary>
- /// Notify when the contents of the Catalog has changing.
- /// </summary>
- public event EventHandler<ComposablePartCatalogChangeEventArgs> Changing
- {
- add
- {
- this._catalogs.Changing += value;
- }
- remove
- {
- this._catalogs.Changing -= value;
- }
- }
-
- /// <summary>
- /// Gets the part definitions of the catalog.
- /// </summary>
- /// <value>
- /// A <see cref="IQueryable{T}"/> of <see cref="ComposablePartDefinition"/> objects of the
- /// <see cref="AggregateCatalog"/>.
- /// </value>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="AggregateCatalog"/> has been disposed of.
- /// </exception>
- public override IQueryable<ComposablePartDefinition> Parts
- {
- get
- {
- this.ThrowIfDisposed();
- return this._partsQuery;
- }
- }
-
- /// <summary>
- /// Returns the export definitions that match the constraint defined by the specified definition.
- /// </summary>
- /// <param name="definition">
- /// The <see cref="ImportDefinition"/> that defines the conditions of the
- /// <see cref="ExportDefinition"/> objects to return.
- /// </param>
- /// <returns>
- /// An <see cref="IEnumerable{T}"/> of <see cref="Tuple{T1, T2}"/> containing the
- /// <see cref="ExportDefinition"/> objects and their associated
- /// <see cref="ComposablePartDefinition"/> for objects that match the constraint defined
- /// by <paramref name="definition"/>.
- /// </returns>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="definition"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="AggregateCatalog"/> has been disposed of.
- /// </exception>
- public override IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>> GetExports(ImportDefinition definition)
- {
- this.ThrowIfDisposed();
-
- Requires.NotNull(definition, "definition");
-
- // delegate the query to each catalog and merge the results.
- var exports = new List<Tuple<ComposablePartDefinition, ExportDefinition>>();
- foreach (var catalog in this._catalogs)
- {
- foreach (var export in catalog.GetExports(definition))
- {
- exports.Add(export);
- }
- }
- return exports;
- }
-
- /// <summary>
- /// Gets the underlying catalogs of the catalog.
- /// </summary>
- /// <value>
- /// An <see cref="ICollection{T}"/> of underlying <see cref="ComposablePartCatalog"/> objects
- /// of the <see cref="AggregateCatalog"/>.
- /// </value>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="AggregateCatalog"/> has been disposed of.
- /// </exception>
- public ICollection<ComposablePartCatalog> Catalogs
- {
- get
- {
- this.ThrowIfDisposed();
- return this._catalogs;
- }
- }
-
- protected override void Dispose(bool disposing)
- {
- try
- {
- if (disposing)
- {
- // NOTE : According to http://msdn.microsoft.com/en-us/library/4bw5ewxy.aspx, the warning is bogus when used with Interlocked API.
-#pragma warning disable 420
- if (Interlocked.CompareExchange(ref this._isDisposed, 1, 0) == 0)
-#pragma warning restore 420
- {
- this._catalogs.Dispose();
- }
- }
- }
- finally
- {
- base.Dispose(disposing);
- }
- }
-
- /// <summary>
- /// Raises the <see cref="INotifyComposablePartCatalogChanged.Changed"/> event.
- /// </summary>
- /// <param name="e">
- /// An <see cref="ComposablePartCatalogChangeEventArgs"/> containing the data for the event.
- /// </param>
- protected virtual void OnChanged(ComposablePartCatalogChangeEventArgs e)
- {
- this._catalogs.OnChanged(this, e);
- }
-
- /// <summary>
- /// Raises the <see cref="INotifyComposablePartCatalogChanged.Changing"/> event.
- /// </summary>
- /// <param name="e">
- /// An <see cref="ComposablePartCatalogChangeEventArgs"/> containing the data for the event.
- /// </param>
- protected virtual void OnChanging(ComposablePartCatalogChangeEventArgs e)
- {
- this._catalogs.OnChanging(this, e);
- }
-
- private void ThrowIfDisposed()
- {
- if (this._isDisposed == 1)
- {
- throw ExceptionBuilder.CreateObjectDisposed(this);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/AggregateExportProvider.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/AggregateExportProvider.cs deleted file mode 100644 index 62bfe70ce79..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/AggregateExportProvider.cs +++ /dev/null @@ -1,219 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.ComponentModel.Composition.Primitives;
-using System.Linq;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-using System.Threading;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- public class AggregateExportProvider : ExportProvider , IDisposable
- {
- private ReadOnlyCollection<ExportProvider> _providers;
- private volatile int _isDisposed = 0;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="AggregateExportProvider"/> class.
- /// </summary>
- /// <param name="providers">The prioritized list of export providers.</param>
- /// <remarks>
- /// <para>
- /// The <see cref="AggregateExportProvider"/> will consult the providers in the order they have been specfied when
- /// executing <see cref="ExportProvider.GetExports(ImportDefinition,AtomicComposition)"/>.
- /// </para>
- /// <para>
- /// The <see cref="AggregateExportProvider"/> does not take ownership of the specified providers.
- /// That is, it will not try to dispose of any of them when it gets disposed.
- /// </para>
- /// </remarks>
- public AggregateExportProvider(params ExportProvider[] providers)
- : this(providers.AsEnumerable())
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="AggregateExportProvider"/> class.
- /// </summary>
- /// <param name="providers">The prioritized list of export providers. The providers are consulted in order in which they are supplied.</param>
- /// <remarks>
- /// <para>
- /// The <see cref="AggregateExportProvider"/> will consult the providers in the order they have been specfied when
- /// executing <see cref="ExportProvider.GetExports(ImportDefinition,AtomicComposition)"/>.
- /// </para>
- /// <para>
- /// The <see cref="AggregateExportProvider"/> does not take ownership of the specified providers.
- /// That is, it will not try to dispose of any of them when it gets disposed.
- /// </para>
- /// </remarks>
- public AggregateExportProvider(IEnumerable<ExportProvider> providers)
- {
- List<ExportProvider> providerList = new List<ExportProvider>();
-
- if (providers != null)
- {
- // we are in the constructor, so there's no need to lock anything
- foreach (var provider in providers)
- {
- if (provider == null)
- {
- throw ExceptionBuilder.CreateContainsNullElement("providers");
- }
-
- providerList.Add(provider);
-
- provider.ExportsChanged += this.OnExportChangedInternal;
- provider.ExportsChanging += this.OnExportChangingInternal;
- }
- }
-
- // this will always fully copy the array
- this._providers = new ReadOnlyCollection<ExportProvider>(providerList);
- }
-
- /// <summary>
- /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- /// </summary>
- public void Dispose()
- {
- this.Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- /// <summary>
- /// Releases unmanaged and - optionally - managed resources
- /// </summary>
- /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
- protected virtual void Dispose(bool disposing)
- {
- if (disposing)
- {
- // NOTE : According to http://msdn.microsoft.com/en-us/library/4bw5ewxy.aspx, the warning is bogus when used with Interlocked API.
-#pragma warning disable 420
- if (Interlocked.CompareExchange(ref this._isDisposed, 1, 0) == 0)
-#pragma warning restore 420
- {
- this._providers.ForEach(provider =>
- {
- provider.ExportsChanged -= this.OnExportChangedInternal;
- provider.ExportsChanging -= this.OnExportChangingInternal;
- });
- }
- }
- }
-
- /// <summary>
- /// Gets the export providers which the aggregate export provider aggregates.
- /// </summary>
- /// <value>
- /// A <see cref="ReadOnlyCollection{T}"/> of <see cref="ExportProvider"/> objects
- /// which the <see cref="AggregateExportProvider"/> aggregates.
- /// </value>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="AggregateExportProvider"/> has been disposed of.
- /// </exception>
- public ReadOnlyCollection<ExportProvider> Providers
- {
- get
- {
- this.ThrowIfDisposed();
-
- return this._providers;
- }
- }
-
- /// <summary>
- /// Returns all exports that match the conditions of the specified import.
- /// </summary>
- /// <param name="definition">The <see cref="ImportDefinition"/> that defines the conditions of the
- /// <see cref="Export"/> to get.</param>
- /// <returns></returns>
- /// <result>
- /// An <see cref="IEnumerable{T}"/> of <see cref="Export"/> objects that match
- /// the conditions defined by <see cref="ImportDefinition"/>, if found; otherwise, an
- /// empty <see cref="IEnumerable{T}"/>.
- /// </result>
- /// <remarks>
- /// <note type="inheritinfo">
- /// The implementers should not treat the cardinality-related mismatches as errors, and are not
- /// expected to throw exceptions in those cases.
- /// For instance, if the import requests exactly one export and the provider has no matching exports or more than one,
- /// it should return an empty <see cref="IEnumerable{T}"/> of <see cref="Export"/>.
- /// </note>
- /// </remarks>
- protected override IEnumerable<Export> GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
- {
- this.ThrowIfDisposed();
-
- if (definition.Cardinality == ImportCardinality.ZeroOrMore)
- {
- var exports = new List<Export>();
- foreach (var provider in this._providers)
- {
- foreach (var export in provider.GetExports(definition, atomicComposition))
- {
- exports.Add(export);
- }
- }
- return exports;
- }
- else
- {
- IEnumerable<Export> allExports = Enumerable.Empty<Export>();
-
- // if asked for "one or less", the prioriry is at play - the first provider that agrees to return the value
- // which best complies with the request, wins.
- foreach (ExportProvider provider in this._providers)
- {
- IEnumerable<Export> exports;
- bool cardinalityCheckResult = provider.TryGetExports(definition, atomicComposition, out exports);
- bool anyExports = exports.FastAny();
- if (cardinalityCheckResult && anyExports)
- {
- // NOTE : if the provider returned nothing, we need to proceed, even if it indicated that the
- // cardinality is correct - when asked for "one or less", the provider might - correctly -
- // return an empty sequence, but we shouldn't be satisfied with that as providers down the list
- // might have a value we are interested in.
- return exports;
- }
- else
- {
- // TODO
- // This is a sneaky thing that we do - if in the end no provider returns the exports with the right cardinality
- // we simply return the aggregation of all exports they have restuned. This way the end result is still not waht we want
- // but no information is lost.
- // WE SHOULD fix this behavior, but this is ONLY possible if we can treat many exports as no exports for the sake of singles
- if (anyExports)
- {
- allExports = allExports.Concat(exports);
- }
- }
- }
-
- return allExports;
- }
- }
-
- private void OnExportChangedInternal(object sender, ExportsChangeEventArgs e)
- {
- this.OnExportsChanged(e);
- }
-
- private void OnExportChangingInternal(object sender, ExportsChangeEventArgs e)
- {
- this.OnExportsChanging(e);
- }
-
- private void ThrowIfDisposed()
- {
- if (this._isDisposed == 1)
- {
- throw ExceptionBuilder.CreateObjectDisposed(this);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/AssemblyCatalog.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/AssemblyCatalog.cs deleted file mode 100644 index b1e079b0746..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/AssemblyCatalog.cs +++ /dev/null @@ -1,301 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.ReflectionModel;
-using System.Diagnostics;
-using System.Diagnostics.CodeAnalysis;
-using System.Globalization;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Security;
-using System.Threading;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- /// <summary>
- /// An immutable ComposablePartCatalog created from a managed code assembly.
- /// </summary>
- /// <remarks>
- /// This type is thread safe.
- /// </remarks>
- [DebuggerTypeProxy(typeof(AssemblyCatalogDebuggerProxy))]
- public class AssemblyCatalog : ComposablePartCatalog, ICompositionElement
- {
- private readonly object _thisLock = new object();
- private readonly ICompositionElement _definitionOrigin;
- private volatile Assembly _assembly = null;
- private volatile TypeCatalog _innerCatalog = null;
- private int _isDisposed = 0;
-
-#if !SILVERLIGHT
-
- /// <summary>
- /// Initializes a new instance of the <see cref="AssemblyCatalog"/> class
- /// with the specified code base.
- /// </summary>
- /// <param name="codeBase">
- /// A <see cref="String"/> containing the code base of the assembly containing the
- /// attributed <see cref="Type"/> objects to add to the <see cref="AssemblyCatalog"/>.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="codeBase"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ArgumentException">
- /// <paramref name="codeBase"/> is a zero-length string, contains only white space,
- /// or contains one or more invalid characters as defined by <see cref="Path.InvalidPathChars"/>.
- /// </exception>
- /// <exception cref="PathTooLongException">
- /// The specified path, file name, or both exceed the system-defined maximum length.
- /// </exception>
- /// <exception cref="SecurityException">
- /// The caller does not have path discovery permission.
- /// </exception>
- /// <exception cref="FileNotFoundException">
- /// <paramref name="codeBase"/> is not found.
- /// </exception>
- /// <exception cref="FileLoadException ">
- /// <paramref name="codeBase"/> could not be loaded.
- /// <para>
- /// -or-
- /// </para>
- /// <paramref name="codeBase"/> specified a directory.
- /// </exception>
- /// <exception cref="BadImageFormatException">
- /// <paramref name="codeBase"/> is not a valid assembly
- /// -or-
- /// Version 2.0 or later of the common language runtime is currently loaded
- /// and <paramref name="codeBase"/> was compiled with a later version.
- /// </exception>
- /// <remarks>
- /// The assembly referenced by <paramref langword="codeBase"/> is loaded into the Load context.
- /// </remarks>
- public AssemblyCatalog(string codeBase)
- : this(codeBase, (ICompositionElement)null)
- {
- }
-
- internal AssemblyCatalog(string codeBase, ICompositionElement definitionOrigin)
- : this(LoadAssembly(codeBase), definitionOrigin)
- {
- }
-
-#endif
-
- /// <summary>
- /// Initializes a new instance of the <see cref="AssemblyCatalog"/> class
- /// with the specified assembly.
- /// </summary>
- /// <param name="assembly">
- /// The <see cref="Assembly"/> containing the attributed <see cref="Type"/> objects to
- /// add to the <see cref="AssemblyCatalog"/>.
- /// </param>
- /// <exception cref="ArgumentException">
- /// <paramref name="assembly"/> is <see langword="null"/>.
- /// <para>
- /// -or-
- /// </para>
- /// <paramref name="assembly"/> was loaded in the reflection-only context.
- /// </exception>
- public AssemblyCatalog(Assembly assembly)
- : this(assembly, (ICompositionElement)null)
- {
- }
-
- internal AssemblyCatalog(Assembly assembly, ICompositionElement definitionOrigin)
- {
- Requires.NotNull(assembly, "assembly");
-
-#if !SILVERLIGHT
- if (assembly.ReflectionOnly)
- {
- throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Strings.Argument_AssemblyReflectionOnly, "assembly"), "assembly");
- }
-#endif
- this._assembly = assembly;
- this._definitionOrigin = definitionOrigin ?? this;
- }
-
- /// <summary>
- /// Gets the part definitions of the assembly catalog.
- /// </summary>
- /// <value>
- /// A <see cref="IQueryable{T}"/> of <see cref="ComposablePartDefinition"/> objects of the
- /// <see cref="AssemblyCatalog"/>.
- /// </value>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="AssemblyCatalog"/> has been disposed of.
- /// </exception>
- public override IQueryable<ComposablePartDefinition> Parts
- {
- get
- {
- return this.InnerCatalog.Parts;
- }
- }
-
- /// <summary>
- /// Returns the export definitions that match the constraint defined by the specified definition.
- /// </summary>
- /// <param name="definition">
- /// The <see cref="ImportDefinition"/> that defines the conditions of the
- /// <see cref="ExportDefinition"/> objects to return.
- /// </param>
- /// <returns>
- /// An <see cref="IEnumerable{T}"/> of <see cref="Tuple{T1, T2}"/> containing the
- /// <see cref="ExportDefinition"/> objects and their associated
- /// <see cref="ComposablePartDefinition"/> for objects that match the constraint defined
- /// by <paramref name="definition"/>.
- /// </returns>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="definition"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="ComposablePartCatalog"/> has been disposed of.
- /// </exception>
- /// <remarks>
- /// <note type="inheritinfo">
- /// Overriders of this property should never return <see langword="null"/>, if no
- /// <see cref="ExportDefinition"/> match the conditions defined by
- /// <paramref name="definition"/>, return an empty <see cref="IEnumerable{T}"/>.
- /// </note>
- /// </remarks>
- public override IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>> GetExports(ImportDefinition definition)
- {
- return this.InnerCatalog.GetExports(definition);
- }
-
- private TypeCatalog InnerCatalog
- {
- get
- {
- this.ThrowIfDisposed();
-
- if (this._innerCatalog == null)
- {
- lock (this._thisLock)
- {
- if (this._innerCatalog == null)
- {
- var catalog = new TypeCatalog(this._assembly.GetTypes(), _definitionOrigin);
- this._innerCatalog = catalog;
- }
- }
- }
- return this._innerCatalog;
- }
- }
-
- /// <summary>
- /// Gets the assembly containing the attributed types contained within the assembly
- /// catalog.
- /// </summary>
- /// <value>
- /// The <see cref="Assembly"/> containing the attributed <see cref="Type"/> objects
- /// contained within the <see cref="AssemblyCatalog"/>.
- /// </value>
- public Assembly Assembly
- {
- get { return this._assembly; }
- }
-
- /// <summary>
- /// Gets the display name of the assembly catalog.
- /// </summary>
- /// <value>
- /// A <see cref="String"/> containing a human-readable display name of the <see cref="AssemblyCatalog"/>.
- /// </value>
- [SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
- string ICompositionElement.DisplayName
- {
- get { return this.GetDisplayName(); }
- }
-
- /// <summary>
- /// Gets the composition element from which the assembly catalog originated.
- /// </summary>
- /// <value>
- /// This property always returns <see langword="null"/>.
- /// </value>
- [SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
- ICompositionElement ICompositionElement.Origin
- {
- get { return null; }
- }
-
-
- /// <summary>
- /// Returns a string representation of the assembly catalog.
- /// </summary>
- /// <returns>
- /// A <see cref="String"/> containing the string representation of the <see cref="AssemblyCatalog"/>.
- /// </returns>
- public override string ToString()
- {
- return this.GetDisplayName();
- }
-
- protected override void Dispose(bool disposing)
- {
- try
- {
- if (Interlocked.CompareExchange(ref this._isDisposed, 1, 0) == 0)
- {
- if (disposing)
- {
- if (this._innerCatalog != null)
- {
- this._innerCatalog.Dispose();
- }
- }
- }
- }
- finally
- {
- base.Dispose(disposing);
- }
- }
-
- private void ThrowIfDisposed()
- {
- if (this._isDisposed == 1)
- {
- throw ExceptionBuilder.CreateObjectDisposed(this);
- }
- }
-
- private string GetDisplayName()
- {
- return string.Format(CultureInfo.CurrentCulture,
- "{0} (Assembly=\"{1}\")", // NOLOC
- GetType().Name,
- this.Assembly.FullName);
- }
-
-#if !SILVERLIGHT
-
- private static Assembly LoadAssembly(string codeBase)
- {
- Requires.NotNullOrEmpty(codeBase, "codeBase");
-
- AssemblyName assemblyName;
-
- try
- {
- assemblyName = AssemblyName.GetAssemblyName(codeBase);
- }
- catch (ArgumentException)
- {
- assemblyName = new AssemblyName();
- assemblyName.CodeBase = codeBase;
- }
-
- return Assembly.Load(assemblyName);
- }
-#endif
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/AssemblyCatalogDebuggerProxy.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/AssemblyCatalogDebuggerProxy.cs deleted file mode 100644 index 86aa5fad768..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/AssemblyCatalogDebuggerProxy.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.ObjectModel;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.ReflectionModel;
-using System.Linq;
-using System.Reflection;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- internal class AssemblyCatalogDebuggerProxy
- {
- private readonly AssemblyCatalog _catalog;
-
- public AssemblyCatalogDebuggerProxy(AssemblyCatalog catalog)
- {
- Requires.NotNull(catalog, "catalog");
-
- this._catalog = catalog;
- }
-
- public Assembly Assembly
- {
- get { return this._catalog.Assembly; }
- }
-
- public ReadOnlyCollection<ComposablePartDefinition> Parts
- {
- // NOTE: This shouldn't be cached, so that on every query of
- // the current value of the underlying catalog is respected.
- // We use ReadOnlyCollection as arrays do not have the
- // appropriate debugger display attributes applied to them.
- get { return this._catalog.Parts.ToReadOnlyCollection(); }
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/AtomicComposition.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/AtomicComposition.cs deleted file mode 100644 index 4c027f73d3d..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/AtomicComposition.cs +++ /dev/null @@ -1,305 +0,0 @@ -using System;
-using System.Diagnostics;
-using System.Collections.Generic;
-using Microsoft.Internal;
-using System.Diagnostics.CodeAnalysis;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- /// <summary>
- /// AtomicComposition provides lightweight atomicCompositional semantics to enable temporary
- /// state to be managed for a series of nested atomicCompositions. Each atomicComposition maintains
- /// queryable state along with a sequence of actions necessary to complete the state when
- /// the atomicComposition is no longer in danger of being rolled back. State is completed or
- /// rolled back when the atomicComposition is disposed, depending on the state of the
- /// CompleteOnDipose property which defaults to false. The using(...) pattern in C# is a
- /// convenient mechanism for defining atomicComposition scopes.
- ///
- /// The least obvious aspects of AtomicComposition deal with nesting.
- ///
- /// Firstly, no complete actions are actually performed until the outermost atomicComposition is
- /// completed. Completeting or rolling back nested atomicCompositions serves only to change which
- /// actions would be completed the outer atomicComposition.
- ///
- /// Secondly, state is added in the form of queries associated with an object key. The
- /// key represents a unique object the state is being held on behalf of. The quieries are
- /// accessed throught the Query methods which provide automatic chaining to execute queries
- /// across the target atomicComposition and its inner atomicComposition as appropriate.
- ///
- /// Lastly, when a nested atomicComposition is created for a given outer the outer atomicComposition is locked.
- /// It remains locked until the inner atomicComposition is disposed or completeed preventing the addition of
- /// state, actions or other inner atomicCompositions.
- /// </summary>
- public class AtomicComposition : IDisposable
- {
- private readonly AtomicComposition _outerAtomicComposition;
- private KeyValuePair<object, object>[] _values;
- private int _valueCount = 0;
- private List<Action> _completeActionList;
- private List<Action> _revertActionList;
- private bool _isDisposed = false;
- private bool _isCompleted = false;
- private bool _containsInnerAtomicComposition = false;
-
- public AtomicComposition()
- : this(null)
- {
- }
-
- public AtomicComposition(AtomicComposition outerAtomicComposition)
- {
- // Lock the inner atomicComposition so that we can assume nothing changes except on
- // the innermost scope, and thereby optimize the query path
- if (outerAtomicComposition != null)
- {
- this._outerAtomicComposition = outerAtomicComposition;
- this._outerAtomicComposition.ContainsInnerAtomicComposition = true;
- }
- }
-
- public void SetValue(object key, object value)
- {
- ThrowIfDisposed();
- ThrowIfCompleteed();
- ThrowIfContainsInnerAtomicComposition();
-
- Requires.NotNull(key, "key");
-
- SetValueInternal(key, value);
- }
-
- public bool TryGetValue<T>(object key, out T value)
- {
- return TryGetValue(key, false, out value);
- }
-
- [SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters")]
- public bool TryGetValue<T>(object key, bool localAtomicCompositionOnly, out T value)
- {
- ThrowIfDisposed();
- ThrowIfCompleteed();
-
- Requires.NotNull(key, "key");
-
- return TryGetValueInternal(key, localAtomicCompositionOnly, out value);
- }
-
- public void AddCompleteAction(Action completeAction)
- {
- ThrowIfDisposed();
- ThrowIfCompleteed();
- ThrowIfContainsInnerAtomicComposition();
-
- Requires.NotNull(completeAction, "completeAction");
-
- if (this._completeActionList == null)
- {
- this._completeActionList = new List<Action>();
- }
- this._completeActionList.Add(completeAction);
- }
-
- public void AddRevertAction(Action revertAction)
- {
- ThrowIfDisposed();
- ThrowIfCompleteed();
- ThrowIfContainsInnerAtomicComposition();
-
- Requires.NotNull(revertAction, "revertAction");
-
- if (this._revertActionList == null)
- {
- this._revertActionList = new List<Action>();
- }
- this._revertActionList.Add(revertAction);
- }
-
- public void Complete()
- {
- ThrowIfDisposed();
- ThrowIfCompleteed();
-
- if (this._outerAtomicComposition == null)
- { // Execute all the complete actions
- FinalComplete();
- }
- else
- { // Copy the actions and state to the outer atomicComposition
- CopyComplete();
- }
-
- this._isCompleted = true;
- }
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- ThrowIfDisposed();
- this._isDisposed = true;
-
- if (this._outerAtomicComposition != null)
- {
- this._outerAtomicComposition.ContainsInnerAtomicComposition = false;
- }
-
- // Revert is always immediate and involves forgetting information and
- // exceuting any appropriate revert actions
- if (!this._isCompleted)
- {
- if (this._revertActionList != null)
- {
- // Execute the revert actions in reverse order to ensure
- // everything incrementally rollsback its state.
- for (int i = this._revertActionList.Count - 1; i >= 0; i--)
- {
- Action action = this._revertActionList[i];
- action();
- }
- this._revertActionList = null;
- }
- }
- }
-
- private void FinalComplete()
- {
- // Completeting the outer most scope is easy, just execute all the actions
- if (this._completeActionList != null)
- {
- foreach (Action action in this._completeActionList)
- {
- action();
- }
- this._completeActionList = null;
- }
- }
-
- private void CopyComplete()
- {
- Assumes.NotNull(this._outerAtomicComposition);
-
- this._outerAtomicComposition.ContainsInnerAtomicComposition = false;
-
- // Inner scopes are much odder, because completeting them means coalescing them into the
- // outer scope - the complete or revert actions are deferred until the outermost scope completes
- // or any intermediate rolls back
- if (this._completeActionList != null)
- {
- foreach (Action action in this._completeActionList)
- {
- this._outerAtomicComposition.AddCompleteAction(action);
- }
- }
-
- if (this._revertActionList != null)
- {
- foreach (Action action in this._revertActionList)
- {
- this._outerAtomicComposition.AddRevertAction(action);
- }
- }
-
- // We can copy over existing atomicComposition entries because they're either already chained or
- // overwrite by design and can now be completed or rolled back together
- for (var index = 0; index < this._valueCount; index++)
- {
- this._outerAtomicComposition.SetValueInternal(
- this._values[index].Key, this._values[index].Value);
- }
- }
-
- private bool ContainsInnerAtomicComposition
- {
- set
- {
- if (value == true && this._containsInnerAtomicComposition == true)
- {
- throw new InvalidOperationException(Strings.AtomicComposition_AlreadyNested);
- }
- this._containsInnerAtomicComposition = value;
- }
- }
-
- private bool TryGetValueInternal<T>(object key, bool localAtomicCompositionOnly, out T value)
- {
- for (var index = 0; index < this._valueCount; index++)
- {
- if (this._values[index].Key == key)
- {
- value = (T)this._values[index].Value;
- return true;
- }
- }
-
- // If there's no atomicComposition available then recurse until we hit the outermost
- // scope, where upon we go ahead and return null
- if (!localAtomicCompositionOnly && this._outerAtomicComposition != null)
- {
- return this._outerAtomicComposition.TryGetValueInternal<T>(key, localAtomicCompositionOnly, out value);
- }
-
- value = default(T);
- return false;
- }
-
- private void SetValueInternal(object key, object value)
- {
- // Handle overwrites quickly
- for (var index = 0; index < this._valueCount; index++)
- {
- if (this._values[index].Key == key)
- {
- this._values[index] = new KeyValuePair<object,object>(key, value);
- return;
- }
- }
-
- // Expand storage when needed
- if (this._values == null || this._valueCount == this._values.Length)
- {
- var newQueries = new KeyValuePair<object, object>[this._valueCount == 0 ? 5 : this._valueCount * 2];
- if (this._values != null)
- {
- Array.Copy(this._values, newQueries, this._valueCount);
- }
- this._values = newQueries;
- }
-
- // Store a new entry
- this._values[_valueCount] = new KeyValuePair<object, object>(key, value);
- this._valueCount++;
- return;
- }
-
- [DebuggerStepThrough]
- private void ThrowIfContainsInnerAtomicComposition()
- {
- if (this._containsInnerAtomicComposition)
- {
- throw new InvalidOperationException(Strings.AtomicComposition_PartOfAnotherAtomicComposition);
- }
- }
-
- [DebuggerStepThrough]
- private void ThrowIfCompleteed()
- {
- if (this._isCompleted)
- {
- throw new InvalidOperationException(Strings.AtomicComposition_AlreadyCompleted);
- }
- }
-
- [DebuggerStepThrough]
- private void ThrowIfDisposed()
- {
- if (this._isDisposed)
- {
- throw ExceptionBuilder.CreateObjectDisposed(this);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/AtomicCompositionExtensions.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/AtomicCompositionExtensions.cs deleted file mode 100644 index 5756a0f9fab..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/AtomicCompositionExtensions.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System;
-using System.Diagnostics;
-using System.Collections.Generic;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- internal static class AtomicCompositionExtensions
- {
- internal static T GetValueAllowNull<T>(this AtomicComposition atomicComposition, T defaultResultAndKey) where T : class
- {
- Assumes.NotNull(defaultResultAndKey);
-
- return GetValueAllowNull<T>(atomicComposition, defaultResultAndKey, defaultResultAndKey);
- }
-
- internal static T GetValueAllowNull<T>(this AtomicComposition atomicComposition, object key, T defaultResult)
- {
- T result;
- if (atomicComposition != null && atomicComposition.TryGetValue(key, out result))
- {
- return result;
- }
-
- return defaultResult;
- }
-
- internal static void AddRevertActionAllowNull(this AtomicComposition atomicComposition, Action action)
- {
- Assumes.NotNull(action);
-
- if (atomicComposition == null)
- {
- action();
- }
- else
- {
- atomicComposition.AddRevertAction(action);
- }
- }
-
- internal static void AddCompleteActionAllowNull(this AtomicComposition atomicComposition, Action action)
- {
- Assumes.NotNull(action);
-
- if (atomicComposition == null)
- {
- action();
- }
- else
- {
- atomicComposition.AddCompleteAction(action);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CatalogExportProvider.CatalogChangeProxy.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CatalogExportProvider.CatalogChangeProxy.cs deleted file mode 100644 index d78db6d055b..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CatalogExportProvider.CatalogChangeProxy.cs +++ /dev/null @@ -1,67 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-using System.Diagnostics;
-using System.Diagnostics.CodeAnalysis;
-using System.Globalization;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Threading;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- public partial class CatalogExportProvider : ExportProvider, IDisposable
- {
- private class CatalogChangeProxy : ComposablePartCatalog
- {
- private ComposablePartCatalog _originalCatalog;
- private List<ComposablePartDefinition> _addedParts;
- private HashSet<ComposablePartDefinition> _removedParts;
-
- public CatalogChangeProxy(ComposablePartCatalog originalCatalog,
- IEnumerable<ComposablePartDefinition> addedParts,
- IEnumerable<ComposablePartDefinition> removedParts)
- {
- this._originalCatalog = originalCatalog;
- this._addedParts = new List<ComposablePartDefinition>(addedParts);
- this._removedParts = new HashSet<ComposablePartDefinition>(removedParts);
- }
-
- public override IQueryable<ComposablePartDefinition> Parts
- {
- get
- {
- return this._originalCatalog.Parts.Concat(this._addedParts).Except(this._removedParts);
- }
- }
-
- public override IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>> GetExports(
- ImportDefinition definition)
- {
- Requires.NotNull(definition, "definition");
-
- var originalExports = this._originalCatalog.GetExports(definition);
- var trimmedExports = originalExports.Where(partAndExport =>
- !this._removedParts.Contains(partAndExport.Item1));
-
- var addedExports = new List<Tuple<ComposablePartDefinition, ExportDefinition>>();
- foreach (var part in this._addedParts)
- {
- foreach (var export in part.ExportDefinitions)
- {
- if (definition.IsConstraintSatisfiedBy(export))
- {
- addedExports.Add(new Tuple<ComposablePartDefinition, ExportDefinition>(part, export));
- }
- }
- }
- return trimmedExports.Concat(addedExports);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CatalogExportProvider.CatalogExport.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CatalogExportProvider.CatalogExport.cs deleted file mode 100644 index 0741cf3f4f5..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CatalogExportProvider.CatalogExport.cs +++ /dev/null @@ -1,132 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Primitives;
-using System.Diagnostics.CodeAnalysis;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- public partial class CatalogExportProvider
- {
- private class CatalogExport : Export
- {
- protected readonly CatalogExportProvider _catalogExportProvider;
- protected readonly ComposablePartDefinition _partDefinition;
- protected readonly ExportDefinition _definition;
- protected ComposablePart _part;
-
- public CatalogExport(CatalogExportProvider catalogExportProvider,
- ComposablePartDefinition partDefinition, ExportDefinition definition)
- {
- this._catalogExportProvider = catalogExportProvider;
- this._partDefinition = partDefinition;
- this._definition = definition;
- }
-
- public override ExportDefinition Definition
- {
- get
- {
- return this._definition;
- }
- }
-
- protected virtual bool IsSharedPart
- {
- get
- {
- return true;
- }
- }
-
- protected override object GetExportedValueCore()
- {
- ComposablePart part = this._catalogExportProvider.GetComposablePart(this._partDefinition, this.IsSharedPart);
- object exportedValue = this._catalogExportProvider.GetExportedValue(part, this._definition, this.IsSharedPart);
- this._part = part;
-
- return exportedValue;
- }
-
- [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
- public static CatalogExport CreateExport(CatalogExportProvider catalogExportProvider,
- ComposablePartDefinition partDefinition, ExportDefinition definition, CreationPolicy importCreationPolicy)
- {
- CreationPolicy partPolicy = partDefinition.Metadata.GetValue<CreationPolicy>(CompositionConstants.PartCreationPolicyMetadataName);
- bool isSharedPart = ShouldUseSharedPart(partPolicy, importCreationPolicy);
-
- if (isSharedPart)
- {
- return new CatalogExport(catalogExportProvider, partDefinition, definition);
- }
- else
- {
- return new NonSharedCatalogExport(catalogExportProvider, partDefinition, definition);
- }
- }
-
- private static bool ShouldUseSharedPart(CreationPolicy partPolicy, CreationPolicy importPolicy)
- {
- // Matrix that details which policy to use for a given part to satisfy a given import.
- // Part.Any Part.Shared Part.NonShared
- // Import.Any Shared Shared NonShared
- // Import.Shared Shared Shared N/A
- // Import.NonShared NonShared N/A NonShared
-
- switch (partPolicy)
- {
- case CreationPolicy.Any:
- {
- if (importPolicy == CreationPolicy.Any ||
- importPolicy == CreationPolicy.Shared)
- {
- return true;
- }
- return false;
- }
-
- case CreationPolicy.NonShared:
- {
- Assumes.IsTrue(importPolicy != CreationPolicy.Shared);
- return false;
- }
-
- default:
- {
- Assumes.IsTrue(partPolicy == CreationPolicy.Shared);
- Assumes.IsTrue(importPolicy != CreationPolicy.NonShared);
- return true;
- }
- }
- }
- }
-
- private sealed class NonSharedCatalogExport : CatalogExport, IDisposable
- {
- public NonSharedCatalogExport(CatalogExportProvider catalogExportProvider,
- ComposablePartDefinition partDefinition, ExportDefinition definition)
- : base(catalogExportProvider, partDefinition, definition)
- {
- }
-
- protected override bool IsSharedPart
- {
- get
- {
- return false;
- }
- }
-
- void IDisposable.Dispose()
- {
- if (this._part != null)
- {
- this._catalogExportProvider.ReleasePart(this.Value, this._part, null);
- this._part = null;
- }
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CatalogExportProvider.PartCreatorExport.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CatalogExportProvider.PartCreatorExport.cs deleted file mode 100644 index 14d4a42d137..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CatalogExportProvider.PartCreatorExport.cs +++ /dev/null @@ -1,132 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.ReflectionModel;
-using System.Linq;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- public partial class CatalogExportProvider
- {
- internal class PartCreatorExport : Export
- {
- private readonly CatalogExportProvider _catalogExportProvider;
- private readonly ComposablePartDefinition _partDefinition;
- private readonly ExportDefinition _exportDefinition;
- private ExportDefinition _partCreatorExportDefinition;
- private PartCreatorPartDefinition _partCreatorPartDefinition;
-
- public PartCreatorExport(CatalogExportProvider catalogExportProvider, ComposablePartDefinition partDefinition, ExportDefinition exportDefinition)
- {
- this._catalogExportProvider = catalogExportProvider;
- this._partDefinition = partDefinition;
- this._exportDefinition = exportDefinition;
- this._partCreatorExportDefinition = new PartCreatorExportDefinition(this._exportDefinition);
- }
-
- public override ExportDefinition Definition
- {
- get { return this._partCreatorExportDefinition; }
- }
-
- protected override object GetExportedValueCore()
- {
- if (this._partCreatorPartDefinition == null)
- {
- this._partCreatorPartDefinition = new PartCreatorPartDefinition(this);
- }
- return this._partCreatorPartDefinition;
- }
-
- public Export CreateExportProduct()
- {
- return new NonSharedCatalogExport(this._catalogExportProvider, this._partDefinition, this._exportDefinition);
- }
-
- private class PartCreatorPartDefinition : ComposablePartDefinition
- {
- private readonly PartCreatorExport _partCreatorExport;
-
- public PartCreatorPartDefinition(PartCreatorExport partCreatorExport)
- {
- this._partCreatorExport = partCreatorExport;
- }
-
- public override IEnumerable<ExportDefinition> ExportDefinitions
- {
- get { return new ExportDefinition[] { this._partCreatorExport.Definition }; }
- }
-
- public override IEnumerable<ImportDefinition> ImportDefinitions
- {
- get { return Enumerable.Empty<ImportDefinition>(); }
- }
-
- public ExportDefinition PartCreatorExportDefinition
- {
- get { return this._partCreatorExport.Definition; }
- }
-
- public Export CreateProductExport()
- {
- return this._partCreatorExport.CreateExportProduct();
- }
-
- public override ComposablePart CreatePart()
- {
- return new PartCreatorPart(this);
- }
- }
-
- private sealed class PartCreatorPart : ComposablePart, IDisposable
- {
- private readonly PartCreatorPartDefinition _definition;
- private readonly Export _export;
-
- public PartCreatorPart(PartCreatorPartDefinition definition)
- {
- this._definition = definition;
- this._export = definition.CreateProductExport();
- }
-
- public override IEnumerable<ExportDefinition> ExportDefinitions
- {
- get { return this._definition.ExportDefinitions; }
- }
-
- public override IEnumerable<ImportDefinition> ImportDefinitions
- {
- get { return this._definition.ImportDefinitions; }
- }
-
- public override object GetExportedValue(ExportDefinition definition)
- {
- if (definition != this._definition.PartCreatorExportDefinition)
- {
- throw ExceptionBuilder.CreateExportDefinitionNotOnThisComposablePart("definition");
- }
-
- return this._export.Value;
- }
-
- public override void SetImport(ImportDefinition definition, IEnumerable<Export> exports)
- {
- throw ExceptionBuilder.CreateImportDefinitionNotOnThisComposablePart("definition");
- }
-
- public void Dispose()
- {
- IDisposable disposable = this._export as IDisposable;
-
- if (disposable != null)
- {
- disposable.Dispose();
- }
- }
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CatalogExportProvider.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CatalogExportProvider.cs deleted file mode 100644 index 5c00b5a004f..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CatalogExportProvider.cs +++ /dev/null @@ -1,816 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Diagnostics;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.ReflectionModel;
-using System.Diagnostics;
-using System.Diagnostics.CodeAnalysis;
-using System.Globalization;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- public partial class CatalogExportProvider : ExportProvider, IDisposable
- {
- private readonly CompositionLock _lock;
- private Dictionary<ComposablePartDefinition, ComposablePart> _activatedParts = new Dictionary<ComposablePartDefinition, ComposablePart>();
- private HashSet<ComposablePartDefinition> _rejectedParts = new HashSet<ComposablePartDefinition>();
- private ConditionalWeakTable<object, List<ComposablePart>> _conditionalReferencesForRecomposableParts = new ConditionalWeakTable<object, List<ComposablePart>>();
- private HashSet<IDisposable> _partsToDispose = new HashSet<IDisposable>();
- private ComposablePartCatalog _catalog;
- private volatile bool _isDisposed = false;
- private volatile bool _isRunning = false;
- private ExportProvider _sourceProvider;
- private ImportEngine _importEngine;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CatalogExportProvider"/> class.
- /// </summary>
- /// <param name="catalog">
- /// The <see cref="ComposablePartCatalog"/> that the <see cref="CatalogExportProvider"/>
- /// uses to produce <see cref="Export"/> objects.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="catalog"/> is <see langword="null"/>.
- /// </exception>
- public CatalogExportProvider(ComposablePartCatalog catalog)
- : this(catalog, false)
- {
- }
-
- public CatalogExportProvider(ComposablePartCatalog catalog, bool isThreadSafe)
- {
- Requires.NotNull(catalog, "catalog");
-
- this._catalog = catalog;
-
- var notifyCatalogChanged = this._catalog as INotifyComposablePartCatalogChanged;
- if (notifyCatalogChanged != null)
- {
- notifyCatalogChanged.Changing += this.OnCatalogChanging;
- }
-
- this._lock = new CompositionLock(isThreadSafe);
- }
-
- /// <summary>
- /// Gets the composable part catalog that the provider users to
- /// produce exports.
- /// </summary>
- /// <value>
- /// The <see cref="ComposablePartCatalog"/> that the
- /// <see cref="CatalogExportProvider"/>
- /// uses to produce <see cref="Export"/> objects.
- /// </value>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="CompositionContainer"/> has been disposed of.
- /// </exception>
- public ComposablePartCatalog Catalog
- {
- get
- {
- ThrowIfDisposed();
-
- return this._catalog;
- }
- }
-
- /// <summary>
- /// Gets the export provider which provides the provider access to additional
- /// exports.
- /// </summary>
- /// <value>
- /// The <see cref="ExportProvider"/> which provides the
- /// <see cref="CatalogExportProvider"/> access to additional
- /// <see cref="Export"/> objects. The default is <see langword="null"/>.
- /// </value>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="value"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="InvalidOperationException">
- /// This property has already been set.
- /// <para>
- /// -or-
- /// </para>
- /// The methods on the <see cref="CatalogExportProvider"/>
- /// have already been accessed.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="CatalogExportProvider"/> has been disposed of.
- /// </exception>
- /// <remarks>
- /// This property must be set before accessing any methods on the
- /// <see cref="CatalogExportProvider"/>.
- /// </remarks>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification="EnsureCanSet ensures that the property is set only once, Dispose is not required")]
- public ExportProvider SourceProvider
- {
- get
- {
- this.ThrowIfDisposed();
- using (this._lock.LockStateForRead())
- {
- return this._sourceProvider;
- }
- }
- set
- {
- this.ThrowIfDisposed();
-
- Requires.NotNull(value, "value");
-
- ImportEngine newImportEngine = null;
- bool isThrowing = true;
- try
- {
- newImportEngine = new ImportEngine(value, this._lock.IsThreadSafe);
- value.ExportsChanging += this.OnExportsChangingInternal;
-
- using (this._lock.LockStateForWrite())
- {
- this.EnsureCanSet(this._sourceProvider);
-
- this._sourceProvider = value;
- this._importEngine = newImportEngine;
-
- isThrowing = false;
- }
- }
- finally
- {
- if (isThrowing)
- {
- value.ExportsChanging -= this.OnExportsChangingInternal;
- newImportEngine.Dispose();
- }
- }
- }
- }
-
- /// <summary>
- /// Releases unmanaged and - optionally - managed resources
- /// </summary>
- public void Dispose()
- {
- this.Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- /// <summary>
- /// Releases unmanaged and - optionally - managed resources
- /// </summary>
- /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
- protected virtual void Dispose(bool disposing)
- {
- if (disposing)
- {
- if (!this._isDisposed)
- {
- bool disposeLock = false;
- INotifyComposablePartCatalogChanged catalogToUnsubscribeFrom = null;
- HashSet<IDisposable> partsToDispose = null;
- ExportProvider sourceProviderToUnsubscribeFrom = null;
- ImportEngine importEngineToDispose = null;
-
- try
- {
- using (this._lock.LockStateForWrite())
- {
- if (!this._isDisposed)
- {
- catalogToUnsubscribeFrom = this._catalog as INotifyComposablePartCatalogChanged;
- this._catalog = null;
-
- sourceProviderToUnsubscribeFrom = this._sourceProvider;
- this._sourceProvider = null;
-
- importEngineToDispose = this._importEngine;
- this._importEngine = null;
-
- partsToDispose = this._partsToDispose;
- this._partsToDispose = new HashSet<IDisposable>();
- this._activatedParts.Clear();
- this._conditionalReferencesForRecomposableParts = null;
-
- disposeLock = true;
- this._isDisposed = true;
- }
- }
- }
- finally
- {
- if (catalogToUnsubscribeFrom != null)
- {
- catalogToUnsubscribeFrom.Changing -= this.OnCatalogChanging;
- }
-
- if (sourceProviderToUnsubscribeFrom != null)
- {
- sourceProviderToUnsubscribeFrom.ExportsChanging -= this.OnExportsChangingInternal;
- }
-
- if (importEngineToDispose != null)
- {
- importEngineToDispose.Dispose();
- }
-
- if (partsToDispose != null)
- {
- foreach (var part in partsToDispose)
- {
- part.Dispose();
- }
- }
-
- if (disposeLock)
- {
- this._lock.Dispose();
- }
- }
- }
- }
- }
-
- /// <summary>
- /// Returns all exports that match the conditions of the specified import.
- /// </summary>
- /// <param name="definition">The <see cref="ImportDefinition"/> that defines the conditions of the
- /// <see cref="Export"/> to get.</param>
- /// <returns></returns>
- /// <result>
- /// An <see cref="IEnumerable{T}"/> of <see cref="Export"/> objects that match
- /// the conditions defined by <see cref="ImportDefinition"/>, if found; otherwise, an
- /// empty <see cref="IEnumerable{T}"/>.
- /// </result>
- /// <remarks>
- /// <note type="inheritinfo">
- /// The implementers should not treat the cardinality-related mismatches as errors, and are not
- /// expected to throw exceptions in those cases.
- /// For instance, if the import requests exactly one export and the provider has no matching exports or more than one,
- /// it should return an empty <see cref="IEnumerable{T}"/> of <see cref="Export"/>.
- /// </note>
- /// </remarks>
- protected override IEnumerable<Export> GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
- {
- this.ThrowIfDisposed();
- this.EnsureRunning();
-
- // Use the version of the catalog appropriate to this atomicComposition
- ComposablePartCatalog currentCatalog = atomicComposition.GetValueAllowNull(this._catalog);
-
- IPartCreatorImportDefinition partCreatorDefinition = definition as IPartCreatorImportDefinition;
- bool isPartCreator = false;
-
- if (partCreatorDefinition != null)
- {
- definition = partCreatorDefinition.ProductImportDefinition;
- isPartCreator = true;
- }
-
- CreationPolicy importPolicy = definition.GetRequiredCreationPolicy();
-
- List<Export> exports = new List<Export>();
- foreach (var partDefinitionAndExportDefinition in currentCatalog.GetExports(definition))
- {
- if (!IsRejected(partDefinitionAndExportDefinition.Item1, atomicComposition))
- {
- if (isPartCreator)
- {
- exports.Add(new PartCreatorExport(this,
- partDefinitionAndExportDefinition.Item1,
- partDefinitionAndExportDefinition.Item2));
- }
- else
- {
- exports.Add(CatalogExport.CreateExport(this,
- partDefinitionAndExportDefinition.Item1,
- partDefinitionAndExportDefinition.Item2,
- importPolicy));
- }
- }
- }
-
- return exports;
- }
-
- private void OnExportsChangingInternal(object sender, ExportsChangeEventArgs e)
- {
- UpdateRejections(e.AddedExports.Concat(e.RemovedExports), e.AtomicComposition);
- }
-
- private static ExportDefinition[] GetExportsFromPartDefinitions(IEnumerable<ComposablePartDefinition> partDefinitions)
- {
- List<ExportDefinition> exports = new List<ExportDefinition>();
-
- foreach (var partDefinition in partDefinitions)
- {
- foreach (var export in partDefinition.ExportDefinitions)
- {
- exports.Add(export);
-
- // While creating a PartCreatorExportDefinition for every changed definition may not be the most
- // efficient way to do this the PartCreatorExportDefinition is very efficient and doesn't do any
- // real work unless its metadata is pulled on. If this turns out to be a bottleneck then we
- // will need to start tracking all the PartCreator's we hand out and only send those which we
- // have handed out. In fact we could do the same thing for all the Exports if we wished but
- // that requires a cache management which we don't want to do at this point.
- exports.Add(new PartCreatorExportDefinition(export));
- }
- }
-
- return exports.ToArray();
- }
-
- [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
- private void OnCatalogChanging(object sender, ComposablePartCatalogChangeEventArgs e)
- {
- using (var atomicComposition = new AtomicComposition(e.AtomicComposition))
- {
- // Save the preview catalog to use in place of the original while handling
- // this event
- atomicComposition.SetValue(this._catalog,
- new CatalogChangeProxy(this._catalog, e.AddedDefinitions, e.RemovedDefinitions));
-
- IEnumerable<ExportDefinition> addedExports = GetExportsFromPartDefinitions(e.AddedDefinitions);
- IEnumerable<ExportDefinition> removedExports = GetExportsFromPartDefinitions(e.RemovedDefinitions);
-
- // Remove any parts based on eliminated definitions (in a atomicComposition-friendly
- // fashion)
- foreach (var definition in e.RemovedDefinitions)
- {
- ComposablePart removedPart = null;
- bool removed = false;
-
- using (this._lock.LockStateForRead())
- {
- removed = this._activatedParts.TryGetValue(definition, out removedPart);
- }
- if (removed)
- {
- var capturedDefinition = definition;
- ReleasePart(null, removedPart, atomicComposition);
- atomicComposition.AddCompleteActionAllowNull(() =>
- {
- using (this._lock.LockStateForWrite())
- {
- this._activatedParts.Remove(capturedDefinition);
- }
- });
- }
- }
-
- UpdateRejections(addedExports.ConcatAllowingNull(removedExports), atomicComposition);
-
- this.OnExportsChanging(
- new ExportsChangeEventArgs(addedExports, removedExports, atomicComposition));
-
- atomicComposition.AddCompleteAction(() => this.OnExportsChanged(
- new ExportsChangeEventArgs(addedExports, removedExports, null)));
-
- atomicComposition.Complete();
- }
- }
-
- private ComposablePart GetComposablePart(ComposablePartDefinition partDefinition, bool isSharedPart)
- {
- this.ThrowIfDisposed();
- this.EnsureRunning();
-
- ComposablePart part;
-
- if (isSharedPart)
- {
- part = GetSharedPart(partDefinition);
- }
- else
- {
- part = partDefinition.CreatePart();
-
- IDisposable disposablePart = part as IDisposable;
- if (disposablePart != null)
- {
- using (this._lock.LockStateForWrite())
- {
- this._partsToDispose.Add(disposablePart);
- }
- }
- }
-
- return part;
- }
-
- private ComposablePart GetSharedPart(ComposablePartDefinition partDefinition)
- {
- ComposablePart part;
- bool found = false;
-
- using (this._lock.LockStateForRead())
- {
- found = this._activatedParts.TryGetValue(partDefinition, out part);
- }
-
- if (!found)
- {
- ComposablePart newPart = partDefinition.CreatePart();
-
- using (this._lock.LockStateForWrite())
- {
- found = this._activatedParts.TryGetValue(partDefinition, out part);
-
- if (!found)
- {
- part = newPart;
- this._activatedParts.Add(partDefinition, part);
- IDisposable disposablePart = part as IDisposable;
- if (disposablePart != null)
- {
- this._partsToDispose.Add(disposablePart);
- }
- }
- }
- }
-
- return part;
- }
-
- private object GetExportedValue(ComposablePart part, ExportDefinition export, bool isSharedPart)
- {
- this.ThrowIfDisposed();
- this.EnsureRunning();
-
- Assumes.NotNull(part, export);
-
- object exportedValue = CompositionServices.GetExportedValueFromComposedPart(
- this._importEngine, part, export);
-
- // Only hold conditional references for recomposable non-shared parts because we are
- // already holding strong references to the shared parts.
- if (exportedValue != null && !isSharedPart && part.IsRecomposable())
- {
- SetConditionalReferenceForRecomposablePart(exportedValue, part);
- }
-
- return exportedValue;
- }
-
- private void ReleasePart(object exportedValue, ComposablePart part, AtomicComposition atomicComposition)
- {
- this.ThrowIfDisposed();
- this.EnsureRunning();
-
- Assumes.NotNull(part);
-
- this._importEngine.ReleaseImports(part, atomicComposition);
-
- if (exportedValue != null)
- {
- atomicComposition.AddCompleteActionAllowNull(() =>
- {
- using (this._lock.LockStateForWrite())
- {
- this._conditionalReferencesForRecomposableParts.Remove(exportedValue);
- }
- });
- }
-
- IDisposable diposablePart = part as IDisposable;
- if (diposablePart != null)
- {
- atomicComposition.AddCompleteActionAllowNull(() =>
- {
- bool removed = false;
- using (this._lock.LockStateForWrite())
- {
- removed = this._partsToDispose.Remove(diposablePart);
- }
- if (removed)
- {
- diposablePart.Dispose();
- }
- });
- }
- }
-
- private void SetConditionalReferenceForRecomposablePart(object exportedValue, ComposablePart part)
- {
- Assumes.NotNull(exportedValue, part);
-
- List<ComposablePart> partList;
-
- using (this._lock.LockStateForWrite())
- {
- if (!this._conditionalReferencesForRecomposableParts.TryGetValue(exportedValue, out partList))
- {
- partList = new List<ComposablePart>();
- this._conditionalReferencesForRecomposableParts.Add(exportedValue, partList);
- }
-
- // There is one really obscure case (one part exporting exact value multiple times) where
- // the part may already be in the list but it isn't a scenario that is interesting so
- // we simply always add. Later if we change this to support more than non-shared we may
- // need to check if the part already exists to pervent adding it multiple times.
- partList.Add(part);
- }
- }
-
- private bool IsRejected(ComposablePartDefinition definition, AtomicComposition atomicComposition)
- {
- // Check to see if we're currently working on the definition in question.
- // Recursive queries always answer optimistically, as if the definition hasn't
- // been rejected - because if it is we can discard all decisions that were based
- // on the faulty assumption in the first place.
- var forceRejectionTest = false;
- if (atomicComposition != null)
- {
- var atomicCompositionQuery = GetAtomicCompositionQuery(atomicComposition);
- AtomicCompositionQueryState state = atomicCompositionQuery(definition);
- switch (state)
- {
- case AtomicCompositionQueryState.TreatAsRejected:
- return true;
- case AtomicCompositionQueryState.TreatAsValidated:
- return false;
- case AtomicCompositionQueryState.NeedsTesting:
- forceRejectionTest = true;
- break;
- default:
- Assumes.IsTrue(state == AtomicCompositionQueryState.Unknown);
- // Need to do the work to determine the state
- break;
- }
- }
-
- if (!forceRejectionTest)
- {
- // Next, anything that has been activated is not rejected
- using (this._lock.LockStateForRead())
- {
- if (this._activatedParts.ContainsKey(definition))
- {
- return false;
- }
-
- // Last stop before doing the hard work: check a specific registry of rejected parts
- if (this._rejectedParts.Contains(definition))
- {
- return true;
- }
- }
- }
-
- // Determine whether or not the definition's imports can be satisfied
- return DetermineRejection(definition, atomicComposition);
- }
-
- private bool DetermineRejection(ComposablePartDefinition definition, AtomicComposition parentAtomicComposition)
- {
- ChangeRejectedException exception = null;
-
- using (var localAtomicComposition = new AtomicComposition(parentAtomicComposition))
- {
- // The part definition we're currently working on is treated optimistically
- // as if we know it hasn't been rejected. This handles recursion, and if we
- // later decide that it has been rejected we'll discard all nested progress so
- // all side-effects of the mistake are erased.
- //
- // Note that this means that recursive failures that would be detected by the
- // import engine are not discovered by rejection currently. Loops among
- // prerequisites, runaway import chains involving factories, and prerequisites
- // that cannot be fully satisfied still result in runtime errors. Doing
- // otherwise would be possible but potentially expensive - and could be a v2
- // improvement if deemed worthwhile.
- UpdateAtomicCompositionQuery(localAtomicComposition,
- def => definition.Equals(def), AtomicCompositionQueryState.TreatAsValidated);
-
- var newPart = definition.CreatePart();
- try
- {
- this._importEngine.PreviewImports(newPart, localAtomicComposition);
-
- // Reuse the partially-fleshed out part the next time we need a shared
- // instance to keep the expense of pre-validation to a minimum. Note that
- // _activatedParts holds references to both shared and non-shared parts.
- // The non-shared parts will only be used for rejection purposes only but
- // the shared parts will be handed out when requested via GetExports as
- // well as be used for rejection purposes.
- localAtomicComposition.AddCompleteActionAllowNull(() =>
- {
- using (this._lock.LockStateForWrite())
- {
- if (!this._activatedParts.ContainsKey(definition))
- {
- this._activatedParts.Add(definition, newPart);
- IDisposable newDisposablePart = newPart as IDisposable;
- if (newDisposablePart != null)
- {
- this._partsToDispose.Add(newDisposablePart);
- }
- }
- }
- });
-
- // Success! Complete any recursive work that was conditioned on this part's validation
- localAtomicComposition.Complete();
-
- return false;
- }
- catch (ChangeRejectedException ex)
- {
- exception = ex;
- }
- }
-
- // If we've reached this point then this part has been rejected so we need to
- // record the rejection in our parent composition or execute it immediately if
- // one doesn't exist.
- parentAtomicComposition.AddCompleteActionAllowNull(() =>
- {
- using (this._lock.LockStateForWrite())
- {
- this._rejectedParts.Add(definition);
- }
-
- CompositionTrace.PartDefinitionRejected(definition, exception);
-
- });
- if (parentAtomicComposition != null)
- {
- UpdateAtomicCompositionQuery(parentAtomicComposition,
- def => definition.Equals(def), AtomicCompositionQueryState.TreatAsRejected);
- }
-
- return true;
- }
-
- private void UpdateRejections(IEnumerable<ExportDefinition> changedExports, AtomicComposition atomicComposition)
- {
- using (var localAtomicComposition = new AtomicComposition(atomicComposition))
- {
- // Reconsider every part definition that has been previously
- // rejected to see if any of them can be added back.
- var affectedRejections = new HashSet<ComposablePartDefinition>();
- var atomicCompositionQuery = GetAtomicCompositionQuery(localAtomicComposition);
-
- ComposablePartDefinition[] rejectedParts;
- using (this._lock.LockStateForRead())
- {
- rejectedParts = this._rejectedParts.ToArray();
- }
- foreach (var definition in rejectedParts)
- {
- if (atomicCompositionQuery(definition) == AtomicCompositionQueryState.TreatAsValidated)
- {
- continue;
- }
-
- foreach (var import in definition.ImportDefinitions.Where(ImportEngine.IsRequiredImportForPreview))
- {
- if (changedExports.Any(export => import.IsConstraintSatisfiedBy(export)))
- {
- affectedRejections.Add(definition);
- break;
- }
- }
- }
- UpdateAtomicCompositionQuery(localAtomicComposition,
- def => affectedRejections.Contains(def), AtomicCompositionQueryState.NeedsTesting);
-
- // Determine if any of the resurrectable parts is now available so that we can
- // notify listeners of the exact changes to exports
- var resurrectedExports = new List<ExportDefinition>();
-
- foreach (var partDefinition in affectedRejections)
- {
- if (!IsRejected(partDefinition, localAtomicComposition))
- {
- // Notify listeners of the newly available exports and
- // prepare to remove the rejected part from the list of rejections
- resurrectedExports.AddRange(partDefinition.ExportDefinitions);
-
- // Capture the local so that the closure below refers to the current definition
- // in the loop and not the value of 'partDefinition' when the closure executes
- var capturedPartDefinition = partDefinition;
- localAtomicComposition.AddCompleteAction(() =>
- {
- using (this._lock.LockStateForWrite())
- {
- this._rejectedParts.Remove(capturedPartDefinition);
- }
-
- CompositionTrace.PartDefinitionResurrected(capturedPartDefinition);
- });
- }
- }
-
- // Notify anyone sourcing exports that the resurrected exports have appeared
- if (resurrectedExports.Any())
- {
- this.OnExportsChanging(
- new ExportsChangeEventArgs(resurrectedExports, new ExportDefinition[0], localAtomicComposition));
-
- localAtomicComposition.AddCompleteAction(() => this.OnExportsChanged(
- new ExportsChangeEventArgs(resurrectedExports, new ExportDefinition[0], null)));
- }
-
- localAtomicComposition.Complete();
- }
- }
-
- [DebuggerStepThrough]
- private void ThrowIfDisposed()
- {
- if (this._isDisposed)
- {
- throw ExceptionBuilder.CreateObjectDisposed(this);
- }
- }
-
- /// <summary>
- /// EnsureCanRun must be called from within a lock.
- /// </summary>
- [DebuggerStepThrough]
- private void EnsureCanRun()
- {
- if ((this._sourceProvider == null) || (this._importEngine == null))
- {
- throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Strings.ObjectMustBeInitialized, "SourceProvider")); // NOLOC
- }
- }
-
- [DebuggerStepThrough]
- private void EnsureRunning()
- {
- if (!this._isRunning)
- {
- using (this._lock.LockStateForWrite())
- {
- if (!this._isRunning)
- {
- this.EnsureCanRun();
- this._isRunning = true;
- }
- }
- }
- }
-
- /// <summary>
- /// EnsureCanSet<T> must be called from within a lock.
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="currentValue"></param>
- [DebuggerStepThrough]
- private void EnsureCanSet<T>(T currentValue)
- where T : class
- {
- if ((this._isRunning) || (currentValue != null))
- {
- throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Strings.ObjectAlreadyInitialized));
- }
- }
-
- private Func<ComposablePartDefinition, AtomicCompositionQueryState> GetAtomicCompositionQuery(AtomicComposition atomicComposition)
- {
- Func<ComposablePartDefinition, AtomicCompositionQueryState> atomicCompositionQuery;
- atomicComposition.TryGetValue(this, out atomicCompositionQuery);
-
- if (atomicCompositionQuery == null)
- {
- return (definition) => AtomicCompositionQueryState.Unknown;
- }
-
- return atomicCompositionQuery;
- }
-
- private void UpdateAtomicCompositionQuery(
- AtomicComposition atomicComposition,
- Func<ComposablePartDefinition, bool> query,
- AtomicCompositionQueryState state)
- {
- var parentQuery = GetAtomicCompositionQuery(atomicComposition);
- Func<ComposablePartDefinition, AtomicCompositionQueryState> newQuery = definition =>
- {
- if (query(definition))
- {
- return state;
- }
- return parentQuery(definition);
- };
-
- atomicComposition.SetValue(this, newQuery);
- }
-
- private enum AtomicCompositionQueryState
- {
- Unknown,
- TreatAsRejected,
- TreatAsValidated,
- NeedsTesting
- };
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ComposablePartCatalogChangeEventArgs.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ComposablePartCatalogChangeEventArgs.cs deleted file mode 100644 index bbb20feaf4e..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ComposablePartCatalogChangeEventArgs.cs +++ /dev/null @@ -1,81 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- /// <summary>
- /// Provides data for the <see cref="INotifyComposablePartCatalogChanged.Changed"/> and
- /// <see cref="INotifyComposablePartCatalogChanged.Changing"/> events.
- /// </summary>
- public class ComposablePartCatalogChangeEventArgs : EventArgs
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ComposablePartCatalogChangeEventArgs"/>.
- /// </summary>
- /// <param name="addedDefinitions">
- /// An <see cref="IEnumerable{T}"/> of <see cref="ComposablePartDefinition"/> objects that
- /// are being added to the <see cref="ComposablePartCatalog"/>.
- /// </param>
- /// <param name="removedDefinitions">
- /// An <see cref="IEnumerable{T}"/> of <see cref="ComposablePartDefinition"/> objects that
- /// are being removed from the <see cref="ComposablePartCatalog"/>.
- /// </param>
- /// <param name="atomicComposition">
- /// A <see cref="AtomicComposition"/> representing all tentative changes that will
- /// be completed if the change is successful, or discarded if it is not.
- /// <see langword="null"/> if being applied outside a <see cref="AtomicComposition"/>
- /// or during a <see cref="INotifyComposablePartCatalogChanged.Changed"/> event.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="addedDefinitions"/> or <paramref name="removedDefinitions"/> is <see langword="null"/>.
- /// </exception>
- public ComposablePartCatalogChangeEventArgs(IEnumerable<ComposablePartDefinition> addedDefinitions,
- IEnumerable<ComposablePartDefinition> removedDefinitions, AtomicComposition atomicComposition)
- {
- Requires.NotNull(addedDefinitions, "addedDefinitions");
- Requires.NotNull(removedDefinitions, "removedDefinitions");
-
- this.AddedDefinitions = addedDefinitions.AsArray();
- this.RemovedDefinitions = removedDefinitions.AsArray();
- this.AtomicComposition = atomicComposition;
- }
-
- /// <summary>
- /// Gets the identifiers of the parts that have been added.
- /// </summary>
- /// <value>
- /// An <see cref="IEnumerable{T}"/> of <see cref="ComposablePartDefinition"/> objects that
- /// have been added to the <see cref="ComposablePartCatalog"/>.
- /// </value>
- public IEnumerable<ComposablePartDefinition> AddedDefinitions { get; private set; }
-
- /// <summary>
- /// Gets the identifiers of the parts that have been removed.
- /// </summary>
- /// <value>
- /// An <see cref="IEnumerable{T}"/> of <see cref="ComposablePartDefinition"/> objects that
- /// have been removed from from the <see cref="ComposablePartCatalog"/>.
- /// </value>
- public IEnumerable<ComposablePartDefinition> RemovedDefinitions { get; private set; }
-
- /// <summary>
- /// Gets the atomicComposition, if any, that this change applies to.
- /// </summary>
- /// <value>
- /// A <see cref="AtomicComposition"/> that this set of changes applies too.
- /// It can be <see langword="null"/> if the changes are being applied outside a
- /// <see cref="AtomicComposition"/> or during a
- /// <see cref="INotifyComposablePartCatalogChanged.Changed"/> event.
- ///
- /// When the value is non-null it should be used to record temporary changed state
- /// and actions that will be executed when the atomicComposition is completeed.
- /// </value>
- public AtomicComposition AtomicComposition { get; private set; }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ComposablePartCatalogCollection.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ComposablePartCatalogCollection.cs deleted file mode 100644 index 466ab688872..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ComposablePartCatalogCollection.cs +++ /dev/null @@ -1,420 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.ObjectModel;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Diagnostics;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-using System.Collections;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- /// <summary>
- /// This class implements a threadsafe ICollection{T} of ComposablePartCatalog.
- /// It is exposed as an ICollection(ComposablePartCatalog)
- /// It is threadsafe, notifications are not marshalled using a SynchronizationContext.
- /// It is Disposable.
- /// </summary>
- internal class ComposablePartCatalogCollection : ICollection<ComposablePartCatalog>, INotifyComposablePartCatalogChanged, IDisposable
- {
- private readonly Lock _lock = new Lock();
- private Action<ComposablePartCatalogChangeEventArgs> _onChanged;
- private Action<ComposablePartCatalogChangeEventArgs> _onChanging;
- private List<ComposablePartCatalog> _catalogs = new List<ComposablePartCatalog>();
- private volatile bool _isCopyNeeded = false;
- private volatile bool _isDisposed = false;
- private bool _hasChanged = false;
-
- public ComposablePartCatalogCollection(IEnumerable<ComposablePartCatalog> catalogs)
- : this(catalogs, null, null)
- {
- }
-
- public ComposablePartCatalogCollection(
- IEnumerable<ComposablePartCatalog> catalogs,
- Action<ComposablePartCatalogChangeEventArgs> onChanged,
- Action<ComposablePartCatalogChangeEventArgs> onChanging)
- {
- catalogs = catalogs ?? Enumerable.Empty<ComposablePartCatalog>();
- this._catalogs = new List<ComposablePartCatalog>(catalogs);
- this._onChanged = onChanged;
- this._onChanging = onChanging;
-
- SubscribeToCatalogNotifications(catalogs);
- }
-
- public void Add(ComposablePartCatalog item)
- {
- Requires.NotNull(item, "item");
-
- this.ThrowIfDisposed();
-
- var addedParts = new Lazy<IEnumerable<ComposablePartDefinition>>(() => item.Parts.ToArray(), false);
-
- using (var atomicComposition = new AtomicComposition())
- {
- this.RaiseChangingEvent(addedParts, null, atomicComposition);
-
- using (new WriteLock(this._lock))
- {
- if (this._isCopyNeeded)
- {
- this._catalogs = new List<ComposablePartCatalog>(this._catalogs);
- this._isCopyNeeded = false;
- }
- this._hasChanged = true;
- this._catalogs.Add(item);
- }
-
- this.SubscribeToCatalogNotifications(item);
-
- // Complete after the catalog changes are written
- atomicComposition.Complete();
- }
-
- this.RaiseChangedEvent(addedParts, null);
- }
-
- /// <summary>
- /// Notify when the contents of the Catalog has changed.
- /// </summary>
- public event EventHandler<ComposablePartCatalogChangeEventArgs> Changed;
-
- /// <summary>
- /// Notify when the contents of the Catalog has changing.
- /// </summary>
- public event EventHandler<ComposablePartCatalogChangeEventArgs> Changing;
-
- public void Clear()
- {
- this.ThrowIfDisposed();
-
- // No action is required if we are already empty
- ComposablePartCatalog[] catalogs = null;
- using (new ReadLock(this._lock))
- {
- if (this._catalogs.Count == 0)
- {
- return;
- }
- catalogs = this._catalogs.ToArray();
- }
-
- //TODO-MT: This is pretty suspect - we can easily eliminate catalogs that aren't listed as being
- // removed. Then again, the idea of trying to mutate the catalog on two threads at the same time is pretty
- // suspect to begin with. When would that ever result in a meaningful composition?
-
- // We are doing this outside of the lock, so it's possible that the catalog will continute propagating events from things
- // we are about to unsubscribe from. Given the non-specificity of our event, in the worst case scenario we would simply fire
- // unnecessary events.
-
- var removedParts = new Lazy<IEnumerable<ComposablePartDefinition>>(() => catalogs.SelectMany(catalog => catalog.Parts).ToArray(), false);
-
- // Validate the changes before applying them
- using (var atomicComposition = new AtomicComposition())
- {
- this.RaiseChangingEvent(null, removedParts, atomicComposition);
- this.UnsubscribeFromCatalogNotifications(catalogs);
-
- using (new WriteLock(this._lock))
- {
- this._catalogs = new List<ComposablePartCatalog>();
-
- this._isCopyNeeded = false;
- this._hasChanged = true;
- }
-
- // Complete after the catalog changes are written
- atomicComposition.Complete();
- }
-
- this.RaiseChangedEvent(null, removedParts);
- }
-
- public bool Contains(ComposablePartCatalog item)
- {
- Requires.NotNull(item, "item");
-
- this.ThrowIfDisposed();
-
- using (new ReadLock(this._lock))
- {
- return this._catalogs.Contains(item);
- }
- }
-
- public void CopyTo(ComposablePartCatalog[] array, int arrayIndex)
- {
- this.ThrowIfDisposed();
-
- using (new ReadLock(this._lock))
- {
- this._catalogs.CopyTo(array, arrayIndex);
- }
- }
-
- public int Count
- {
- get
- {
- this.ThrowIfDisposed();
-
- using (new ReadLock(this._lock))
- {
- return this._catalogs.Count;
- }
- }
- }
-
- public bool IsReadOnly
- {
- get
- {
- this.ThrowIfDisposed();
-
- return false;
- }
- }
-
- public bool Remove(ComposablePartCatalog item)
- {
- Requires.NotNull(item, "item");
-
- this.ThrowIfDisposed();
-
- using (new ReadLock(this._lock))
- {
- if (!this._catalogs.Contains(item))
- {
- return false;
- }
- }
-
- bool isSuccessfulRemoval = false;
-
- var removedParts = new Lazy<IEnumerable<ComposablePartDefinition>>(() => item.Parts.ToArray(), false);
- using (var atomicComposition = new AtomicComposition())
- {
- this.RaiseChangingEvent(null, removedParts, atomicComposition);
-
- using (new WriteLock(this._lock))
- {
- if (_isCopyNeeded)
- {
- this._catalogs = new List<ComposablePartCatalog>(this._catalogs);
- this._isCopyNeeded = false;
- }
-
- isSuccessfulRemoval = this._catalogs.Remove(item);
- if (isSuccessfulRemoval)
- {
- this._hasChanged = true;
- }
- }
-
- this.UnsubscribeFromCatalogNotifications(item);
-
- // Complete after the catalog changes are written
- atomicComposition.Complete();
- }
-
- this.RaiseChangedEvent(null, removedParts);
-
- return isSuccessfulRemoval;
- }
-
- internal bool HasChanged
- {
- get
- {
- this.ThrowIfDisposed();
-
- using (new ReadLock(this._lock))
- {
- return this._hasChanged;
- }
- }
- }
-
- public IEnumerator<ComposablePartCatalog> GetEnumerator()
- {
- this.ThrowIfDisposed();
-
- using (new ReadLock(this._lock))
- {
- IEnumerator<ComposablePartCatalog> enumerator = this._catalogs.GetEnumerator();
- this._isCopyNeeded = true;
- return enumerator;
- }
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return this.GetEnumerator();
- }
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (disposing)
- {
- if (!this._isDisposed)
- {
- bool disposeLock = false;
- IEnumerable<ComposablePartCatalog> catalogs = null;
- try
- {
- using (new WriteLock(this._lock))
- {
- if (!this._isDisposed)
- {
- disposeLock = true;
-
- catalogs = this._catalogs;
- this._catalogs = null;
-
- this._isDisposed = true;
- }
- }
- }
- finally
- {
- if (catalogs != null)
- {
- this.UnsubscribeFromCatalogNotifications(catalogs);
- catalogs.ForEach(catalog => catalog.Dispose());
- }
-
- if (disposeLock)
- {
- this._lock.Dispose();
- }
- }
- }
- }
- }
-
- private void RaiseChangedEvent(
- Lazy<IEnumerable<ComposablePartDefinition>> addedDefinitions,
- Lazy<IEnumerable<ComposablePartDefinition>> removedDefinitions)
- {
- if (this._onChanged == null || this.Changed == null)
- {
- return;
- }
-
- var added = (addedDefinitions == null ? Enumerable.Empty<ComposablePartDefinition>() : addedDefinitions.Value);
- var removed = (removedDefinitions == null ? Enumerable.Empty<ComposablePartDefinition>() : removedDefinitions.Value);
-
- this._onChanged.Invoke(new ComposablePartCatalogChangeEventArgs(added, removed, null));
- }
-
- public void OnChanged(object sender, ComposablePartCatalogChangeEventArgs e)
- {
- var changedEvent = this.Changed;
- if (changedEvent != null)
- {
- changedEvent(sender, e);
- }
- }
-
- private void RaiseChangingEvent(
- Lazy<IEnumerable<ComposablePartDefinition>> addedDefinitions,
- Lazy<IEnumerable<ComposablePartDefinition>> removedDefinitions,
- AtomicComposition atomicComposition)
- {
- if (this._onChanging == null || this.Changing == null)
- {
- return;
- }
- var added = (addedDefinitions == null ? Enumerable.Empty<ComposablePartDefinition>() : addedDefinitions.Value);
- var removed = (removedDefinitions == null ? Enumerable.Empty<ComposablePartDefinition>() : removedDefinitions.Value);
-
- this._onChanging.Invoke(new ComposablePartCatalogChangeEventArgs(added, removed, atomicComposition));
- }
-
- public void OnChanging(object sender, ComposablePartCatalogChangeEventArgs e)
- {
- var changingEvent = this.Changing;
- if (changingEvent != null)
- {
- changingEvent(sender, e);
- }
- }
-
- private void OnContainedCatalogChanged(object sender, ComposablePartCatalogChangeEventArgs e)
- {
- if (this._onChanged == null || this.Changed == null)
- {
- return;
- }
-
- this._onChanged.Invoke(e);
- }
-
- private void OnContainedCatalogChanging(object sender, ComposablePartCatalogChangeEventArgs e)
- {
- if (this._onChanging == null || this.Changing == null)
- {
- return;
- }
-
- this._onChanging.Invoke(e);
- }
-
- private void SubscribeToCatalogNotifications(ComposablePartCatalog catalog)
- {
- INotifyComposablePartCatalogChanged notifyCatalog = catalog as INotifyComposablePartCatalogChanged;
- if (notifyCatalog != null)
- {
- notifyCatalog.Changed += this.OnContainedCatalogChanged;
- notifyCatalog.Changing += this.OnContainedCatalogChanging;
- }
- }
-
- private void SubscribeToCatalogNotifications(IEnumerable<ComposablePartCatalog> catalogs)
- {
- foreach (var catalog in catalogs)
- {
- SubscribeToCatalogNotifications(catalog);
- }
- }
-
- private void UnsubscribeFromCatalogNotifications(ComposablePartCatalog catalog)
- {
- INotifyComposablePartCatalogChanged notifyCatalog = catalog as INotifyComposablePartCatalogChanged;
- if (notifyCatalog != null)
- {
- notifyCatalog.Changed -= this.OnContainedCatalogChanged;
- notifyCatalog.Changing -= this.OnContainedCatalogChanging;
- }
- }
-
- private void UnsubscribeFromCatalogNotifications(IEnumerable<ComposablePartCatalog> catalogs)
- {
- foreach (var catalog in catalogs)
- {
- UnsubscribeFromCatalogNotifications(catalog);
- }
- }
-
- private void ThrowIfDisposed()
- {
- if (this._isDisposed)
- {
- throw ExceptionBuilder.CreateObjectDisposed(this);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ComposablePartExportProvider.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ComposablePartExportProvider.cs deleted file mode 100644 index e8c68eab905..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ComposablePartExportProvider.cs +++ /dev/null @@ -1,396 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-using System.Diagnostics;
-using System.Globalization;
-using System.Linq;
-using System.Threading;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- public class ComposablePartExportProvider : ExportProvider, IDisposable
- {
- private List<ComposablePart> _parts = new List<ComposablePart>();
- private volatile bool _isDisposed = false;
- private volatile bool _isRunning = false;
- private CompositionLock _lock = null;
- private ExportProvider _sourceProvider;
- private ImportEngine _importEngine;
- private volatile bool _currentlyComposing;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComposablePartExportProvider"/> class.
- /// </summary>
- public ComposablePartExportProvider() :
- this(false)
- {
- }
-
- public ComposablePartExportProvider(bool isThreadSafe)
- {
- this._lock = new CompositionLock(isThreadSafe);
- }
-
- /// <summary>
- /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- /// </summary>
- public void Dispose()
- {
- this.Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- /// <summary>
- /// Releases unmanaged and - optionally - managed resources
- /// </summary>
- /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
- protected virtual void Dispose(bool disposing)
- {
- if (disposing)
- {
- if (!this._isDisposed)
- {
- bool disposeLock = false;
- ImportEngine oldImportEngine = null;
- try
- {
- using (this._lock.LockStateForWrite())
- {
- if (!this._isDisposed)
- {
- oldImportEngine = this._importEngine;
- this._importEngine = null;
- this._sourceProvider = null;
- this._isDisposed = true;
- disposeLock = true;
- }
- }
- }
- finally
- {
- if (oldImportEngine != null)
- {
- oldImportEngine.Dispose();
- }
-
- if (disposeLock)
- {
- this._lock.Dispose();
- }
- }
- }
- }
- }
-
- /// <summary>
- /// Gets the export provider which provides the provider access to
- /// exports.
- /// </summary>
- /// <value>
- /// The <see cref="ExportProvider"/> which provides the
- /// <see cref="ComposablePartExportProvider"/> access to <see cref="Export"/> objects.
- /// The default is <see langword="null"/>.
- /// </value>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="value"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="InvalidOperationException">
- /// This property has already been set.
- /// <para>
- /// -or-
- /// </para>
- /// The methods on the <see cref="ComposablePartExportProvider"/>
- /// have already been accessed.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="ComposablePartExportProvider"/> has been disposed of.
- /// </exception>
- /// <remarks>
- /// This property must be set before accessing any methods on the
- /// <see cref="ComposablePartExportProvider"/>.
- /// </remarks>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "EnsureCanSet ensures that the property is set only once, Dispose is not required")]
- public ExportProvider SourceProvider
- {
- get
- {
- this.ThrowIfDisposed();
-
- return this._sourceProvider;
- }
- set
- {
- this.ThrowIfDisposed();
-
- Requires.NotNull(value, "value");
- using (this._lock.LockStateForWrite())
- {
- this.EnsureCanSet(this._sourceProvider);
- this._sourceProvider = value;
- }
-
- // This should be safe to do outside the lock, because only the first setter will ever win
- // and others will throw
- ImportEngine importEngine = new ImportEngine(this._sourceProvider, this._lock.IsThreadSafe);
- Thread.MemoryBarrier();
- this._importEngine = importEngine;
- }
- }
-
- /// <summary>
- /// Returns all exports that match the conditions of the specified import.
- /// </summary>
- /// <param name="definition">The <see cref="ImportDefinition"/> that defines the conditions of the
- /// <see cref="Export"/> to get.</param>
- /// <returns></returns>
- /// <result>
- /// An <see cref="IEnumerable{T}"/> of <see cref="Export"/> objects that match
- /// the conditions defined by <see cref="ImportDefinition"/>, if found; otherwise, an
- /// empty <see cref="IEnumerable{T}"/>.
- /// </result>
- /// <remarks>
- /// <note type="inheritinfo">
- /// The implementers should not treat the cardinality-related mismatches as errors, and are not
- /// expected to throw exceptions in those cases.
- /// For instance, if the import requests exactly one export and the provider has no matching exports or more than one,
- /// it should return an empty <see cref="IEnumerable{T}"/> of <see cref="Export"/>.
- /// </note>
- /// </remarks>
- protected override IEnumerable<Export> GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
- {
- this.ThrowIfDisposed();
- this.EnsureRunning();
-
- // Determine whether there is a composition atomicComposition-specific list of parts to use,
- // failing that use the usual list. We never change the list of parts in place,
- // but rather copy, change and write a new list atomically. Therefore all we need
- // to do here is to read the _parts member.
- List<ComposablePart> parts = null;
- using (this._lock.LockStateForRead())
- {
- parts = atomicComposition.GetValueAllowNull(this, this._parts);
- }
-
- if (parts.Count == 0)
- {
- return Enumerable.Empty<Export>();
- }
-
- List<Export> exports = new List<Export>();
- foreach (var part in parts)
- {
- foreach (var exportDefinition in part.ExportDefinitions)
- {
- if (definition.IsConstraintSatisfiedBy(exportDefinition))
- {
- exports.Add(this.CreateExport(part, exportDefinition));
- }
- }
- }
- return exports;
- }
-
- public void Compose(CompositionBatch batch)
- {
- this.ThrowIfDisposed();
- this.EnsureRunning();
-
- Requires.NotNull(batch, "batch");
-
- // Quick exit test can be done prior to cloning since it's just an optimization, not a
- // change in behavior
- if ((batch.PartsToAdd.Count == 0) && (batch.PartsToRemove.Count == 0))
- {
- return;
- }
-
- CompositionResult result = CompositionResult.SucceededResult;
-
- // Clone the batch, so that the external changes wouldn't happen half-way thorugh compose
- // NOTE : this does not guarantee the atomicity of cloning, which is not the goal anyway,
- // rather the fact that all subsequent calls will deal with an unchanging batch
- batch = new CompositionBatch(batch.PartsToAdd, batch.PartsToRemove);
-
- var newParts = GetUpdatedPartsList(batch);
-
- // Allow only recursive calls from the import engine to see the changes until
- // they've been verified ...
- using (var atomicComposition = new AtomicComposition())
- {
- // Don't allow reentrant calls to compose during previewing to prevent
- // corrupted state.
- if (this._currentlyComposing)
- {
- throw new InvalidOperationException(Strings.ReentrantCompose);
- }
-
- this._currentlyComposing = true;
-
- try
- {
- // In the meantime recursive calls need to be able to see the list as well
- atomicComposition.SetValue(this, newParts);
-
- // Recompose any existing imports effected by the these changes first so that
- // adapters, resurrected parts, etc. can all play their role in satisfying
- // imports for added parts
- this.Recompose(batch, atomicComposition);
-
- // Ensure that required imports can be satisfied
- foreach (ComposablePart part in batch.PartsToAdd)
- {
- // collect the result of previewing all the adds in the batch
- try
- {
- this._importEngine.PreviewImports(part, atomicComposition);
- }
- catch (ChangeRejectedException ex)
- {
- result = result.MergeResult(new CompositionResult(ex.Errors));
- }
- }
-
- result.ThrowOnErrors(atomicComposition);
-
- // Complete the new parts since they passed previewing.`
- using (this._lock.LockStateForWrite())
- {
- this._parts = newParts;
- }
-
- atomicComposition.Complete();
- }
- finally
- {
- this._currentlyComposing = false;
- }
- }
-
- // Satisfy Imports
- // - Satisfy imports on all newly added component parts
- foreach (ComposablePart part in batch.PartsToAdd)
- {
- result = result.MergeResult(CompositionServices.TryInvoke(() =>
- this._importEngine.SatisfyImports(part)));
- }
-
- // return errors
- result.ThrowOnErrors();
- }
-
- private List<ComposablePart> GetUpdatedPartsList(CompositionBatch batch)
- {
- Assumes.NotNull(batch);
-
- // Copy the current list of parts - we are about to modify it
- // This is an OK thing to do as this is the only method that can modify the List AND Compose can
- // only be executed on one thread at a time - thus two different threads cannot tramp over each other
- List<ComposablePart> parts = null;
- using (this._lock.LockStateForRead())
- {
- parts = this._parts.ToList(); // this copies the list
- }
-
- foreach (ComposablePart part in batch.PartsToAdd)
- {
- parts.Add(part);
- }
-
- foreach (ComposablePart part in batch.PartsToRemove)
- {
- parts.Remove(part);
- }
-
- return parts;
- }
-
- private void Recompose(CompositionBatch batch, AtomicComposition atomicComposition)
- {
- Assumes.NotNull(batch);
-
- // Unregister any removed component parts
- foreach (ComposablePart part in batch.PartsToRemove)
- {
- this._importEngine.ReleaseImports(part, atomicComposition);
- }
-
- // Recompose any imports effected by the these changes (the changes are
- // observable through GetExports in the appropriate atomicComposition, thus we can fire
- // the event
- IEnumerable<ExportDefinition> addedExports = batch.PartsToAdd.Count != 0 ?
- batch.PartsToAdd.SelectMany(part => part.ExportDefinitions).ToArray() :
- new ExportDefinition[0];
-
- IEnumerable<ExportDefinition> removedExports = batch.PartsToRemove.Count != 0 ?
- batch.PartsToRemove.SelectMany(part => part.ExportDefinitions).ToArray() :
- new ExportDefinition[0];
-
- this.OnExportsChanging(
- new ExportsChangeEventArgs(addedExports, removedExports, atomicComposition));
-
- atomicComposition.AddCompleteAction(() => this.OnExportsChanged(
- new ExportsChangeEventArgs(addedExports, removedExports, null)));
- }
-
- private Export CreateExport(ComposablePart part, ExportDefinition export)
- {
- return new Export(export, () => GetExportedValue(part, export));
- }
-
- private object GetExportedValue(ComposablePart part, ExportDefinition export)
- {
- this.ThrowIfDisposed();
- this.EnsureRunning();
-
- return CompositionServices.GetExportedValueFromComposedPart(this._importEngine, part, export);
- }
-
- [DebuggerStepThrough]
- private void ThrowIfDisposed()
- {
- if (this._isDisposed)
- {
- throw new ObjectDisposedException(this.GetType().Name);
- }
- }
-
- [DebuggerStepThrough]
- private void EnsureCanRun()
- {
- if ((this._sourceProvider == null) || (this._importEngine == null))
- {
- throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Strings.ObjectMustBeInitialized, "SourceProvider")); // NOLOC
- }
- }
-
- [DebuggerStepThrough]
- private void EnsureRunning()
- {
- if (!this._isRunning)
- {
- using (this._lock.LockStateForWrite())
- {
- if (!this._isRunning)
- {
- this.EnsureCanRun();
- this._isRunning = true;
- }
- }
- }
- }
-
- [DebuggerStepThrough]
- private void EnsureCanSet<T>(T currentValue)
- where T : class
- {
- if ((this._isRunning) || (currentValue != null))
- {
- throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Strings.ObjectAlreadyInitialized));
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionBatch.SingleExportComposablePart.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionBatch.SingleExportComposablePart.cs deleted file mode 100644 index a2d2f7a3cff..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionBatch.SingleExportComposablePart.cs +++ /dev/null @@ -1,62 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-using System.Linq;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- partial class CompositionBatch
- {
- // Represents a part that exports a single export
- private class SingleExportComposablePart : ComposablePart
- {
- private readonly Export _export;
-
- public SingleExportComposablePart(Export export)
- {
- Assumes.NotNull(export);
-
- this._export = export;
- }
-
- public override IDictionary<string, object> Metadata
- {
- get { return MetadataServices.EmptyMetadata; }
- }
-
- public override IEnumerable<ExportDefinition> ExportDefinitions
- {
- get { return new ExportDefinition[] { _export.Definition }; }
- }
-
- public override IEnumerable<ImportDefinition> ImportDefinitions
- {
- get { return Enumerable.Empty<ImportDefinition>(); }
- }
-
- public override object GetExportedValue(ExportDefinition definition)
- {
- Requires.NotNull(definition, "definition");
-
- if (definition != _export.Definition)
- {
- throw ExceptionBuilder.CreateExportDefinitionNotOnThisComposablePart("definition");
- }
-
- return _export.Value;
- }
-
- public override void SetImport(ImportDefinition definition, IEnumerable<Export> exports)
- {
- Requires.NotNull(definition, "definition");
- Requires.NotNullOrNullElements(exports, "exports");
-
- throw ExceptionBuilder.CreateImportDefinitionNotOnThisComposablePart("definition");
- }
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionBatch.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionBatch.cs deleted file mode 100644 index 62f0a4d4416..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionBatch.cs +++ /dev/null @@ -1,174 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-using System.Linq;
-using Microsoft.Internal;
-using System.Collections.ObjectModel;
-using System.Diagnostics.CodeAnalysis;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- public partial class CompositionBatch
- {
- private object _lock = new object();
- private bool _copyNeededForAdd;
- private bool _copyNeededForRemove;
- private List<ComposablePart> _partsToAdd;
- private ReadOnlyCollection<ComposablePart> _readOnlyPartsToAdd;
- private List<ComposablePart> _partsToRemove;
- private ReadOnlyCollection<ComposablePart> _readOnlyPartsToRemove;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CompositionBatch"/> class.
- /// </summary>
- public CompositionBatch() :
- this(null, null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CompositionBatch"/> class.
- /// </summary>
- /// <param name="partsToAdd">The parts to add.</param>
- /// <param name="partsToRemove">The parts to remove.</param>
- public CompositionBatch(IEnumerable<ComposablePart> partsToAdd, IEnumerable<ComposablePart> partsToRemove)
- {
- this._partsToAdd = new List<ComposablePart>();
- if (partsToAdd != null)
- {
- foreach (var part in partsToAdd)
- {
- if (part == null)
- {
- throw ExceptionBuilder.CreateContainsNullElement("partsToAdd");
- }
- this._partsToAdd.Add(part);
- }
- }
- this._readOnlyPartsToAdd = this._partsToAdd.AsReadOnly();
-
- this._partsToRemove = new List<ComposablePart>();
- if (partsToRemove != null)
- {
- foreach (var part in partsToRemove)
- {
- if (part == null)
- {
- throw ExceptionBuilder.CreateContainsNullElement("partsToRemove");
- }
- this._partsToRemove.Add(part);
- }
- }
- this._readOnlyPartsToRemove = this._partsToRemove.AsReadOnly();
- }
-
- /// <summary>
- /// Returns the collection of parts that will be added.
- /// </summary>
- /// <value>The parts to be added.</value>
- public ReadOnlyCollection<ComposablePart> PartsToAdd
- {
- get
- {
- lock (this._lock)
- {
- this._copyNeededForAdd = true;
- return this._readOnlyPartsToAdd;
- }
- }
- }
-
- /// <summary>
- /// Returns the collection of parts that will be removed.
- /// </summary>
- /// <value>The parts to be removed.</value>
- public ReadOnlyCollection<ComposablePart> PartsToRemove
- {
- get
- {
- lock (this._lock)
- {
- this._copyNeededForRemove = true;
- return this._readOnlyPartsToRemove;
- }
- }
- }
-
- /// <summary>
- /// Adds the specified part to the <see cref="CompositionBatch"/>.
- /// </summary>
- /// <param name="part">
- /// The part.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="part"/> is <see langword="null"/>.
- /// </exception>
- public void AddPart(ComposablePart part)
- {
- Requires.NotNull(part, "part");
- lock (this._lock)
- {
- if (this._copyNeededForAdd)
- {
- this._partsToAdd = new List<ComposablePart>(this._partsToAdd);
- this._readOnlyPartsToAdd = this._partsToAdd.AsReadOnly();
- this._copyNeededForAdd = false;
- }
- this._partsToAdd.Add(part);
- }
- }
-
- /// <summary>
- /// Removes the specified part from the <see cref="CompositionBatch"/>.
- /// </summary>
- /// <param name="part">
- /// The part.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="part"/> is <see langword="null"/>.
- /// </exception>
- public void RemovePart(ComposablePart part)
- {
- Requires.NotNull(part, "part");
- lock (this._lock)
- {
- if (this._copyNeededForRemove)
- {
- this._partsToRemove = new List<ComposablePart>(this._partsToRemove);
- this._readOnlyPartsToRemove = this._partsToRemove.AsReadOnly();
- this._copyNeededForRemove = false;
- }
- this._partsToRemove.Add(part);
- }
- }
-
- /// <summary>
- /// Adds the specified export to the <see cref="CompositionBatch"/>.
- /// </summary>
- /// <param name="export">
- /// The <see cref="Export"/> to add to the <see cref="CompositionBatch"/>.
- /// </param>
- /// <returns>
- /// A <see cref="ComposablePart"/> that can be used remove the <see cref="Export"/>
- /// from the <see cref="CompositionBatch"/>.
- /// </returns>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="export"/> is <see langword="null"/>.
- /// </exception>
- /// <remarks>
- /// </remarks>
- public ComposablePart AddExport(Export export)
- {
- Requires.NotNull(export, "export");
-
- ComposablePart part = new SingleExportComposablePart(export);
-
- this.AddPart(part);
-
- return part;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionConstants.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionConstants.cs deleted file mode 100644 index e8cbaa144a2..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionConstants.cs +++ /dev/null @@ -1,20 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- public static class CompositionConstants
- {
- private const string CompositionNamespace = "System.ComponentModel.Composition";
-
- public const string PartCreationPolicyMetadataName = CompositionNamespace + ".CreationPolicy";
- public const string ExportTypeIdentityMetadataName = "ExportTypeIdentity";
- internal const string ProductDefinitionMetadataName = "ProductDefinition";
-
- internal const string PartCreatorContractName = CompositionNamespace + ".Contracts.ExportFactory";
- internal static readonly string PartCreatorTypeIdentity = AttributedModelServices.GetTypeIdentity(typeof(ComposablePartDefinition));
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionContainer.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionContainer.cs deleted file mode 100644 index bdbd5c0595d..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionContainer.cs +++ /dev/null @@ -1,410 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.ComponentModel.Composition.Primitives;
-using System.Diagnostics;
-using System.Diagnostics.CodeAnalysis;
-using System.Linq;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-using System.Threading;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- public partial class CompositionContainer : ExportProvider, ICompositionService, IDisposable
- {
- private ImportEngine _importEngine;
- private ComposablePartExportProvider _partExportProvider;
- private AggregateExportProvider _aggregatingExportProvider;
- private ExportProvider _rootProvider;
- private CatalogExportProvider _catalogExportProvider;
- private readonly ReadOnlyCollection<ExportProvider> _providers;
- private volatile int _isDisposed = 0;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CompositionContainer"/> class.
- /// </summary>
- public CompositionContainer()
- : this((ComposablePartCatalog)null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CompositionContainer"/> class
- /// with the specified export providers.
- /// </summary>
- /// <param name="providers">
- /// A <see cref="Array"/> of <see cref="ExportProvider"/> objects which provide
- /// the <see cref="CompositionContainer"/> access to <see cref="Export"/> objects,
- /// or <see langword="null"/> to set <see cref="Providers"/> to an empty
- /// <see cref="ReadOnlyCollection{T}"/>.
- /// </param>
- /// <exception cref="ArgumentException">
- /// <paramref name="providers"/> contains an element that is <see langword="null"/>.
- /// </exception>
- public CompositionContainer(params ExportProvider[] providers) :
- this((ComposablePartCatalog)null, providers)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CompositionContainer"/> class
- /// with the specified catalog and export providers.
- /// </summary>
- /// <param name="providers">
- /// A <see cref="Array"/> of <see cref="ExportProvider"/> objects which provide
- /// the <see cref="CompositionContainer"/> access to <see cref="Export"/> objects,
- /// or <see langword="null"/> to set <see cref="Providers"/> to an empty
- /// <see cref="ReadOnlyCollection{T}"/>.
- /// </param>
- /// <exception cref="ArgumentException">
- /// <paramref name="providers"/> contains an element that is <see langword="null"/>.
- /// </exception>
- public CompositionContainer(ComposablePartCatalog catalog, params ExportProvider[] providers):
- this(catalog, false, providers)
- {
- }
-
- public CompositionContainer(ComposablePartCatalog catalog, bool isThreadSafe, params ExportProvider[] providers)
- {
- this._importEngine = new ImportEngine(this, isThreadSafe);
- this._partExportProvider = new ComposablePartExportProvider(isThreadSafe);
- this._partExportProvider.SourceProvider = this;
- this._providers = new ReadOnlyCollection<ExportProvider>(providers != null ? (ExportProvider[])providers.Clone() : new ExportProvider[0]);
-
- List<ExportProvider> providerList = new List<ExportProvider>();
-
- providerList.Add(this._partExportProvider);
-
- if (catalog != null)
- {
- this._catalogExportProvider = new CatalogExportProvider(catalog, isThreadSafe);
- this._catalogExportProvider.SourceProvider = this;
-
- providerList.Add(this._catalogExportProvider);
- }
-
- foreach (var provider in this._providers)
- {
- if (provider == null)
- {
- throw ExceptionBuilder.CreateContainsNullElement("providers");
- }
- providerList.Add(provider);
- }
-
- // we only build the aggregating provider if necessary - that is, if we have more than one provider to aggregate
- if (providerList.Count > 1)
- {
- this._aggregatingExportProvider = new AggregateExportProvider(providerList);
- this._rootProvider = this._aggregatingExportProvider;
- }
- else
- {
- Assumes.IsTrue(providerList.Count == 1);
- this._rootProvider = providerList[0];
- }
-
- this._rootProvider.ExportsChanged += this.OnExportsChangedInternal;
- this._rootProvider.ExportsChanging += this.OnExportsChangingInternal;
- }
-
- /// <summary>
- /// Gets the catalog which provides the container access to exports produced
- /// from composable parts.
- /// </summary>
- /// <value>
- /// The <see cref="ComposablePartCatalog"/> which provides the
- /// <see cref="CompositionContainer"/> access to exports produced from
- /// <see cref="ComposablePart"/> objects. The default is <see langword="null"/>.
- /// </value>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="CompositionContainer"/> has been disposed of.
- /// </exception>
- public ComposablePartCatalog Catalog
- {
- get
- {
- ThrowIfDisposed();
-
- if (_catalogExportProvider != null)
- {
- return _catalogExportProvider.Catalog;
- }
-
- return null;
- }
- }
-
- /// <summary>
- /// Gets the export providers which provide the container access to additional exports.
- /// </summary>
- /// <value>
- /// A <see cref="ReadOnlyCollection{T}"/> of <see cref="ExportProvider"/> objects
- /// which provide the <see cref="CompositionContainer"/> access to additional
- /// <see cref="Export"/> objects. The default is an empty
- /// <see cref="ReadOnlyCollection{T}"/>.
- /// </value>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="CompositionContainer"/> has been disposed of.
- /// </exception>
- public ReadOnlyCollection<ExportProvider> Providers
- {
- get
- {
- this.ThrowIfDisposed();
-
- return this._providers;
- }
- }
-
- /// <summary>
- /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- /// </summary>
- public void Dispose()
- {
- this.Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- /// <summary>
- /// Releases unmanaged and - optionally - managed resources
- /// </summary>
- /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
- protected virtual void Dispose(bool disposing)
- {
- if (disposing)
- {
- // NOTE : According to http://msdn.microsoft.com/en-us/library/4bw5ewxy.aspx, the warning is bogus when used with Interlocked API.
-#pragma warning disable 420
- if (Interlocked.CompareExchange(ref this._isDisposed, 1, 0) == 0)
-#pragma warning restore 420
- {
- this._rootProvider.ExportsChanged -= this.OnExportsChangedInternal;
- this._rootProvider.ExportsChanging -= this.OnExportsChangingInternal;
- if (this._aggregatingExportProvider != null)
- {
- this._aggregatingExportProvider.Dispose();
- }
- this._partExportProvider.Dispose();
- if (this._catalogExportProvider != null)
- {
- this._catalogExportProvider.Dispose();
- }
- this._importEngine.Dispose();
- }
- }
- }
-
- public void Compose(CompositionBatch batch)
- {
- Requires.NotNull(batch, "batch");
-
- this.ThrowIfDisposed();
- this._partExportProvider.Compose(batch);
- }
-
- /// <summary>
- /// Releases the <see cref="Export"/> from the <see cref="CompositionContainer"/>. The behavior
- /// may vary depending on the implementation of the <see cref="ExportProvider"/> that produced
- /// the <see cref="Export"/> instance. As a general rule non shared exports should be early
- /// released causing them to be detached from the container.
- ///
- /// For example the <see cref="CatalogExportProvider"/> will only release
- /// an <see cref="Export"/> if it comes from a <see cref="ComposablePart"/> that was constructed
- /// under a <see cref="CreationPolicy.NonShared" /> context. Release in this context means walking
- /// the dependency chain of the <see cref="Export"/>s, detaching references from the container and
- /// calling Dispose on the <see cref="ComposablePart"/>s as needed. If the <see cref="Export"/>
- /// was constructed under a <see cref="CreationPolicy.Shared" /> context the
- /// <see cref="CatalogExportProvider"/> will do nothing as it may be in use by other requestors.
- /// Those will only be detached when the container is itself disposed.
- /// </summary>
- /// <param name="export"><see cref="Export"/> that needs to be released.</param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="export"/> is <see langword="null"/>.
- /// </exception>
- [SuppressMessage("Microsoft.Performance", "CA1822")]
- public void ReleaseExport(Export export)
- {
- Requires.NotNull(export, "export");
-
- IDisposable dependency = export as IDisposable;
-
- if (dependency != null)
- {
- dependency.Dispose();
- }
- }
-
- /// <summary>
- /// Releases the <see cref="Lazy{T}"/> from the <see cref="CompositionContainer"/>. The behavior
- /// may vary depending on the implementation of the <see cref="ExportProvider"/> that produced
- /// the <see cref="Export"/> instance. As a general rule non shared exports should be early
- /// released causing them to be detached from the container.
- ///
- /// For example the <see cref="CatalogExportProvider"/> will only release
- /// an <see cref="Lazy{T}"/> if it comes from a <see cref="ComposablePart"/> that was constructed
- /// under a <see cref="CreationPolicy.NonShared" /> context. Release in this context means walking
- /// the dependency chain of the <see cref="Export"/>s, detaching references from the container and
- /// calling Dispose on the <see cref="ComposablePart"/>s as needed. If the <see cref="Export"/>
- /// was constructed under a <see cref="CreationPolicy.Shared" /> context the
- /// <see cref="CatalogExportProvider"/> will do nothing as it may be in use by other requestors.
- /// Those will only be detached when the container is itself disposed.
- /// </summary>
- /// <param name="export"><see cref="Export"/> that needs to be released.</param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="export"/> is <see langword="null"/>.
- /// </exception>
- [SuppressMessage("Microsoft.Performance", "CA1822")]
- public void ReleaseExport<T>(Lazy<T> export)
- {
- Requires.NotNull(export, "export");
-
- IDisposable dependency = export as IDisposable;
-
- if (dependency != null)
- {
- dependency.Dispose();
- }
- }
-
- /// <summary>
- /// Releases a set of <see cref="Export"/>s from the <see cref="CompositionContainer"/>.
- /// See also <see cref="ReleaseExport"/>.
- /// </summary>
- /// <param name="exports"><see cref="Export"/>s that need to be released.</param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="exports"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ArgumentException">
- /// <paramref name="exports"/> contains an element that is <see langword="null"/>.
- /// </exception>
- public void ReleaseExports(IEnumerable<Export> exports)
- {
- Requires.NotNullOrNullElements(exports, "exports");
-
- foreach (Export export in exports)
- {
- this.ReleaseExport(export);
- }
- }
-
- /// <summary>
- /// Releases a set of <see cref="Export"/>s from the <see cref="CompositionContainer"/>.
- /// See also <see cref="ReleaseExport"/>.
- /// </summary>
- /// <param name="exports"><see cref="Export"/>s that need to be released.</param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="exports"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ArgumentException">
- /// <paramref name="exports"/> contains an element that is <see langword="null"/>.
- /// </exception>
- [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
- public void ReleaseExports<T>(IEnumerable<Lazy<T>> exports)
- {
- Requires.NotNullOrNullElements(exports, "exports");
-
- foreach (Lazy<T> export in exports)
- {
- this.ReleaseExport(export);
- }
- }
-
- /// <summary>
- /// Releases a set of <see cref="Export"/>s from the <see cref="CompositionContainer"/>.
- /// See also <see cref="ReleaseExport"/>.
- /// </summary>
- /// <param name="exports"><see cref="Export"/>s that need to be released.</param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="exports"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ArgumentException">
- /// <paramref name="exports"/> contains an element that is <see langword="null"/>.
- /// </exception>
- [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
- public void ReleaseExports<T, TMetadataView>(IEnumerable<Lazy<T, TMetadataView>> exports)
- {
- Requires.NotNullOrNullElements(exports, "exports");
-
- foreach (Lazy<T, TMetadataView> export in exports)
- {
- this.ReleaseExport(export);
- }
- }
-
- /// <summary>
- /// Sets the imports of the specified composable part exactly once and they will not
- /// ever be recomposed.
- /// </summary>
- /// <param name="part">
- /// The <see cref="ComposablePart"/> to set the imports.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="part"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="CompositionException">
- /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
- /// contain a collection of errors that occurred.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="ICompositionService"/> has been disposed of.
- /// </exception>
- public void SatisfyImportsOnce(ComposablePart part)
- {
- this.ThrowIfDisposed();
- this._importEngine.SatisfyImportsOnce(part);
- }
-
- internal void OnExportsChangedInternal(object sender, ExportsChangeEventArgs e)
- {
- this.OnExportsChanged(e);
- }
-
- internal void OnExportsChangingInternal(object sender, ExportsChangeEventArgs e)
- {
- this.OnExportsChanging(e);
- }
-
- /// <summary>
- /// Returns all exports that match the conditions of the specified import.
- /// </summary>
- /// <param name="definition">The <see cref="ImportDefinition"/> that defines the conditions of the
- /// <see cref="Export"/> to get.</param>
- /// <returns></returns>
- /// <result>
- /// An <see cref="IEnumerable{T}"/> of <see cref="Export"/> objects that match
- /// the conditions defined by <see cref="ImportDefinition"/>, if found; otherwise, an
- /// empty <see cref="IEnumerable{T}"/>.
- /// </result>
- /// <remarks>
- /// <note type="inheritinfo">
- /// The implementers should not treat the cardinality-related mismatches as errors, and are not
- /// expected to throw exceptions in those cases.
- /// For instance, if the import requests exactly one export and the provider has no matching exports or more than one,
- /// it should return an empty <see cref="IEnumerable{T}"/> of <see cref="Export"/>.
- /// </note>
- /// </remarks>
- protected override IEnumerable<Export> GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
- {
- this.ThrowIfDisposed();
-
- IEnumerable<Export> exports = null;
- this._rootProvider.TryGetExports(definition, atomicComposition, out exports);
-
- return exports;
- }
-
- [DebuggerStepThrough]
- private void ThrowIfDisposed()
- {
- if (this._isDisposed == 1)
- {
- throw ExceptionBuilder.CreateObjectDisposed(this);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionLock.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionLock.cs deleted file mode 100644 index b3dd0ea062f..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionLock.cs +++ /dev/null @@ -1,153 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-#define SINGLETHREADEDLOCKENFORCEMENT
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-using System.Diagnostics;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-using System.Threading;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- // This a a lock class that needs to be held in order to perform any mutation of the parts/parts state in the composition
- // Today's implementation relies on the AppDomain-wide re-entrant lock for changes on the composition, and a narrow lock for changes in
- // the state of the specific ImportEngine
- // Today we make several assumptions to ensure thread-safety:
- // 1. Each composition doesn't change lock affinity
- // 2. Every part of the system that updates the status of the parts (in our case ImportEngine) needs to hold the same wide - lock
- // 3. State of the import engine that gets accessed outside of the wide lock needs to be accessed in the context of the narrow lock
- // 4. Narrow lock CAN be taken inside the wide lock
- // 5. Wide lock CANNOT be taken inside the narrow lock
- // 6. No 3rd party code will EVER get called inside the narrow lock
- // Sadly, this means that we WILL be calling 3rd party code under a lock, but as long as the lock is re-entrant and they can't invoke us on anotehr thread
- // we have no issue, other than potential overlocking
- internal sealed class CompositionLock : IDisposable
- {
- // narrow lock
- private readonly Lock _stateLock = null;
- // wide lock
- private static object _compositionLock = new object();
-
- private int _isDisposed = 0;
- private bool _isThreadSafe = false;
-
- private static readonly EmptyLockHolder _EmptyLockHolder = new EmptyLockHolder();
-
- public CompositionLock(bool isThreadSafe)
- {
- this._isThreadSafe = isThreadSafe;
- if (isThreadSafe)
- {
- this._stateLock = new Lock();
- }
- }
-
- public void Dispose()
- {
- if (this._isThreadSafe)
- {
- if (Interlocked.CompareExchange(ref this._isDisposed, 1, 0) == 0)
- {
- this._stateLock.Dispose();
- }
- }
- }
-
- public bool IsThreadSafe
- {
- get
- {
- return this._isThreadSafe;
- }
- }
-
- private void EnterCompositionLock()
- {
-#pragma warning disable 618
- if (this._isThreadSafe)
- {
- Monitor.Enter(_compositionLock);
- }
-#pragma warning restore 618
- }
-
- private void ExitCompositionLock()
- {
- if (this._isThreadSafe)
- {
- Monitor.Exit(_compositionLock);
- }
- }
-
- public IDisposable LockComposition()
- {
- if (this._isThreadSafe)
- {
- return new CompositionLockHolder(this);
- }
- else
- {
- return _EmptyLockHolder;
- }
- }
-
- public IDisposable LockStateForRead()
- {
- if (this._isThreadSafe)
- {
- return new ReadLock(this._stateLock);
- }
- else
- {
- return _EmptyLockHolder;
- }
- }
-
- public IDisposable LockStateForWrite()
- {
- if (this._isThreadSafe)
- {
- return new WriteLock(this._stateLock);
- }
- else
- {
- return _EmptyLockHolder;
- }
- }
-
- // NOTE : this should NOT be changed to a struct as ImportEngine relies on it
- public sealed class CompositionLockHolder : IDisposable
- {
- private CompositionLock _lock;
- private int _isDisposed;
-
- public CompositionLockHolder(CompositionLock @lock)
- {
- this._lock = @lock;
-
- this._isDisposed = 0;
- this._lock.EnterCompositionLock();
- }
-
- public void Dispose()
- {
- if (Interlocked.CompareExchange(ref this._isDisposed, 1, 0) == 0)
- {
- this._lock.ExitCompositionLock();
- }
- }
- }
-
- private sealed class EmptyLockHolder : IDisposable
- {
- public void Dispose()
- {
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionServices.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionServices.cs deleted file mode 100644 index 5a7d9851e57..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionServices.cs +++ /dev/null @@ -1,522 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.ComponentModel.Composition.AttributedModel;
-using System.ComponentModel.Composition.Primitives;
-using System.Globalization;
-using System.Linq;
-using System.Reflection;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-using System.Collections.ObjectModel;
-using System.ComponentModel.Composition.ReflectionModel;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- internal static class CompositionServices
- {
- internal static readonly Type InheritedExportAttributeType = typeof(InheritedExportAttribute);
- internal static readonly Type ExportAttributeType = typeof(ExportAttribute);
- internal static readonly Type AttributeType = typeof(Attribute);
- internal static readonly Type ObjectType = typeof(object);
-
- private static readonly string[] reservedMetadataNames = new string[]
- {
- CompositionConstants.PartCreationPolicyMetadataName
- };
-
- internal static Type GetDefaultTypeFromMember(this MemberInfo member)
- {
- Assumes.NotNull(member);
-
- switch (member.MemberType)
- {
- case MemberTypes.Property:
- return ((PropertyInfo)member).PropertyType;
-
- case MemberTypes.NestedType:
- case MemberTypes.TypeInfo:
- return ((Type)member);
-
- case MemberTypes.Field:
- default:
- Assumes.IsTrue(member.MemberType == MemberTypes.Field);
- return ((FieldInfo)member).FieldType;
- }
- }
-
- internal static string GetContractNameFromExport(this MemberInfo member, ExportAttribute export)
- {
- if (!string.IsNullOrEmpty(export.ContractName))
- {
- return export.ContractName;
- }
-
- if (export.ContractType != null)
- {
- return AttributedModelServices.GetContractName(export.ContractType);
- }
-
- if (member.MemberType == MemberTypes.Method)
- {
- return AttributedModelServices.GetTypeIdentity((MethodInfo)member);
- }
-
- return AttributedModelServices.GetContractName(member.GetDefaultTypeFromMember());
- }
-
- internal static string GetTypeIdentityFromExport(this MemberInfo member, ExportAttribute export)
- {
- if (export.ContractType != null)
- {
- return AttributedModelServices.GetTypeIdentity(export.ContractType);
- }
-
- if (member.MemberType == MemberTypes.Method)
- {
- return AttributedModelServices.GetTypeIdentity((MethodInfo)member);
- }
-
- return AttributedModelServices.GetTypeIdentity(member.GetDefaultTypeFromMember());
- }
-
- internal static Type GetContractTypeFromImport(this IAttributedImport import, ImportType importType)
- {
- if (import.ContractType != null)
- {
- return import.ContractType;
- }
-
- return importType.ContractType;
- }
-
- internal static string GetContractNameFromImport(this IAttributedImport import, ImportType importType)
- {
- if (!string.IsNullOrEmpty(import.ContractName))
- {
- return import.ContractName;
- }
-
- Type contractType = import.GetContractTypeFromImport(importType);
-
- return AttributedModelServices.GetContractName(contractType);
- }
-
- internal static string GetTypeIdentityFromImport(this IAttributedImport import, ImportType importType)
- {
- Type contractType = import.GetContractTypeFromImport(importType);
-
- // For our importers we treat object as not having a type identity
- if (contractType == CompositionServices.ObjectType)
- {
- return null;
- }
-
- return AttributedModelServices.GetTypeIdentity(contractType);
- }
-
- internal static IDictionary<string, object> GetPartMetadataForType(this Type type, CreationPolicy creationPolicy)
- {
- IDictionary<string, object> dictionary = new Dictionary<string, object>(StringComparers.MetadataKeyNames);
-
- if (creationPolicy != CreationPolicy.Any)
- {
- dictionary.Add(CompositionConstants.PartCreationPolicyMetadataName, creationPolicy);
- }
-
- foreach (PartMetadataAttribute partMetadata in type.GetAttributes<PartMetadataAttribute>())
- {
- if (reservedMetadataNames.Contains(partMetadata.Name, StringComparers.MetadataKeyNames)
- || dictionary.ContainsKey(partMetadata.Name))
- {
- // Perhaps we should log an error here so that people know this value is being ignored.
- continue;
- }
-
- dictionary.Add(partMetadata.Name, partMetadata.Value);
- }
-
- if (dictionary.Count == 0)
- {
- return MetadataServices.EmptyMetadata;
- }
- else
- {
- return dictionary;
- }
- }
-
- internal static void TryExportMetadataForMember(this MemberInfo member, out IDictionary<string, object> dictionary)
- {
- dictionary = new Dictionary<string, object>();
-
- foreach (var attr in member.GetAttributes<Attribute>())
- {
- var provider = attr as ExportMetadataAttribute;
-
- if (provider != null)
- {
- if (reservedMetadataNames.Contains(provider.Name, StringComparers.MetadataKeyNames))
- {
- throw ExceptionBuilder.CreateDiscoveryException(Strings.Discovery_ReservedMetadataNameUsed, member.GetDisplayName(), provider.Name);
- }
-
- // we pass "null" for valueType which would make it inferred. We don;t have additional type information when metadata
- // goes through the ExportMetadataAttribute path
- if (!dictionary.TryContributeMetadataValue(provider.Name, provider.Value, null, provider.IsMultiple))
- {
- throw ExceptionBuilder.CreateDiscoveryException(Strings.Discovery_DuplicateMetadataNameValues, member.GetDisplayName(), provider.Name);
- }
- }
- else
- {
- Type attrType = attr.GetType();
- if ((attrType != CompositionServices.ExportAttributeType) && attrType.IsAttributeDefined<MetadataAttributeAttribute>(true))
- {
- bool allowsMultiple = false;
- AttributeUsageAttribute usage = attrType.GetFirstAttribute<AttributeUsageAttribute>(true);
-
- if (usage != null)
- {
- allowsMultiple = usage.AllowMultiple;
- }
-
- foreach (PropertyInfo pi in attrType.GetProperties())
- {
- if (pi.DeclaringType == CompositionServices.ExportAttributeType || pi.DeclaringType == CompositionServices.AttributeType)
- {
- // Don't contribute metadata properies from the base attribute types.
- continue;
- }
-
- if (reservedMetadataNames.Contains(pi.Name, StringComparers.MetadataKeyNames))
- {
- throw ExceptionBuilder.CreateDiscoveryException(Strings.Discovery_ReservedMetadataNameUsed, member.GetDisplayName(), provider.Name);
- }
-
- object value = pi.GetValue(attr, null);
-
- if (value != null && !IsValidAttributeType(value.GetType()))
- {
- throw ExceptionBuilder.CreateDiscoveryException(Strings.Discovery_MetadataContainsValueWithInvalidType, pi.GetDisplayName(), value.GetType().GetDisplayName());
- }
-
- if (!dictionary.TryContributeMetadataValue(pi.Name, value, pi.PropertyType, allowsMultiple))
- {
- throw ExceptionBuilder.CreateDiscoveryException(Strings.Discovery_DuplicateMetadataNameValues, member.GetDisplayName(), pi.Name);
- }
- }
- }
- }
- }
-
- // Need Keys.ToArray because we alter the dictionary in the loop
- foreach (var key in dictionary.Keys.ToArray())
- {
- var list = dictionary[key] as MetadataList;
- if (list != null)
- {
- dictionary[key] = list.ToArray();
- }
- }
-
- return;
- }
-
- private static bool TryContributeMetadataValue(this IDictionary<string, object> dictionary, string name, object value, Type valueType, bool allowsMultiple)
- {
- object metadataValue;
- if (!dictionary.TryGetValue(name, out metadataValue))
- {
- if (allowsMultiple)
- {
- var list = new MetadataList();
- list.Add(value, valueType);
- value = list;
- }
-
- dictionary.Add(name, value);
- }
- else
- {
- var list = metadataValue as MetadataList;
- if (!allowsMultiple || list == null)
- {
- // Either single value already found when should be multiple
- // or a duplicate name already exists
- dictionary.Remove(name);
- return false;
- }
-
- list.Add(value, valueType);
- }
- return true;
- }
-
- private class MetadataList
- {
- private Type _arrayType = null;
- private bool _containsNulls = false;
- private static readonly Type ObjectType = typeof(object);
- private static readonly Type TypeType = typeof(Type);
- private Collection<object> _innerList = new Collection<object>();
-
- public void Add(object item, Type itemType)
- {
- this._containsNulls |= (item == null);
-
- // if we've been passed typeof(object), we basically have no type inmformation
- if (itemType == ObjectType)
- {
- itemType = null;
- }
-
- // if we have no type information, get it from the item, if we can
- if ((itemType == null) && (item != null))
- {
- itemType = item.GetType();
- }
-
- // Types are special, because the are abstract classes, so if the item casts to Type, we assume System.Type
- if (item is Type)
- {
- itemType = TypeType;
- }
-
- // only try to call this if we got a meaningful type
- if (itemType != null)
- {
- this.InferArrayType(itemType);
- }
-
- this._innerList.Add(item);
- }
-
- private void InferArrayType(Type itemType)
- {
- Assumes.NotNull(itemType);
-
- if (this._arrayType == null)
- {
- // this is the first typed element we've been given, it sets the type of the array
- this._arrayType = itemType;
- }
- else
- {
- // if there's a disagreement on the array type, we flip to Object
- // NOTE : we can try to do better in the future to find common base class, but given that we support very limited set of types
- // in metadata right now, it's a moot point
- if (this._arrayType != itemType)
- {
- this._arrayType = ObjectType;
- }
- }
- }
-
- public Array ToArray()
- {
- if (this._arrayType == null)
- {
- // if the array type has not been set, assume Object
- this._arrayType = ObjectType;
- }
- else if (this._containsNulls && this._arrayType.IsValueType)
- {
- // if the array type is a value type and we have seen nulls, then assume Object
- this._arrayType = ObjectType;
- }
-
- Array array = Array.CreateInstance(this._arrayType, this._innerList.Count);
-
- for(int i = 0; i < array.Length; i++)
- {
- array.SetValue(this._innerList[i], i);
- }
- return array;
- }
- }
-
- //UNDONE: Need to add these warnings somewhere...Dev10:472538 should address this.
- //internal static CompositionResult MatchRequiredMetadata(this IDictionary<string, object> metadata, IEnumerable<string> requiredMetadata, string contractName)
- //{
- // Assumes.IsTrue(metadata != null);
-
- // var result = CompositionResult.SucceededResult;
-
- // var missingMetadata = (requiredMetadata == null) ? null : requiredMetadata.Except<string>(metadata.Keys);
- // if (missingMetadata != null && missingMetadata.Any())
- // {
- // result = result.MergeIssue(
- // CompositionError.CreateIssueAsWarning(CompositionErrorId.RequiredMetadataNotFound,
- // Strings.RequiredMetadataNotFound,
- // contractName,
- // string.Join(", ", missingMetadata.ToArray())));
-
- // return new CompositionResult(false, result.Issues);
- // }
-
- // return result;
- //}
-
- internal static IEnumerable<KeyValuePair<string, Type>> GetRequiredMetadata(Type metadataViewType)
- {
- if ((metadataViewType == null) ||
- ExportServices.IsDefaultMetadataViewType(metadataViewType) ||
- ExportServices.IsDictionaryConstructorViewType(metadataViewType) ||
- !metadataViewType.IsInterface)
- {
- return Enumerable.Empty<KeyValuePair<string, Type>>();
- }
-
- // A metadata view is required to be an Intrerface, and therefore only properties are allowed
- List<PropertyInfo> properties = metadataViewType.GetAllProperties().
- Where(property => property.GetFirstAttribute<DefaultValueAttribute>() == null).
- ToList();
-
- // NOTE : this is a carefully found balance between eager and delay-evaluation - the properties are filtered once and upfront
- // whereas the key/Type pairs are created every time. The latter is fine as KVPs are structs and as such copied on access regardless.
- // This also allows us to avoid creation of List<KVP> which - at least according to FxCop - leads to isues with NGEN
- return properties.Select(property => new KeyValuePair<string, Type>(property.Name, property.PropertyType));
- }
-
- internal static object GetExportedValueFromComposedPart(ImportEngine engine, ComposablePart part, ExportDefinition definition)
- {
- try
- {
- engine.SatisfyImports(part);
- }
- catch (CompositionException ex)
- {
- throw ExceptionBuilder.CreateCannotGetExportedValue(part, definition, ex);
- }
-
- try
- {
- return part.GetExportedValue(definition);
- }
- catch (ComposablePartException ex)
- {
- throw ExceptionBuilder.CreateCannotGetExportedValue(part, definition, ex);
- }
- }
-
- internal static bool IsRecomposable(this ComposablePart part)
- {
- return part.ImportDefinitions.Any(import => import.IsRecomposable);
- }
-
- internal static CompositionResult<T> TryInvoke<T>(Func<T> action)
- {
- try
- {
- T value = action();
- return new CompositionResult<T>(value);
- }
- catch (CompositionException ex)
- {
- return new CompositionResult<T>(ex.Errors);
- }
- }
-
- internal static CompositionResult TryInvoke(Action action)
- {
- try
- {
- action();
- return CompositionResult.SucceededResult;
- }
- catch (CompositionException ex)
- {
- return new CompositionResult(ex.Errors);
- }
- }
-
- internal static CompositionResult TryFire<TEventArgs>(EventHandler<TEventArgs> _delegate, object sender, TEventArgs e)
- where TEventArgs : EventArgs
- {
- CompositionResult result = CompositionResult.SucceededResult;
- foreach (EventHandler<TEventArgs> _subscriber in _delegate.GetInvocationList())
- {
- try
- {
- _subscriber.Invoke(sender, e);
- }
- catch (CompositionException ex)
- {
- result = result.MergeErrors(ex.Errors);
- }
- }
-
- return result;
- }
-
- internal static CreationPolicy GetRequiredCreationPolicy(this ImportDefinition definition)
- {
- ContractBasedImportDefinition contractDefinition = definition as ContractBasedImportDefinition;
-
- if (contractDefinition != null)
- {
- return contractDefinition.RequiredCreationPolicy;
- }
-
- return CreationPolicy.Any;
- }
-
- /// <summary>
- /// Returns a value indicating whether cardinality is
- /// <see cref="ImportCardinality.ZeroOrOne"/> or
- /// <see cref="ImportCardinality.ExactlyOne"/>.
- /// </summary>
- internal static bool IsAtMostOne(this ImportCardinality cardinality)
- {
- return cardinality == ImportCardinality.ZeroOrOne || cardinality == ImportCardinality.ExactlyOne;
- }
-
- private static bool IsValidAttributeType(Type type)
- {
- return IsValidAttributeType(type, true);
- }
-
- private static bool IsValidAttributeType(Type type, bool arrayAllowed)
- {
- Assumes.NotNull(type);
- // Definitions of valid attribute type taken from C# 3.0 Specification section 17.1.3.
-
- // One of the following types: bool, byte, char, double, float, int, long, sbyte, short, string, uint, ulong, ushort.
- if (type.IsPrimitive)
- {
- return true;
- }
-
- if (type == typeof(string))
- {
- return true;
- }
-
- // An enum type, provided it has public accessibility and the types in which it is nested (if any) also have public accessibility
- if (type.IsEnum && type.IsVisible)
- {
- return true;
- }
-
- if (typeof(Type).IsAssignableFrom(type))
- {
- return true;
- }
-
- // Single-dimensional arrays of the above types.
- if (arrayAllowed && type.IsArray &&
- type.GetArrayRank() == 1 &&
- IsValidAttributeType(type.GetElementType(), false))
- {
- return true;
- }
-
- return false;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/DirectoryCatalog.DirectoryCatalogDebuggerProxy.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/DirectoryCatalog.DirectoryCatalogDebuggerProxy.cs deleted file mode 100644 index 074cf6166d8..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/DirectoryCatalog.DirectoryCatalogDebuggerProxy.cs +++ /dev/null @@ -1,71 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-#if !SILVERLIGHT
-
-using System;
-using System.Collections.ObjectModel;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.ReflectionModel;
-using System.Linq;
-using System.Reflection;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- partial class DirectoryCatalog
- {
- internal class DirectoryCatalogDebuggerProxy
- {
- private readonly DirectoryCatalog _catalog;
-
- public DirectoryCatalogDebuggerProxy(DirectoryCatalog catalog)
- {
- Requires.NotNull(catalog, "catalog");
-
- this._catalog = catalog;
- }
-
- public ReadOnlyCollection<Assembly> Assemblies
- {
- get
- {
- return this._catalog._assemblyCatalogs.Values.Select(catalog => catalog.Assembly)
- .ToReadOnlyCollection();
- }
- }
-
- public string SearchPattern
- {
- get { return this._catalog.SearchPattern; }
- }
-
- public string Path
- {
- get { return this._catalog._path; }
- }
-
- public string FullPath
- {
- get { return this._catalog._fullPath; }
- }
-
- public ReadOnlyCollection<string> LoadedFiles
- {
- get { return this._catalog._loadedFiles; }
- }
-
- public ReadOnlyCollection<ComposablePartDefinition> Parts
- {
- // NOTE: This shouldn't be cached, so that on every query of
- // the current value of the underlying catalog is respected.
- // We use ReadOnlyCollection as arrays do not have the
- // appropriate debugger display attributes applied to them.
- get { return this._catalog.Parts.ToReadOnlyCollection(); }
- }
- }
- }
-}
-
-#endif
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/DirectoryCatalog.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/DirectoryCatalog.cs deleted file mode 100644 index be49bdbfca9..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/DirectoryCatalog.cs +++ /dev/null @@ -1,542 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-#if !SILVERLIGHT
-
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.ComponentModel.Composition.Diagnostics;
-using System.ComponentModel.Composition.Primitives;
-using System.Diagnostics;
-using System.Diagnostics.CodeAnalysis;
-using System.Globalization;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-
-using IOPath = System.IO.Path;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- [DebuggerTypeProxy(typeof(DirectoryCatalogDebuggerProxy))]
- public partial class DirectoryCatalog : ComposablePartCatalog, INotifyComposablePartCatalogChanged, ICompositionElement
- {
- private readonly Lock _thisLock = new Lock();
- private ComposablePartCatalogCollection _catalogCollection;
- private Dictionary<string, AssemblyCatalog> _assemblyCatalogs;
- private volatile bool _isDisposed = false;
- private string _path;
- private string _fullPath;
- private string _searchPattern;
- private ReadOnlyCollection<string> _loadedFiles;
- private IQueryable<ComposablePartDefinition> _partsQuery;
-
- /// <summary>
- /// Creates a catalog of <see cref="ComposablePartDefinition"/>s based on all the *.dll files
- /// in the given directory path.
- ///
- /// Possible exceptions that can be thrown are any that <see cref="Directory.GetFiles(string, string)"/> or
- /// <see cref="Assembly.Load(AssemblyName)"/> can throw.
- /// </summary>
- /// <param name="path">
- /// Path to the directory to scan for assemblies to add to the catalog.
- /// The path needs to be absolute or relative to <see cref="AppDomain.BaseDirectory"/>
- /// </param>
- /// <exception cref="ArgumentException">
- /// If <paramref name="path"/> is a zero-length string, contains only white space, or
- /// contains one or more implementation-specific invalid characters.
- /// </exception>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="path"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="DirectoryNotFoundException">
- /// The specified <paramref name="path"/> is invalid (for example, it is on an unmapped drive).
- /// </exception>
- /// <exception cref="PathTooLongException">
- /// The specified <paramref name="path"/>, file name, or both exceed the system-defined maximum length.
- /// For example, on Windows-based platforms, paths must be less than 248 characters and file names must
- /// be less than 260 characters.
- /// </exception>
- /// <exception cref="UnauthorizedAccessException">
- /// The caller does not have the required permission.
- /// </exception>
- public DirectoryCatalog(string path) : this(path, "*.dll")
- {
- }
-
- /// <summary>
- /// Creates a catalog of <see cref="ComposablePartDefinition"/>s based on all the given searchPattern
- /// over the files in the given directory path.
- ///
- /// Possible exceptions that can be thrown are any that <see cref="Directory.GetFiles(string, string)"/> or
- /// <see cref="Assembly.Load(AssemblyName)"/> can throw.
- /// </summary>
- /// <param name="path">
- /// Path to the directory to scan for assemblies to add to the catalog.
- /// The path needs to be absolute or relative to <see cref="AppDomain.BaseDirectory"/>
- /// </param>
- /// <param name="searchPattern">
- /// Any valid searchPattern that <see cref="Directory.GetFiles(string, string)"/> will accept.
- /// </param>
- /// <exception cref="ArgumentException">
- /// If <paramref name="path"/> is a zero-length string, contains only white space, or
- /// contains one or more implementation-specific invalid characters. Or <paramref name="searchPattern"/>
- /// does not contain a valid pattern.
- /// </exception>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="path"/> is <see langword="null"/> or <paramref name="searchPattern"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="DirectoryNotFoundException">
- /// The specified <paramref name="path"/> is invalid (for example, it is on an unmapped drive).
- /// </exception>
- /// <exception cref="PathTooLongException">
- /// The specified <paramref name="path"/>, file name, or both exceed the system-defined maximum length.
- /// For example, on Windows-based platforms, paths must be less than 248 characters and file names must
- /// be less than 260 characters.
- /// </exception>
- /// <exception cref="UnauthorizedAccessException">
- /// The caller does not have the required permission.
- /// </exception>
- public DirectoryCatalog(string path, string searchPattern)
- {
- Requires.NotNullOrEmpty(path, "path");
- this.Initialize(path, searchPattern);
- }
-
- /// <summary>
- /// Translated absolute path of the path passed into the constructor of <see cref="DirectoryCatalog"/>.
- /// </summary>
- public string FullPath
- {
- get
- {
- return this._fullPath;
- }
- }
-
- /// <summary>
- /// Set of files that have currently been loaded into the catalog.
- /// </summary>
- public ReadOnlyCollection<string> LoadedFiles
- {
- get
- {
- using (new ReadLock(this._thisLock))
- {
- return this._loadedFiles;
- }
- }
- }
-
- /// <summary>
- /// Path passed into the constructor of <see cref="DirectoryCatalog"/>.
- /// </summary>
- public string Path
- {
- get
- {
- return this._path;
- }
- }
-
- /// <summary>
- /// Gets the part definitions of the directory catalog.
- /// </summary>
- /// <value>
- /// A <see cref="IQueryable{T}"/> of <see cref="ComposablePartDefinition"/> objects of the
- /// <see cref="DirectoryCatalog"/>.
- /// </value>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="DirectoryCatalog"/> has been disposed of.
- /// </exception>
- public override IQueryable<ComposablePartDefinition> Parts
- {
- get
- {
- this.ThrowIfDisposed();
- return this._partsQuery;
- }
- }
-
- /// <summary>
- /// SearchPattern passed into the constructor of <see cref="DirectoryCatalog"/>, or the default *.dll.
- /// </summary>
- public string SearchPattern
- {
- get
- {
- return this._searchPattern;
- }
- }
-
- /// <summary>
- /// Notify when the contents of the Catalog has changed.
- /// </summary>
- public event EventHandler<ComposablePartCatalogChangeEventArgs> Changed;
-
- /// <summary>
- /// Notify when the contents of the Catalog has changing.
- /// </summary>
- public event EventHandler<ComposablePartCatalogChangeEventArgs> Changing;
-
- /// <summary>
- /// Releases unmanaged and - optionally - managed resources
- /// </summary>
- /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
- protected override void Dispose(bool disposing)
- {
- try
- {
- if (disposing)
- {
- if (!this._isDisposed)
- {
- bool disposeLock = false;
- ComposablePartCatalogCollection catalogs = null;
-
- try
- {
- using (new WriteLock(this._thisLock))
- {
- if (!this._isDisposed)
- {
- disposeLock = true;
- catalogs = this._catalogCollection;
- this._catalogCollection = null;
- this._assemblyCatalogs = null;
- this._isDisposed = true;
- }
- }
- }
- finally
- {
- if (catalogs != null)
- {
- catalogs.Dispose();
- }
-
- if (disposeLock)
- {
- this._thisLock.Dispose();
- }
- }
- }
- }
- }
- finally
- {
- base.Dispose(disposing);
- }
- }
-
- /// <summary>
- /// Returns the export definitions that match the constraint defined by the specified definition.
- /// </summary>
- /// <param name="definition">
- /// The <see cref="ImportDefinition"/> that defines the conditions of the
- /// <see cref="ExportDefinition"/> objects to return.
- /// </param>
- /// <returns>
- /// An <see cref="IEnumerable{T}"/> of <see cref="Tuple{T1, T2}"/> containing the
- /// <see cref="ExportDefinition"/> objects and their associated
- /// <see cref="ComposablePartDefinition"/> for objects that match the constraint defined
- /// by <paramref name="definition"/>.
- /// </returns>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="definition"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="DirectoryCatalog"/> has been disposed of.
- /// </exception>
- public override IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>> GetExports(ImportDefinition definition)
- {
- this.ThrowIfDisposed();
-
- Requires.NotNull(definition, "definition");
-
- return this._catalogCollection.SelectMany(catalog => catalog.GetExports(definition));
- }
-
- /// <summary>
- /// Raises the <see cref="INotifyComposablePartCatalogChanged.Changed"/> event.
- /// </summary>
- /// <param name="e">
- /// An <see cref="ComposablePartCatalogChangeEventArgs"/> containing the data for the event.
- /// </param>
- protected virtual void OnChanged(ComposablePartCatalogChangeEventArgs e)
- {
- EventHandler<ComposablePartCatalogChangeEventArgs> changedEvent = this.Changed;
- if (changedEvent != null)
- {
- changedEvent(this, e);
- }
- }
-
- /// <summary>
- /// Raises the <see cref="INotifyComposablePartCatalogChanged.Changing"/> event.
- /// </summary>
- /// <param name="e">
- /// An <see cref="ComposablePartCatalogChangeEventArgs"/> containing the data for the event.
- /// </param>
- protected virtual void OnChanging(ComposablePartCatalogChangeEventArgs e)
- {
- EventHandler<ComposablePartCatalogChangeEventArgs> changingEvent = this.Changing;
- if (changingEvent != null)
- {
- changingEvent(this, e);
- }
- }
-
- /// <summary>
- /// Refreshes the <see cref="ComposablePartDefinition"/>s with the latest files in the directory that match
- /// the searchPattern. If any files have been added they will be added to the catalog and if any files were
- /// removed they will be removed from the catalog. For files that have been removed keep in mind that the
- /// assembly cannot be unloaded from the process so <see cref="ComposablePartDefinition"/>s for those files
- /// will simply be removed from the catalog.
- ///
- /// Possible exceptions that can be thrown are any that <see cref="Directory.GetFiles(string, string)"/> or
- /// <see cref="Assembly.Load(AssemblyName)"/> can throw.
- /// </summary>
- /// <exception cref="DirectoryNotFoundException">
- /// The specified <paramref name="path"/> has been removed since object construction.
- /// </exception>
- public void Refresh()
- {
- this.ThrowIfDisposed();
- Assumes.NotNull(this._loadedFiles);
-
- List<Tuple<string, AssemblyCatalog>> catalogsToAdd;
- List<Tuple<string, AssemblyCatalog>> catalogsToRemove;
- ComposablePartDefinition[] addedDefinitions;
- ComposablePartDefinition[] removedDefinitions;
- object changeReferenceObject;
- string[] afterFiles;
- string[] beforeFiles;
-
- while (true)
- {
- afterFiles = this.GetFiles();
-
- using (new ReadLock(this._thisLock))
- {
- changeReferenceObject = this._loadedFiles;
- beforeFiles = this._loadedFiles.ToArray();
- }
-
- this.DiffChanges(beforeFiles, afterFiles, out catalogsToAdd, out catalogsToRemove);
-
- // Don't go any further if there's no work to do
- if (catalogsToAdd.Count == 0 && catalogsToRemove.Count == 0)
- {
- return;
- }
-
- // Notify listeners to give them a preview before completeting the changes
- addedDefinitions = catalogsToAdd
- .SelectMany(cat => cat.Item2.Parts)
- .ToArray<ComposablePartDefinition>();
-
- removedDefinitions = catalogsToRemove
- .SelectMany(cat => cat.Item2.Parts)
- .ToArray<ComposablePartDefinition>();
-
- using (var atomicComposition = new AtomicComposition())
- {
- var changingArgs = new ComposablePartCatalogChangeEventArgs(addedDefinitions, removedDefinitions, atomicComposition);
- this.OnChanging(changingArgs);
-
- // if the change went through then write the catalog changes
- using (new WriteLock(this._thisLock))
- {
- if (changeReferenceObject != this._loadedFiles)
- {
- // Someone updated the list while we were diffing so we need to try the diff again
- continue;
- }
-
- foreach (var catalogToAdd in catalogsToAdd)
- {
- this._assemblyCatalogs.Add(catalogToAdd.Item1, catalogToAdd.Item2);
- this._catalogCollection.Add(catalogToAdd.Item2);
- }
-
- foreach (var catalogToRemove in catalogsToRemove)
- {
- this._assemblyCatalogs.Remove(catalogToRemove.Item1);
- this._catalogCollection.Remove(catalogToRemove.Item2);
- }
-
- this._partsQuery = this._catalogCollection.AsQueryable().SelectMany(catalog => catalog.Parts);
- this._loadedFiles = afterFiles.ToReadOnlyCollection();
-
- // Lastly complete any changes added to the atomicComposition during the change event
- atomicComposition.Complete();
-
- // Break out of the while(true)
- break;
- } // WriteLock
- } // AtomicComposition
- } // while (true)
-
- var changedArgs = new ComposablePartCatalogChangeEventArgs(addedDefinitions, removedDefinitions, null);
- this.OnChanged(changedArgs);
- }
-
- /// <summary>
- /// Returns a string representation of the directory catalog.
- /// </summary>
- /// <returns>
- /// A <see cref="String"/> containing the string representation of the <see cref="DirectoryCatalog"/>.
- /// </returns>
- public override string ToString()
- {
- return GetDisplayName();
- }
-
- private AssemblyCatalog CreateAssemblyCatalogGuarded(string assemblyFilePath)
- {
- Exception exception = null;
-
- try
- {
- return new AssemblyCatalog(assemblyFilePath, this);
- }
- catch (FileNotFoundException ex)
- { // Files should always exists but don't blow up here if they don't
- exception = ex;
- }
- catch (FileLoadException ex)
- { // File was found but could not be loaded
- exception = ex;
- }
- catch (BadImageFormatException ex)
- { // Dlls that contain native code are not loaded, but do not invalidate the Directory
- exception = ex;
- }
- catch (ReflectionTypeLoadException ex)
- { // Dlls that have missing Managed dependencies are not loaded, but do not invalidate the Directory
- exception = ex;
- }
-
- CompositionTrace.AssemblyLoadFailed(this, assemblyFilePath, exception);
-
- return null;
- }
-
- private void DiffChanges(string[] beforeFiles, string[] afterFiles,
- out List<Tuple<string, AssemblyCatalog>> catalogsToAdd,
- out List<Tuple<string, AssemblyCatalog>> catalogsToRemove)
- {
- catalogsToAdd = new List<Tuple<string, AssemblyCatalog>>();
- catalogsToRemove = new List<Tuple<string, AssemblyCatalog>>();
-
- IEnumerable<string> filesToAdd = afterFiles.Except(beforeFiles);
- foreach (string file in filesToAdd)
- {
- AssemblyCatalog catalog = CreateAssemblyCatalogGuarded(file);
-
- if (catalog != null)
- {
- catalogsToAdd.Add(new Tuple<string, AssemblyCatalog>(file, catalog));
- }
- }
-
- IEnumerable<string> filesToRemove = beforeFiles.Except(afterFiles);
- using (new ReadLock(this._thisLock))
- {
- foreach (string file in filesToRemove)
- {
- AssemblyCatalog catalog;
- if (this._assemblyCatalogs.TryGetValue(file, out catalog))
- {
- catalogsToRemove.Add(new Tuple<string, AssemblyCatalog>(file, catalog));
- }
- }
- }
- }
-
- private string GetDisplayName()
- {
- return string.Format(CultureInfo.CurrentCulture,
- "{0} (Path=\"{1}\")", // NOLOC
- this.GetType().Name,
- this._path);
- }
-
- private string[] GetFiles()
- {
- return Directory.GetFiles(this._fullPath, this._searchPattern);
- }
-
- private static string GetFullPath(string path)
- {
- if (!IOPath.IsPathRooted(path) && AppDomain.CurrentDomain.BaseDirectory != null)
- {
- path = IOPath.Combine(AppDomain.CurrentDomain.BaseDirectory, path);
- }
-
- return IOPath.GetFullPath(path);
- }
-
- private void Initialize(string path, string searchPattern)
- {
- this._path = path;
- this._fullPath = GetFullPath(path);
- this._searchPattern = searchPattern;
- this._assemblyCatalogs = new Dictionary<string, AssemblyCatalog>();
- this._catalogCollection = new ComposablePartCatalogCollection(null);
-
- this._loadedFiles = GetFiles().ToReadOnlyCollection();
-
- foreach (string file in this._loadedFiles)
- {
- AssemblyCatalog assemblyCatalog = null;
- assemblyCatalog = CreateAssemblyCatalogGuarded(file);
-
- if (assemblyCatalog != null)
- {
- this._assemblyCatalogs.Add(file, assemblyCatalog);
- this._catalogCollection.Add(assemblyCatalog);
- }
- }
- this._partsQuery = this._catalogCollection.AsQueryable().SelectMany(catalog => catalog.Parts);
- }
-
- private void ThrowIfDisposed()
- {
- if (this._isDisposed)
- {
- throw ExceptionBuilder.CreateObjectDisposed(this);
- }
- }
-
- /// <summary>
- /// Gets the display name of the directory catalog.
- /// </summary>
- /// <value>
- /// A <see cref="String"/> containing a human-readable display name of the <see cref="DirectoryCatalog"/>.
- /// </value>
- [SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
- string ICompositionElement.DisplayName
- {
- get { return this.GetDisplayName(); }
- }
-
- /// <summary>
- /// Gets the composition element from which the directory catalog originated.
- /// </summary>
- /// <value>
- /// This property always returns <see langword="null"/>.
- /// </value>
- [SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
- ICompositionElement ICompositionElement.Origin
- {
- get { return null; }
- }
- }
-}
-
-#endif
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ExportProvider.GetExportOverrides.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ExportProvider.GetExportOverrides.cs deleted file mode 100644 index 01f2175f331..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ExportProvider.GetExportOverrides.cs +++ /dev/null @@ -1,817 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-using System.Diagnostics.CodeAnalysis;
-using System.Globalization;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Collections.ObjectModel;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- public abstract partial class ExportProvider
- {
- /// <summary>
- /// Returns the export with the contract name derived from the specified type parameter,
- /// throwing an exception if there is not exactly one matching export.
- /// </summary>
- /// <typeparam name="T">
- /// The type of the <see cref="Lazy{T}"/> object to return. The contract name is also
- /// derived from this type parameter.
- /// </typeparam>
- /// <returns>
- /// The <see cref="Lazy{T}"/> object with the contract name derived from
- /// <typeparamref name="T"/>.
- /// </returns>
- /// <remarks>
- /// <para>
- /// The returned <see cref="Lazy{T}"/> object is an instance of
- /// <see cref="Lazy{T, TMetadataView}"/> underneath, where
- /// <c>TMetadataView</c>
- /// is <see cref="IDictionary{TKey, TValue}"/> and where <c>TKey</c>
- /// is <see cref="String"/> and <c>TValue</c> is <see cref="Object"/>.
- /// </para>
- /// <para>
- /// The contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- /// <exception cref="ImportCardinalityMismatchException">
- /// <para>
- /// There are zero <see cref="Lazy{T}"/> objects with the contract name derived
- /// from <typeparamref name="T"/> in the <see cref="CompositionContainer"/>.
- /// </para>
- /// -or-
- /// <para>
- /// There are more than one <see cref="Lazy{T}"/> objects with the contract name
- /// derived from <typeparamref name="T"/> in the <see cref="CompositionContainer"/>.
- /// </para>
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="CompositionContainer"/> has been disposed of.
- /// </exception>
- public Lazy<T> GetExport<T>()
- {
- return this.GetExport<T>((string)null);
- }
-
- /// <summary>
- /// Returns the export with the specified contract name, throwing an exception if there
- /// is not exactly one matching export.
- /// </summary>
- /// <typeparam name="T">
- /// The type of the <see cref="Lazy{T}"/> object to return.
- /// </typeparam>
- /// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the <see cref="Lazy{T}"/>
- /// object to return; or <see langword="null"/> or an empty string ("") to use the
- /// default contract name.
- /// </param>
- /// <returns>
- /// The <see cref="Lazy{T}"/> object with the specified contract name.
- /// </returns>
- /// <remarks>
- /// <para>
- /// The returned <see cref="Lazy{T}"/> object is an instance of
- /// <see cref="Lazy{T, TMetadataView}"/> underneath, where
- /// <c>TMetadataView</c>
- /// is <see cref="IDictionary{TKey, TValue}"/> and where <c>TKey</c>
- /// is <see cref="String"/> and <c>TValue</c> is <see cref="Object"/>.
- /// </para>
- /// <para>
- /// The contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
- /// </para>
- /// <para>
- /// The default contract name is compared using a case-sensitive, non-linguistic
- /// comparison using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- /// <exception cref="ImportCardinalityMismatchException">
- /// <para>
- /// There are zero <see cref="Lazy{T}"/> objects with the specified contract name
- /// in the <see cref="CompositionContainer"/>.
- /// </para>
- /// -or-
- /// <para>
- /// There are more than one <see cref="Lazy{T}"/> objects with the specified contract
- /// name in the <see cref="CompositionContainer"/>.
- /// </para>
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="CompositionContainer"/> has been disposed of.
- /// </exception>
- public Lazy<T> GetExport<T>(string contractName)
- {
- return this.GetExportCore<T>(contractName);
- }
-
- /// <summary>
- /// Returns the export with the contract name derived from the specified type parameter,
- /// throwing an exception if there is not exactly one matching export.
- /// </summary>
- /// <typeparam name="T">
- /// The type of the <see cref="Lazy{T, TMetadataView}"/> object to return. The
- /// contract name is also derived from this type parameter.
- /// </typeparam>
- /// <typeparam name="TMetadataView">
- /// The type of the metadata view of the <see cref="Lazy{T, TMetadataView}"/> object
- /// to return.
- /// </typeparam>
- /// <returns>
- /// The <see cref="Lazy{T, TMetadataView}"/> object with the contract name derived
- /// from <typeparamref name="T"/>.
- /// </returns>
- /// <remarks>
- /// <para>
- /// The contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- /// <exception cref="ImportCardinalityMismatchException">
- /// <para>
- /// There are zero <see cref="Lazy{T, TMetadataView}"/> objects with the contract
- /// name derived from <typeparamref name="T"/> in the
- /// <see cref="CompositionContainer"/>.
- /// </para>
- /// -or-
- /// <para>
- /// There are more than one <see cref="Lazy{T, TMetadataView}"/> objects with the
- /// contract name derived from <typeparamref name="T"/> in the
- /// <see cref="CompositionContainer"/>.
- /// </para>
- /// </exception>
- /// <exception cref="InvalidOperationException">
- /// <typeparamref name="TMetadataView"/> is not a valid metadata view type.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="CompositionContainer"/> has been disposed of.
- /// </exception>
- public Lazy<T, TMetadataView> GetExport<T, TMetadataView>()
- {
- return this.GetExport<T, TMetadataView>((string)null);
- }
-
- /// <summary>
- /// Returns the export with the specified contract name, throwing an exception if there
- /// is not exactly one matching export.
- /// </summary>
- /// <typeparam name="T">
- /// The type of the <see cref="Lazy{T, TMetadataView}"/> object to return.
- /// </typeparam>
- /// <typeparam name="TMetadataView">
- /// The type of the metadata view of the <see cref="Lazy{T, TMetadataView}"/> object
- /// to return.
- /// </typeparam>
- /// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the
- /// <see cref="Lazy{T, TMetadataView}"/> object to return; or <see langword="null"/>
- /// or an empty string ("") to use the default contract name.
- /// </param>
- /// <returns>
- /// The <see cref="Lazy{T, TMetadataView}"/> object with the specified contract name.
- /// </returns>
- /// <remarks>
- /// <para>
- /// The default contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- /// <exception cref="ImportCardinalityMismatchException">
- /// <para>
- /// There are zero <see cref="Lazy{T, TMetadataView}"/> objects with the
- /// specified contract name in the <see cref="CompositionContainer"/>.
- /// </para>
- /// -or-
- /// <para>
- /// There are more than one <see cref="Lazy{T, TMetadataView}"/> objects with the
- /// specified contract name in the <see cref="CompositionContainer"/>.
- /// </para>
- /// </exception>
- /// <exception cref="InvalidOperationException">
- /// <typeparamref name="TMetadataView"/> is not a valid metadata view type.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="CompositionContainer"/> has been disposed of.
- /// </exception>
- public Lazy<T, TMetadataView> GetExport<T, TMetadataView>(string contractName)
- {
- return this.GetExportCore<T, TMetadataView>(contractName);
- }
-
- /// <summary>
- /// Returns the exports with the specified contract name.
- /// </summary>
- /// <param name="type">
- /// The <see cref="Type"/> of the <see cref="Export"/> objects to return.
- /// </param>
- /// <param name="metadataViewType">
- /// The <see cref="Type"/> of the metadata view of the <see cref="Export"/> objects to
- /// return.
- /// </param>
- /// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the
- /// <see cref="Export"/> object to return; or <see langword="null"/>
- /// or an empty string ("") to use the default contract name.
- /// </param>
- /// <returns>
- /// An <see cref="IEnumerable{T}"/> containing the <see cref="Lazy{Object, Object}"/> objects
- /// with the specified contract name, if found; otherwise, an empty
- /// <see cref="IEnumerable{T}"/>.
- /// </returns>
- /// <remarks>
- /// <para>
- /// The returned <see cref="Export"/> objects are instances of
- /// <see cref="Lazy{T, TMetadataView}"/> underneath, where <c>T</c>
- /// is <paramref name="type"/> and <c>TMetadataView</c> is
- /// <paramref name="metadataViewType"/>.
- /// </para>
- /// <para>
- /// The default contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <paramref name="type"/>.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="type"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="InvalidOperationException">
- /// <paramref name="metadataViewType"/> is not a valid metadata view type.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="CompositionContainer"/> has been disposed of.
- /// </exception>
- [SuppressMessage("Microsoft.Design", "CA1006")]
- public IEnumerable<Lazy<object, object>> GetExports(Type type, Type metadataViewType, string contractName)
- {
- IEnumerable<Export> exports = this.GetExportsCore(type, metadataViewType, contractName, ImportCardinality.ZeroOrMore);
- Collection<Lazy<object, object>> result = new Collection<Lazy<object, object>>();
-
- Func<Export, Lazy<object, object>> typedExportFactory = ExportServices.CreateSemiStronglyTypedLazyFactory(type, metadataViewType);
- foreach (Export export in exports)
- {
- result.Add(typedExportFactory.Invoke(export));
- }
-
- return result;
- }
-
- /// <summary>
- /// Returns the exports with the contract name derived from the specified type parameter.
- /// </summary>
- /// <typeparam name="T">
- /// The type of the <see cref="Lazy{T}"/> objects to return. The contract name is also
- /// derived from this type parameter.
- /// </typeparam>
- /// <returns>
- /// An <see cref="IEnumerable{T}"/> containing the <see cref="Lazy{T}"/> objects
- /// with the contract name derived from <typeparamref name="T"/>, if found; otherwise,
- /// an empty <see cref="IEnumerable{T}"/>.
- /// </returns>
- /// <remarks>
- /// <para>
- /// The returned <see cref="Lazy{T}"/> objects are instances of
- /// <see cref="Lazy{T, TMetadataView}"/> underneath, where
- /// <c>TMetadataView</c>
- /// is <see cref="IDictionary{TKey, TValue}"/> and where <c>TKey</c>
- /// is <see cref="String"/> and <c>TValue</c> is <see cref="Object"/>.
- /// </para>
- /// <para>
- /// The contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="CompositionContainer"/> has been disposed of.
- /// </exception>
- [SuppressMessage("Microsoft.Design", "CA1006")]
- public IEnumerable<Lazy<T>> GetExports<T>()
- {
- return this.GetExports<T>((string)null);
- }
-
- /// <summary>
- /// Returns the exports with the specified contract name.
- /// </summary>
- /// <typeparam name="T">
- /// The type of the <see cref="Lazy{T}"/> objects to return.
- /// </typeparam>
- /// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the <see cref="Lazy{T}"/>
- /// objects to return; or <see langword="null"/> or an empty string ("") to use the
- /// default contract name.
- /// </param>
- /// <returns>
- /// An <see cref="IEnumerable{T}"/> containing the <see cref="Lazy{T}"/> objects
- /// with the specified contract name, if found; otherwise, an empty
- /// <see cref="IEnumerable{T}"/>.
- /// </returns>
- /// <remarks>
- /// <para>
- /// The returned <see cref="Lazy{T}"/> objects are instances of
- /// <see cref="Lazy{T, TMetadataView}"/> underneath, where
- /// <c>TMetadataView</c>
- /// is <see cref="IDictionary{TKey, TValue}"/> and where <c>TKey</c>
- /// is <see cref="String"/> and <c>TValue</c> is <see cref="Object"/>.
- /// </para>
- /// <para>
- /// The default contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="CompositionContainer"/> has been disposed of.
- /// </exception>
- [SuppressMessage("Microsoft.Design", "CA1006")]
- public IEnumerable<Lazy<T>> GetExports<T>(string contractName)
- {
- return this.GetExportsCore<T>(contractName);
- }
-
- /// <summary>
- /// Returns the exports with the contract name derived from the specified type parameter.
- /// </summary>
- /// <typeparam name="T">
- /// The type of the <see cref="Lazy{T, TMetadataView}"/> objects to return. The
- /// contract name is also derived from this type parameter.
- /// </typeparam>
- /// <typeparam name="TMetadataView">
- /// The type of the metadata view of the <see cref="Lazy{T, TMetadataView}"/> objects
- /// to return.
- /// </typeparam>
- /// <returns>
- /// An <see cref="IEnumerable{T}"/> containing the
- /// <see cref="Lazy{T, TMetadataView}"/> objects with the contract name derived from
- /// <typeparamref name="T"/>, if found; otherwise, an empty
- /// <see cref="IEnumerable{T}"/>.
- /// </returns>
- /// <remarks>
- /// <para>
- /// The contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- /// <exception cref="InvalidOperationException">
- /// <typeparamref name="TMetadataView"/> is not a valid metadata view type.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="CompositionContainer"/> has been disposed of.
- /// </exception>
- [SuppressMessage("Microsoft.Design", "CA1006")]
- public IEnumerable<Lazy<T, TMetadataView>> GetExports<T, TMetadataView>()
- {
- return this.GetExports<T, TMetadataView>((string)null);
- }
-
- /// <summary>
- /// Returns the exports with the specified contract name.
- /// </summary>
- /// <typeparam name="T">
- /// The type of the <see cref="Lazy{T, TMetadataView}"/> objects to return. The
- /// contract name is also derived from this type parameter.
- /// </typeparam>
- /// <typeparam name="TMetadataView">
- /// The type of the metadata view of the <see cref="Lazy{T, TMetadataView}"/> objects
- /// to return.
- /// </typeparam>
- /// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the
- /// <see cref="Lazy{T, TMetadataView}"/> objects to return; or <see langword="null"/>
- /// or an empty string ("") to use the default contract name.
- /// </param>
- /// <returns>
- /// An <see cref="IEnumerable{T}"/> containing the
- /// <see cref="Lazy{T, TMetadataView}"/> objects with the specified contract name if
- /// found; otherwise, an empty <see cref="IEnumerable{T}"/>.
- /// </returns>
- /// <remarks>
- /// <para>
- /// The default contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- /// <exception cref="InvalidOperationException">
- /// <typeparamref name="TMetadataView"/> is not a valid metadata view type.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="CompositionContainer"/> has been disposed of.
- /// </exception>
- [SuppressMessage("Microsoft.Design", "CA1006")]
- public IEnumerable<Lazy<T, TMetadataView>> GetExports<T, TMetadataView>(string contractName)
- {
- return this.GetExportsCore<T, TMetadataView>(contractName);
- }
-
- /// <summary>
- /// Returns the exported value with the contract name derived from the specified type
- /// parameter, throwing an exception if there is not exactly one matching exported value.
- /// </summary>
- /// <typeparam name="T">
- /// The type of the exported value to return. The contract name is also
- /// derived from this type parameter.
- /// </typeparam>
- /// <returns>
- /// The exported <see cref="Object"/> with the contract name derived from
- /// <typeparamref name="T"/>.
- /// </returns>
- /// <remarks>
- /// <para>
- /// The contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- /// <exception cref="CompositionContractMismatchException">
- /// The underlying exported value cannot be cast to <typeparamref name="T"/>.
- /// </exception>
- /// <exception cref="ImportCardinalityMismatchException">
- /// <para>
- /// There are zero exported values with the contract name derived from
- /// <typeparamref name="T"/> in the <see cref="CompositionContainer"/>.
- /// </para>
- /// -or-
- /// <para>
- /// There are more than one exported values with the contract name derived from
- /// <typeparamref name="T"/> in the <see cref="CompositionContainer"/>.
- /// </para>
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="CompositionContainer"/> has been disposed of.
- /// </exception>
- /// <exception cref="CompositionException">
- /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
- /// contain a collection of errors that occurred.
- /// </exception>
- public T GetExportedValue<T>()
- {
- return this.GetExportedValue<T>((string)null);
- }
-
- /// <summary>
- /// Returns the exported value with the specified contract name, throwing an exception
- /// if there is not exactly one matching exported value.
- /// </summary>
- /// <typeparam name="T">
- /// The type of the exported value to return.
- /// </typeparam>
- /// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the exported value to return,
- /// or <see langword="null"/> or an empty string ("") to use the default contract name.
- /// </param>
- /// <returns>
- /// The exported <see cref="Object"/> with the specified contract name.
- /// </returns>
- /// <remarks>
- /// <para>
- /// The default contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- /// <exception cref="CompositionContractMismatchException">
- /// The underlying exported value cannot be cast to <typeparamref name="T"/>.
- /// </exception>
- /// <exception cref="ImportCardinalityMismatchException">
- /// <para>
- /// There are zero exported values with the specified contract name in the
- /// <see cref="CompositionContainer"/>.
- /// </para>
- /// -or-
- /// <para>
- /// There are more than one exported values with the specified contract name in the
- /// <see cref="CompositionContainer"/>.
- /// </para>
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="CompositionContainer"/> has been disposed of.
- /// </exception>
- /// <exception cref="CompositionException">
- /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
- /// contain a collection of errors that occurred.
- /// </exception>
- public T GetExportedValue<T>(string contractName)
- {
- return this.GetExportedValueCore<T>(contractName, ImportCardinality.ExactlyOne);
- }
-
- /// <summary>
- /// Returns the exported value with the contract name derived from the specified type
- /// parameter, throwing an exception if there is more than one matching exported value.
- /// </summary>
- /// <typeparam name="T">
- /// The type of the exported value to return. The contract name is also
- /// derived from this type parameter.
- /// </typeparam>
- /// <returns>
- /// The exported <see cref="Object"/> with the contract name derived from
- /// <typeparamref name="T"/>, if found; otherwise, the default value for
- /// <typeparamref name="T"/>.
- /// </returns>
- /// <remarks>
- /// <para>
- /// If the exported value is not found, then this method returns the appropriate
- /// default value for <typeparamref name="T"/>; for example, 0 (zero) for integer
- /// types, <see langword="false"/> for Boolean types, and <see langword="null"/>
- /// for reference types.
- /// </para>
- /// <para>
- /// The contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- /// <exception cref="CompositionContractMismatchException">
- /// The underlying exported value cannot be cast to <typeparamref name="T"/>.
- /// </exception>
- /// <exception cref="ImportCardinalityMismatchException">
- /// <para>
- /// There are more than one exported values with the contract name derived from
- /// <typeparamref name="T"/> in the <see cref="CompositionContainer"/>.
- /// </para>
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="CompositionContainer"/> has been disposed of.
- /// </exception>
- /// <exception cref="CompositionException">
- /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
- /// contain a collection of errors that occurred.
- /// </exception>
- public T GetExportedValueOrDefault<T>()
- {
- return this.GetExportedValueOrDefault<T>((string)null);
- }
-
- /// <summary>
- /// Returns the exported value with the specified contract name, throwing an exception
- /// if there is more than one matching exported value.
- /// </summary>
- /// <typeparam name="T">
- /// The type of the exported value to return.
- /// </typeparam>
- /// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the exported value to return,
- /// or <see langword="null"/> or an empty string ("") to use the default contract name.
- /// </param>
- /// <returns>
- /// The exported <see cref="Object"/> with the specified contract name, if found;
- /// otherwise, the default value for <typeparamref name="T"/>.
- /// </returns>
- /// <remarks>
- /// <para>
- /// If the exported value is not found, then this method returns the appropriate
- /// default value for <typeparamref name="T"/>; for example, 0 (zero) for integer
- /// types, <see langword="false"/> for Boolean types, and <see langword="null"/>
- /// for reference types.
- /// </para>
- /// <para>
- /// The default contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- /// <exception cref="CompositionContractMismatchException">
- /// The underlying exported value cannot be cast to <typeparamref name="T"/>.
- /// </exception>
- /// <exception cref="ImportCardinalityMismatchException">
- /// There are more than one exported values with the specified contract name in the
- /// <see cref="CompositionContainer"/>.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="CompositionContainer"/> has been disposed of.
- /// </exception>
- /// <exception cref="CompositionException">
- /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
- /// contain a collection of errors that occurred.
- /// </exception>
- public T GetExportedValueOrDefault<T>(string contractName)
- {
- return this.GetExportedValueCore<T>(contractName, ImportCardinality.ZeroOrOne);
- }
-
- /// <summary>
- /// Returns the exported values with the contract name derived from the specified type
- /// parameter.
- /// </summary>
- /// <typeparam name="T">
- /// The type of the exported value to return. The contract name is also
- /// derived from this type parameter.
- /// </typeparam>
- /// <returns>
- /// An <see cref="Collection{T}"/> containing the exported values with the contract name
- /// derived from the specified type parameter, if found; otherwise, an empty
- /// <see cref="Collection{T}"/>.
- /// </returns>
- /// <remarks>
- /// <para>
- /// The contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- /// <exception cref="CompositionContractMismatchException">
- /// One or more of the underlying exported values cannot be cast to
- /// <typeparamref name="T"/>.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="CompositionContainer"/> has been disposed of.
- /// </exception>
- /// <exception cref="CompositionException">
- /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
- /// contain a collection of errors that occurred.
- /// </exception>
- public IEnumerable<T> GetExportedValues<T>()
- {
- return this.GetExportedValues<T>((string)null);
- }
-
- /// <summary>
- /// Returns the exported values with the specified contract name.
- /// </summary>
- /// <typeparam name="T">
- /// The type of the exported value to return.
- /// </typeparam>
- /// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the exported values to
- /// return; or <see langword="null"/> or an empty string ("") to use the default
- /// contract name.
- /// </param>
- /// <returns>
- /// An <see cref="Collection{T}"/> containing the exported values with the specified
- /// contract name, if found; otherwise, an empty <see cref="Collection{T}"/>.
- /// </returns>
- /// <remarks>
- /// <para>
- /// The default contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- /// <exception cref="CompositionContractMismatchException">
- /// One or more of the underlying exported values cannot be cast to
- /// <typeparamref name="T"/>.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="CompositionContainer"/> has been disposed of.
- /// </exception>
- /// <exception cref="CompositionException">
- /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
- /// contain a collection of errors that occurred.
- /// </exception>
- public IEnumerable<T> GetExportedValues<T>(string contractName)
- {
- return this.GetExportedValuesCore<T>(contractName);
- }
-
- private IEnumerable<T> GetExportedValuesCore<T>(string contractName)
- {
- IEnumerable<Export> exports = this.GetExportsCore(typeof(T), (Type)null, contractName, ImportCardinality.ZeroOrMore);
-
- Collection<T> result = new Collection<T>();
- foreach (Export export in exports)
- {
- result.Add(ExportServices.GetCastedExportedValue<T>(export));
- }
- return result;
- }
-
- private T GetExportedValueCore<T>(string contractName, ImportCardinality cardinality)
- {
- Assumes.IsTrue(cardinality.IsAtMostOne());
-
- Export export = this.GetExportsCore(typeof(T), (Type)null, contractName, cardinality).SingleOrDefault();
-
- return (export != null) ? ExportServices.GetCastedExportedValue<T>(export) : default(T);
- }
-
- private IEnumerable<Lazy<T>> GetExportsCore<T>(string contractName)
- {
- IEnumerable<Export> exports = this.GetExportsCore(typeof(T), (Type)null, contractName, ImportCardinality.ZeroOrMore);
-
- Collection<Lazy<T>> result = new Collection<Lazy<T>>();
- foreach (Export export in exports)
- {
- result.Add(ExportServices.CreateStronglyTypedLazyOfT<T>(export));
- }
- return result;
- }
-
- private IEnumerable<Lazy<T, TMetadataView>> GetExportsCore<T, TMetadataView>(string contractName)
- {
- IEnumerable<Export> exports = this.GetExportsCore(typeof(T), typeof(TMetadataView), contractName, ImportCardinality.ZeroOrMore);
-
- Collection<Lazy<T, TMetadataView>> result = new Collection<Lazy<T, TMetadataView>>();
- foreach (Export export in exports)
- {
- result.Add(ExportServices.CreateStronglyTypedLazyOfTM<T, TMetadataView>(export));
- }
- return result;
- }
-
- private Lazy<T, TMetadataView> GetExportCore<T, TMetadataView>(string contractName)
- {
- Export export = this.GetExportsCore(typeof(T), typeof(TMetadataView), contractName, ImportCardinality.ExactlyOne).SingleOrDefault();
-
- return (export != null) ? ExportServices.CreateStronglyTypedLazyOfTM<T, TMetadataView>(export) : null;
- }
-
- private Lazy<T> GetExportCore<T>(string contractName)
- {
- Export export = this.GetExportsCore(typeof(T), null, contractName, ImportCardinality.ExactlyOne).SingleOrDefault();
-
- return (export != null) ? ExportServices.CreateStronglyTypedLazyOfT<T>(export) : null;
- }
-
- private IEnumerable<Export> GetExportsCore(Type type, Type metadataViewType, string contractName, ImportCardinality cardinality)
- {
- // Only 'type' cannot be null - the other parameters have sensible defaults.
- Requires.NotNull(type, "type");
-
- if (string.IsNullOrEmpty(contractName))
- {
- contractName = AttributedModelServices.GetContractName(type);
- }
-
- if (metadataViewType == null)
- {
- metadataViewType = ExportServices.DefaultMetadataViewType;
- }
-
- if (!MetadataViewProvider.IsViewTypeValid(metadataViewType))
- {
- throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Strings.InvalidMetadataView, metadataViewType.Name));
- }
-
- ImportDefinition importDefinition = BuildImportDefinition(type, metadataViewType, contractName, cardinality);
- return this.GetExports(importDefinition, null);
- }
-
- private static ImportDefinition BuildImportDefinition(Type type, Type metadataViewType, string contractName, ImportCardinality cardinality)
- {
- Assumes.NotNull(type, metadataViewType, contractName);
-
- IEnumerable<KeyValuePair<string, Type>> requiredMetadata = CompositionServices.GetRequiredMetadata(metadataViewType);
-
- string requiredTypeIdentity = null;
- if (type != typeof(object))
- {
- requiredTypeIdentity = AttributedModelServices.GetTypeIdentity(type);
- }
-
- return new ContractBasedImportDefinition(contractName, requiredTypeIdentity, requiredMetadata, cardinality, false, true, CreationPolicy.Any);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ExportProvider.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ExportProvider.cs deleted file mode 100644 index 015996ecf24..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ExportProvider.cs +++ /dev/null @@ -1,231 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-using System.Globalization;
-using System.Linq;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- /// <summary>
- /// Defines the <see langword="abstract"/> base class for export providers, which provide
- /// methods for retrieving <see cref="Export"/> objects.
- /// </summary>
- public abstract partial class ExportProvider
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ExportProvider"/> class.
- /// </summary>
- protected ExportProvider()
- {
- }
-
- /// <summary>
- /// Occurs when the exports in the <see cref="ExportProvider"/> have changed.
- /// </summary>
- public event EventHandler<ExportsChangeEventArgs> ExportsChanged;
-
- /// <summary>
- /// Occurs when the exports in the <see cref="ExportProvider"/> are changing.
- /// </summary>
- public event EventHandler<ExportsChangeEventArgs> ExportsChanging;
-
- /// <summary>
- /// Returns all exports that match the conditions of the specified import.
- /// </summary>
- /// <param name="definition">
- /// The <see cref="ImportDefinition"/> that defines the conditions of the
- /// <see cref="Export"/> objects to get.
- /// </param>
- /// <result>
- /// An <see cref="IEnumerable{T}"/> of <see cref="Export"/> objects that match
- /// the conditions defined by <see cref="ImportDefinition"/>, if found; otherwise, an
- /// empty <see cref="IEnumerable{T}"/>.
- /// </result>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="definition"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ImportCardinalityMismatchException">
- /// <para>
- /// <see cref="ImportDefinition.Cardinality"/> is <see cref="ImportCardinality.ExactlyOne"/> and
- /// there are zero <see cref="Export"/> objects that match the conditions of the specified
- /// <see cref="ImportDefinition"/>.
- /// </para>
- /// -or-
- /// <para>
- /// <see cref="ImportDefinition.Cardinality"/> is <see cref="ImportCardinality.ZeroOrOne"/> or
- /// <see cref="ImportCardinality.ExactlyOne"/> and there are more than one <see cref="Export"/>
- /// objects that match the conditions of the specified <see cref="ImportDefinition"/>.
- /// </para>
- /// </exception>
- public IEnumerable<Export> GetExports(ImportDefinition definition)
- {
- return GetExports(definition, null);
- }
-
- /// <summary>
- /// Returns all exports that match the conditions of the specified import.
- /// </summary>
- /// <param name="definition">
- /// The <see cref="ImportDefinition"/> that defines the conditions of the
- /// <see cref="Export"/> objects to get.
- /// </param>
- /// <result>
- /// An <see cref="IEnumerable{T}"/> of <see cref="Export"/> objects that match
- /// the conditions defined by <see cref="ImportDefinition"/>, if found; otherwise, an
- /// empty <see cref="IEnumerable{T}"/>.
- /// </result>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="definition"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ImportCardinalityMismatchException">
- /// <para>
- /// <see cref="ImportDefinition.Cardinality"/> is <see cref="ImportCardinality.ExactlyOne"/> and
- /// there are zero <see cref="Export"/> objects that match the conditions of the specified
- /// <see cref="ImportDefinition"/>.
- /// </para>
- /// -or-
- /// <para>
- /// <see cref="ImportDefinition.Cardinality"/> is <see cref="ImportCardinality.ZeroOrOne"/> or
- /// <see cref="ImportCardinality.ExactlyOne"/> and there are more than one <see cref="Export"/>
- /// objects that match the conditions of the specified <see cref="ImportDefinition"/>.
- /// </para>
- /// </exception>
- public IEnumerable<Export> GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
- {
- Requires.NotNull(definition, "definition");
-
- IEnumerable<Export> exports;
- ExportCardinalityCheckResult result = this.TryGetExportsCore(definition, atomicComposition, out exports);
- switch(result)
- {
- case ExportCardinalityCheckResult.Match:
- return exports;
- case ExportCardinalityCheckResult.NoExports:
- throw new ImportCardinalityMismatchException(string.Format(CultureInfo.CurrentCulture, Strings.CardinalityMismatch_NoExports, definition.Constraint.Body.ToString()));
- default:
- Assumes.IsTrue(result == ExportCardinalityCheckResult.TooManyExports);
- throw new ImportCardinalityMismatchException(string.Format(CultureInfo.CurrentCulture, Strings.CardinalityMismatch_TooManyExports, definition.Constraint.Body.ToString()));
- }
- }
-
- /// <summary>
- /// Returns all exports that match the conditions of the specified import.
- /// </summary>
- /// <param name="definition">
- /// The <see cref="ImportDefinition"/> that defines the conditions of the
- /// <see cref="Export"/> objects to get.
- /// </param>
- /// <param name="exports">
- /// When this method returns, contains an <see cref="IEnumerable{T}"/> of <see cref="Export"/>
- /// objects that match the conditions defined by <see cref="ImportDefinition"/>, if found;
- /// otherwise, an empty <see cref="IEnumerable{T}"/>.
- /// </param>
- /// <returns>
- /// <see langword="true"/> if <see cref="ImportDefinition.Cardinality"/> is
- /// <see cref="ImportCardinality.ZeroOrOne"/> or <see cref="ImportCardinality.ZeroOrMore"/> and
- /// there are zero <see cref="Export"/> objects that match the conditions of the specified
- /// <see cref="ImportDefinition"/>. <see langword="true"/> if
- /// <see cref="ImportDefinition.Cardinality"/> is <see cref="ImportCardinality.ZeroOrOne"/> or
- /// <see cref="ImportCardinality.ExactlyOne"/> and there is exactly one <see cref="Export"/>
- /// that matches the conditions of the specified <see cref="ImportDefinition"/>; otherwise,
- /// <see langword="false"/>.
- /// </returns>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="definition"/> is <see langword="null"/>.
- /// </exception>
- public bool TryGetExports(ImportDefinition definition, AtomicComposition atomicComposition, out IEnumerable<Export> exports)
- {
- Requires.NotNull(definition, "definition");
-
- exports = null;
- ExportCardinalityCheckResult result = this.TryGetExportsCore(definition, atomicComposition, out exports);
- return (result == ExportCardinalityCheckResult.Match);
- }
-
- /// <summary>
- /// Returns all exports that match the constraint defined by the specified definition.
- /// </summary>
- /// <param name="definition">
- /// The <see cref="ImportDefinition"/> that defines the conditions of the
- /// <see cref="Export"/> objects to return.
- /// </param>
- /// <result>
- /// An <see cref="IEnumerable{T}"/> of <see cref="Export"/> objects that match
- /// the conditions defined by <see cref="ImportDefinition"/>, if found; otherwise, an
- /// empty <see cref="IEnumerable{T}"/>.
- /// </result>
- /// <remarks>
- /// <note type="inheritinfo">
- /// Overriders of this method should not treat cardinality-related mismatches
- /// as errors, and should not throw exceptions in those cases. For instance,
- /// if <see cref="ImportDefinition.Cardinality"/> is <see cref="ImportCardinality.ExactlyOne"/>
- /// and there are zero <see cref="Export"/> objects that match the conditions of the
- /// specified <see cref="ImportDefinition"/>, an <see cref="IEnumerable{T}"/> should be returned.
- /// </note>
- /// </remarks>
- protected abstract IEnumerable<Export> GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition);
-
- /// <summary>
- /// Raises the <see cref="ExportsChanged"/> event.
- /// </summary>
- /// <param name="e">
- /// An <see cref="ExportsChangeEventArgs"/> containing the data for the event.
- /// </param>
- protected virtual void OnExportsChanged(ExportsChangeEventArgs e)
- {
- EventHandler<ExportsChangeEventArgs> changedEvent = this.ExportsChanged;
- if (changedEvent != null)
- {
- CompositionResult result = CompositionServices.TryFire(changedEvent, this, e);
- result.ThrowOnErrors(e.AtomicComposition);
- }
- }
-
- /// <summary>
- /// Raises the <see cref="ExportsChanging"/> event.
- /// </summary>
- /// <param name="e">
- /// An <see cref="ExportsChangeEventArgs"/> containing the data for the event.
- /// </param>
- protected virtual void OnExportsChanging(ExportsChangeEventArgs e)
- {
- EventHandler<ExportsChangeEventArgs> changingEvent = this.ExportsChanging;
- if (changingEvent != null)
- {
- CompositionResult result = CompositionServices.TryFire(changingEvent, this, e);
- result.ThrowOnErrors(e.AtomicComposition);
- }
- }
-
- private ExportCardinalityCheckResult TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, out IEnumerable<Export> exports)
- {
- Assumes.NotNull(definition);
-
- exports = this.GetExportsCore(definition, atomicComposition);
-
- if (exports == null)
- {
- exports = Enumerable.Empty<Export>();
- }
-
- var checkResult = ExportServices.CheckCardinality(definition, exports);
-
- // Export providers treat >1 match as zero for cardinality 0-1 imports
- // If this policy is moved we need to revisit the assumption that the
- // ImportEngine made during previewing the only required imports to
- // now also preview optional imports.
- if (checkResult == ExportCardinalityCheckResult.TooManyExports &&
- definition.Cardinality == ImportCardinality.ZeroOrOne)
- {
- checkResult = ExportCardinalityCheckResult.Match;
- exports = Enumerable.Empty<Export>();
- }
-
- return checkResult;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ExportsChangeEventArgs.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ExportsChangeEventArgs.cs deleted file mode 100644 index 58f962fbf43..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ExportsChangeEventArgs.cs +++ /dev/null @@ -1,110 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- /// <summary>
- /// Provides data for the <see cref="ExportProvider.ExportsChanged"/> and
- /// <see cref="ExportProvider.ExportsChanging"/> events.
- /// </summary>
- public class ExportsChangeEventArgs : EventArgs
- {
- private IEnumerable<string> _changedContractNames = null;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ExportsChangeEventArgs"/> class with
- /// the specified changed export definitions.
- /// </summary>
- /// <param name="addedExports">
- /// An <see cref="IEnumerable{T}"/> of <see cref="ExportDefinition"/>s of the exports
- /// that have been added.
- /// </param>
- /// <param name="removedExports">
- /// An <see cref="IEnumerable{T}"/> of <see cref="ExportDefinition"/>s of the exports
- /// that have been removed.
- /// </param>
- /// <param name="atomicComposition">
- /// A <see cref="AtomicComposition"/> representing all tentative changes that will
- /// be completed if the change is successful, or discarded if it is not.
- /// <see langword="null"/> if being applied outside a <see cref="AtomicComposition"/>
- /// or during a <see cref="ExportProvider.ExportsChanged"/> event.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="addedExports"/> or <paramref name="removedExports"/> is <see langword="null"/>.
- /// </exception>
- public ExportsChangeEventArgs(IEnumerable<ExportDefinition> addedExports,
- IEnumerable<ExportDefinition> removedExports, AtomicComposition atomicComposition)
- {
- Requires.NotNull(addedExports, "addedExports");
- Requires.NotNull(removedExports, "removedExports");
-
- this.AddedExports = addedExports.AsArray();
- this.RemovedExports = removedExports.AsArray();
- this.AtomicComposition = atomicComposition;
- }
-
- /// <summary>
- /// Gets the export definitions for the exports that have been added.
- /// </summary>
- /// <value>
- /// A <see cref="IEnumerable{T}"/> of ExportDefinitions representing
- /// the exports that have been added to the <see cref="CompositionContainer"/>.
- /// </value>
- public IEnumerable<ExportDefinition> AddedExports { get; private set; }
-
- /// <summary>
- /// Gets the export definitions for the exports that have been removed.
- /// </summary>
- /// <value>
- /// A <see cref="IEnumerable{T}"/> of ExportDefinitions representing
- /// the exports that have been added to the <see cref="CompositionContainer"/>.
- /// </value>
- public IEnumerable<ExportDefinition> RemovedExports { get; private set; }
-
- /// <summary>
- /// Gets the contract names of the exports that have changed.
- /// </summary>
- /// <value>
- /// A <see cref="IEnumerable{T}"/> of strings representing the contract names of
- /// the exports that have changed in the <see cref="CompositionContainer"/>.
- /// </value>
- public IEnumerable<string> ChangedContractNames
- {
- get
- {
- if (this._changedContractNames == null)
- {
- this._changedContractNames = this.AddedExports
- .Concat(this.RemovedExports)
- .Select(export => export.ContractName)
- .Distinct()
- .ToArray();
- }
- return this._changedContractNames;
- }
- }
-
- /// <summary>
- /// Gets the atomicComposition, if any, that this change applies to.
- /// </summary>
- /// <value>
- /// A <see cref="AtomicComposition"/> that this set of changes applies too.
- ///
- /// It can be <see langword="null"/> if the changes are being applied outside a
- /// <see cref="AtomicComposition"/> or during a
- /// <see cref="ExportProvider.ExportsChanged"/> event.
- ///
- /// When the value is non-null it should be used to record temporary changed state
- /// and actions that will be executed when the atomicComposition is completeed.
- /// </value>
- public AtomicComposition AtomicComposition { get; private set; }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/INotifyComposablePartCatalogChanged.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/INotifyComposablePartCatalogChanged.cs deleted file mode 100644 index 4e5f8259631..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/INotifyComposablePartCatalogChanged.cs +++ /dev/null @@ -1,19 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- /// <summary>
- /// Notifications when a ComposablePartCatalog changes.
- /// </summary>
- public interface INotifyComposablePartCatalogChanged
- {
- event EventHandler<ComposablePartCatalogChangeEventArgs> Changed;
- event EventHandler<ComposablePartCatalogChangeEventArgs> Changing;
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ImportEngine.EngineContext.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ImportEngine.EngineContext.cs deleted file mode 100644 index 890b01952cb..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ImportEngine.EngineContext.cs +++ /dev/null @@ -1,84 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-using System.Diagnostics;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- public partial class ImportEngine
- {
- /// <summary>
- /// Used to wrap the start and stop of enforcing export changes don't
- /// break required imports. This context is stored in a AtomicComposition.
- /// </summary>
- private class EngineContext
- {
- private ImportEngine _importEngine;
- private List<PartManager> _addedPartManagers = new List<PartManager>();
- private List<PartManager> _removedPartManagers = new List<PartManager>();
- private EngineContext _parentEngineContext;
-
- public EngineContext(ImportEngine importEngine, EngineContext parentEngineContext)
- {
- this._importEngine = importEngine;
- this._parentEngineContext = parentEngineContext;
- }
-
- public void AddPartManager(PartManager part)
- {
- Assumes.NotNull(part);
- if (!this._removedPartManagers.Remove(part))
- {
- this._addedPartManagers.Add(part);
- }
- }
-
- public void RemovePartManager(PartManager part)
- {
- Assumes.NotNull(part);
- if (!this._addedPartManagers.Remove(part))
- {
- this._removedPartManagers.Add(part);
- }
- }
-
- public IEnumerable<PartManager> GetAddedPartManagers()
- {
- if (this._parentEngineContext != null)
- {
- return this._addedPartManagers.ConcatAllowingNull(this._parentEngineContext.GetAddedPartManagers());
- }
- return this._addedPartManagers;
- }
-
- public IEnumerable<PartManager> GetRemovedPartManagers()
- {
- if (this._parentEngineContext != null)
- {
- return this._removedPartManagers.ConcatAllowingNull(this._parentEngineContext.GetRemovedPartManagers());
- }
- return this._removedPartManagers;
- }
-
- public void Complete()
- {
- foreach (var partManager in this._addedPartManagers)
- {
- this._importEngine.StartSatisfyingImports(partManager, null);
- }
-
- foreach (var partManager in this._removedPartManagers)
- {
- this._importEngine.StopSatisfyingImports(partManager, null);
- }
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ImportEngine.PartManager.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ImportEngine.PartManager.cs deleted file mode 100644 index d092c670113..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ImportEngine.PartManager.cs +++ /dev/null @@ -1,211 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-using System.Diagnostics;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- public partial class ImportEngine
- {
- /// <summary>
- /// Used by the <see cref="ImportEngine"/> to manage the composition of a given part.
- /// It stores things like the list of disposable exports used to satisfy the imports as
- /// well as the caching of the exports discovered during previewing of a part.
- /// </summary>
- private class PartManager
- {
- private Dictionary<ImportDefinition, List<IDisposable>> _importedDisposableExports;
- private Dictionary<ImportDefinition, Export[]> _importCache;
- private string[] _importedContractNames;
- private ComposablePart _part;
- private ImportState _state = ImportState.NoImportsSatisfied;
- private readonly ImportEngine _importEngine;
-
- public PartManager(ImportEngine importEngine, ComposablePart part)
- {
- this._importEngine = importEngine;
- this._part = part;
- }
-
- public ComposablePart Part
- {
- get
- {
- return this._part;
- }
- }
-
- public ImportState State
- {
- get
- {
- using (this._importEngine._lock.LockStateForRead())
- {
- return this._state;
- }
- }
- set
- {
- using (this._importEngine._lock.LockStateForWrite())
- {
- this._state = value;
- }
- }
- }
-
- public bool TrackingImports { get; set; }
-
- public IEnumerable<string> GetImportedContractNames()
- {
- if (this.Part == null)
- {
- return Enumerable.Empty<string>();
- }
-
- if (this._importedContractNames == null)
- {
- this._importedContractNames = this.Part.ImportDefinitions.Select(import => import.ContractName ?? ImportDefinition.EmptyContractName).Distinct().ToArray();
- }
- return this._importedContractNames;
- }
-
- public CompositionResult TrySetImport(ImportDefinition import, IEnumerable<Export> exports)
- {
- try
- {
- this.Part.SetImport(import, exports);
- UpdateDisposableDependencies(import, exports);
- return CompositionResult.SucceededResult;
- }
- catch (CompositionException ex)
- { // Pulling on one of the exports failed
-
- return new CompositionResult(
- ErrorBuilder.CreatePartCannotSetImport(Part, import, ex));
- }
- catch (ComposablePartException ex)
- { // Type mismatch between export and import
-
- return new CompositionResult(
- ErrorBuilder.CreatePartCannotSetImport(Part, import, ex));
- }
- }
-
- public void SetSavedImport(ImportDefinition import, Export[] exports, AtomicComposition atomicComposition)
- {
- if (atomicComposition != null)
- {
- var savedExports = this.GetSavedImport(import);
-
- // Add a revert action to revert the stored exports
- // in the case that this atomicComposition gets rolled back.
- atomicComposition.AddRevertAction(() =>
- this.SetSavedImport(import, savedExports, null));
- }
-
- if (this._importCache == null)
- {
- this._importCache = new Dictionary<ImportDefinition, Export[]>();
- }
-
- this._importCache[import] = exports;
- }
-
- public Export[] GetSavedImport(ImportDefinition import)
- {
- Export[] exports = null;
- if (this._importCache != null)
- {
- // We don't care about the return value we just want the exports
- // and if it isn't present we just return the initialized null value
- this._importCache.TryGetValue(import, out exports);
- }
- return exports;
- }
-
- public void ClearSavedImports()
- {
- this._importCache = null;
- }
-
- public CompositionResult TryOnComposed()
- {
- try
- {
- this.Part.Activate();
- return CompositionResult.SucceededResult;
- }
- catch (ComposablePartException ex)
- { // Type failed to be constructed, imports could not be set, etc
- return new CompositionResult(
- ErrorBuilder.CreatePartCannotActivate(this.Part, ex));
- }
- }
-
- public void UpdateDisposableDependencies(ImportDefinition import, IEnumerable<Export> exports)
- {
- // Determine if there are any new disposable exports, optimizing for the most
- // likely case, which is that there aren't any
- List<IDisposable> disposableExports = null;
- foreach (var disposableExport in exports.OfType<IDisposable>())
- {
- if (disposableExports == null)
- {
- disposableExports = new List<IDisposable>();
- }
- disposableExports.Add(disposableExport);
- }
-
- // Dispose any existing references previously set on this import
- List<IDisposable> oldDisposableExports = null;
- if (this._importedDisposableExports != null &&
- this._importedDisposableExports.TryGetValue(import, out oldDisposableExports))
- {
- oldDisposableExports.ForEach(disposable => disposable.Dispose());
-
- // If there aren't any replacements, get rid of the old storage
- if (disposableExports == null)
- {
- this._importedDisposableExports.Remove(import);
- if (!this._importedDisposableExports.FastAny())
- {
- this._importedDisposableExports = null;
- }
-
- return;
- }
- }
-
- // Record the new collection
- if (disposableExports != null)
- {
- if (this._importedDisposableExports == null)
- {
- this._importedDisposableExports = new Dictionary<ImportDefinition, List<IDisposable>>();
- }
- this._importedDisposableExports[import] = disposableExports;
- }
- }
-
- public void DisposeAllDependencies()
- {
- if (this._importedDisposableExports != null)
- {
- IEnumerable<IDisposable> dependencies = this._importedDisposableExports.Values
- .SelectMany(exports => exports);
-
- this._importedDisposableExports = null;
-
- dependencies.ForEach(disposableExport => disposableExport.Dispose());
- }
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ImportEngine.RecompositionManager.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ImportEngine.RecompositionManager.cs deleted file mode 100644 index ff3eb19dee6..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ImportEngine.RecompositionManager.cs +++ /dev/null @@ -1,159 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-using System.Diagnostics;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- public partial class ImportEngine
- {
- /// <summary>
- /// Used by the <see cref="ImportEngine"/> to effiecently store and retrieve the list of parts
- /// that will be affected by changes to exports. This allows the <see cref="ImportEngine"/> to properly
- /// block breaking changes and also recompose imports as appropriate.
- /// </summary>
- private class RecompositionManager
- {
- private WeakReferenceCollection<PartManager> _partsToIndex = new WeakReferenceCollection<PartManager>();
- private WeakReferenceCollection<PartManager> _partsToUnindex = new WeakReferenceCollection<PartManager>();
- private Dictionary<string, WeakReferenceCollection<PartManager>> _partManagerIndex = new Dictionary<string, WeakReferenceCollection<PartManager>>();
-
- public void AddPartToIndex(PartManager partManager)
- {
- this._partsToIndex.Add(partManager);
- }
-
- public void AddPartToUnindex(PartManager partManager)
- {
- this._partsToUnindex.Add(partManager);
- }
-
- public IEnumerable<PartManager> GetAffectedParts(IEnumerable<string> changedContractNames)
- {
- this.UpdateImportIndex();
-
- List<PartManager> parts = new List<PartManager>();
-
- parts.AddRange(GetPartsImporting(ImportDefinition.EmptyContractName));
-
- foreach (string contractName in changedContractNames)
- {
- parts.AddRange(GetPartsImporting(contractName));
- }
-
- return parts;
- }
-
- public static IEnumerable<ImportDefinition> GetAffectedImports(ComposablePart part, IEnumerable<ExportDefinition> changedExports)
- {
- return part.ImportDefinitions.Where(import => IsAffectedImport(import, changedExports));
- }
-
- private static bool IsAffectedImport(ImportDefinition import, IEnumerable<ExportDefinition> changedExports)
- {
- // This could be more efficient still if the export definitions were indexed by contract name,
- // only worth revisiting if we need to squeeze more performance out of recomposition
- foreach (var export in changedExports)
- {
- if (import.IsConstraintSatisfiedBy(export))
- {
- return true;
- }
- }
-
- return false;
- }
-
- public IEnumerable<PartManager> GetPartsImporting(string contractName)
- {
- WeakReferenceCollection<PartManager> partManagerList;
- if (!this._partManagerIndex.TryGetValue(contractName, out partManagerList))
- {
- return Enumerable.Empty<PartManager>();
- }
-
- return partManagerList.AliveItemsToList();
- }
-
- private void AddIndexEntries(PartManager partManager)
- {
- foreach (string contractName in partManager.GetImportedContractNames())
- {
- WeakReferenceCollection<PartManager> indexEntries;
- if (!this._partManagerIndex.TryGetValue(contractName, out indexEntries))
- {
- indexEntries = new WeakReferenceCollection<PartManager>();
- this._partManagerIndex.Add(contractName, indexEntries);
- }
-
- if (!indexEntries.Contains(partManager))
- {
- indexEntries.Add(partManager);
- }
- }
- }
-
- private void RemoveIndexEntries(PartManager partManager)
- {
- foreach (string contractName in partManager.GetImportedContractNames())
- {
- WeakReferenceCollection<PartManager> indexEntries;
- if (this._partManagerIndex.TryGetValue(contractName, out indexEntries))
- {
- indexEntries.Remove(partManager);
- var aliveItems = indexEntries.AliveItemsToList();
-
- if (aliveItems.Count == 0)
- {
- this._partManagerIndex.Remove(contractName);
- }
- }
- }
- }
-
- private void UpdateImportIndex()
- {
- var partsToIndex = this._partsToIndex.AliveItemsToList();
- this._partsToIndex.Clear();
-
- var partsToUnindex = this._partsToUnindex.AliveItemsToList();
- this._partsToUnindex.Clear();
-
- if (partsToIndex.Count == 0 && partsToUnindex.Count == 0)
- {
- return;
- }
-
- foreach (var partManager in partsToIndex)
- {
- var index = partsToUnindex.IndexOf(partManager);
-
- // If the same part is being added and removed we can ignore both
- if (index >= 0)
- {
- partsToUnindex[index] = null;
- }
- else
- {
- AddIndexEntries(partManager);
- }
- }
-
- foreach (var partManager in partsToUnindex)
- {
- if (partManager != null)
- {
- RemoveIndexEntries(partManager);
- }
- }
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ImportEngine.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ImportEngine.cs deleted file mode 100644 index 29bd329c3ca..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/ImportEngine.cs +++ /dev/null @@ -1,754 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-using System.Diagnostics;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- // This class guarantees thread-safety under the follwoing conditions:
- // - Each composition is executed on a single thread
- // - No recomposition ever takes place
- // - The class is created with isThreadSafe=true
- public partial class ImportEngine : ICompositionService, IDisposable
- {
- private const int MaximumNumberOfCompositionIterations = 100;
-
- private volatile bool _isDisposed;
- private ExportProvider _sourceProvider;
- private Stack<PartManager> _recursionStateStack = new Stack<PartManager>();
- private ConditionalWeakTable<ComposablePart, PartManager> _partManagers = new ConditionalWeakTable<ComposablePart, PartManager>();
- private RecompositionManager _recompositionManager = new RecompositionManager();
- private readonly CompositionLock _lock = null;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ImportEngine"/> class.
- /// </summary>
- /// <param name="sourceProvider">
- /// The <see cref="ExportProvider"/> which provides the
- /// <see cref="ImportEngine"/> access to <see cref="Export"/>s.
- /// </param>
- public ImportEngine(ExportProvider sourceProvider)
- : this(sourceProvider, false)
- {
- }
-
- public ImportEngine(ExportProvider sourceProvider, bool isThreadSafe)
- {
- Requires.NotNull(sourceProvider, "sourceProvider");
-
- this._sourceProvider = sourceProvider;
- this._sourceProvider.ExportsChanging += this.OnExportsChanging;
- this._lock = new CompositionLock(isThreadSafe);
- }
-
- /// <summary>
- /// Previews all the required imports for the given <see cref="ComposablePart"/> to
- /// ensure they can all be satisified. The preview does not actually set the imports
- /// only ensures that they exist in the source provider. If the preview succeeds then
- /// the <see cref="ImportEngine"/> also enforces that changes to exports in the source
- /// provider will not break any of the required imports. If this enforcement needs to be
- /// lifted for this part then <see cref="ReleaseImports"/> needs to be called for this
- /// <see cref="ComposablePart"/>.
- /// </summary>
- /// <param name="part">
- /// The <see cref="ComposablePart"/> to preview the required imports.
- /// </param>
- /// <param name="atomicComposition"></param>
- /// <exception cref="CompositionException">
- /// An error occurred during previewing and <paramref name="atomicComposition"/> is null.
- /// <see cref="CompositionException.Errors"/> will contain a collection of errors that occurred.
- /// The pre-existing composition is in an unknown state, depending on the errors that occured.
- /// </exception>
- /// <exception cref="ChangeRejectedException">
- /// An error occurred during the previewing and <paramref name="atomicComposition"/> is not null.
- /// <see cref="CompositionException.Errors"/> will contain a collection of errors that occurred.
- /// The pre-existing composition remains in valid state.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="ImportEngine"/> has been disposed of.
- /// </exception>
- public void PreviewImports(ComposablePart part, AtomicComposition atomicComposition)
- {
- this.ThrowIfDisposed();
-
- Requires.NotNull(part, "part");
-
- // NOTE : this is a very intricate area threading-wise, please use caution when changing, otherwise state corruption or deadlocks will ensue
- // The gist of what we are doing is as follows:
- // We need to lock the composition, as we will proceed modifying our internal state. The tricky part is when we release the lock
- // Due to the fact that some actions will take place AFTER we leave this method, we need to KEEP THAT LOCK HELD until the transation is commiited or rolled back
- // This is the reason we CAN'T use "using here.
- // Instead, if the transaction is present we will queue up the release of the lock, otherwise we will release it when we exit this method
- // We add the "release" lock to BOTH Commit and Revert queues, because they are mutually exclusive, and we need to release the lock regardless.
-
- // This will take the lock, if necesary
- IDisposable compositionLockHolder = this._lock.IsThreadSafe ? this._lock.LockComposition() : null;
- bool compositionLockTaken = (compositionLockHolder != null);
- try
- {
- // revert actions are processed in the reverse order, so we have to add the "release lock" action now
- if (compositionLockTaken && (atomicComposition != null))
- {
- atomicComposition.AddRevertAction(() => compositionLockHolder.Dispose());
- }
-
- var partManager = GetPartManager(part, true);
- var result = TryPreviewImportsStateMachine(partManager, part, atomicComposition);
- result.ThrowOnErrors(atomicComposition);
-
- StartSatisfyingImports(partManager, atomicComposition);
-
- // Add the "release lock" to the commit actions
- if (compositionLockTaken && (atomicComposition != null))
- {
- atomicComposition.AddCompleteAction(() => compositionLockHolder.Dispose());
- }
- }
- finally
- {
- // We haven't updated the queues, so we can release the lock now
- if (compositionLockTaken && (atomicComposition == null))
- {
- compositionLockHolder.Dispose();
- }
- }
- }
-
- /// <summary>
- /// Satisfies the imports of the specified composable part. If the satisfy succeeds then
- /// the <see cref="ImportEngine"/> also enforces that changes to exports in the source
- /// provider will not break any of the required imports. If this enforcement needs to be
- /// lifted for this part then <see cref="ReleaseImports"/> needs to be called for this
- /// <see cref="ComposablePart"/>.
- /// </summary>
- /// <param name="part">
- /// The <see cref="ComposablePart"/> to set the imports.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="part"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="CompositionException">
- /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
- /// contain a collection of errors that occurred.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="ImportEngine"/> has been disposed of.
- /// </exception>
- public void SatisfyImports(ComposablePart part)
- {
- this.ThrowIfDisposed();
-
- Requires.NotNull(part, "part");
-
- // NOTE : the following two calls use the state lock
- PartManager partManager = this.GetPartManager(part, true);
- if (partManager.State == ImportState.Composed)
- {
- return;
- }
-
- using (this._lock.LockComposition())
- {
- var result = TrySatisfyImports(partManager, part, true);
- result.ThrowOnErrors(); // throw CompositionException not ChangeRejectedException
- }
- }
-
- /// <summary>
- /// Sets the imports of the specified composable part exactly once and they will not
- /// ever be recomposed.
- /// </summary>
- /// <param name="part">
- /// The <see cref="ComposablePart"/> to set the imports.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="part"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="CompositionException">
- /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
- /// contain a collection of errors that occurred.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="ICompositionService"/> has been disposed of.
- /// </exception>
- public void SatisfyImportsOnce(ComposablePart part)
- {
- this.ThrowIfDisposed();
-
- Requires.NotNull(part, "part");
-
- // NOTE : the following two calls use the state lock
- PartManager partManager = this.GetPartManager(part, true);
- if (partManager.State == ImportState.Composed)
- {
- return;
- }
-
- using (this._lock.LockComposition())
- {
- var result = TrySatisfyImports(partManager, part, false);
- result.ThrowOnErrors(); // throw CompositionException not ChangeRejectedException
- }
- }
-
- /// <summary>
- /// Removes any state stored in the <see cref="ImportEngine"/> for the associated
- /// <see cref="ComposablePart"/> and releases all the <see cref="Export"/>s used to
- /// satisfy the imports on the <see cref="ComposablePart"/>.
- ///
- /// Also removes the enforcement for changes that would break a required import on
- /// <paramref name="part"/>.
- /// </summary>
- /// <param name="part">
- /// The <see cref="ComposablePart"/> to release the imports on.
- /// </param>
- /// <param name="atomicComposition">
- /// The <see cref="AtomicComposition"/> that the release imports is running under.
- /// </param>
- public void ReleaseImports(ComposablePart part, AtomicComposition atomicComposition)
- {
- this.ThrowIfDisposed();
-
- Requires.NotNull(part, "part");
-
- using (this._lock.LockComposition())
- {
- PartManager partManager = this.GetPartManager(part, false);
- if (partManager != null)
- {
- this.StopSatisfyingImports(partManager, atomicComposition);
- }
- }
- }
-
- /// <summary>
- /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- /// </summary>
- public void Dispose()
- {
- this.Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- /// <summary>
- /// Releases unmanaged and - optionally - managed resources
- /// </summary>
- /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
- protected virtual void Dispose(bool disposing)
- {
- if (disposing)
- {
- if (!this._isDisposed)
- {
- bool disposeLock = false;
- ExportProvider sourceProviderToUnsubscribeFrom = null;
- using (this._lock.LockStateForWrite())
- {
- if (!this._isDisposed)
- {
- sourceProviderToUnsubscribeFrom = this._sourceProvider;
- this._sourceProvider = null;
- this._recompositionManager = null;
- this._partManagers = null;
- this._isDisposed = true;
- disposeLock = true;
- }
- }
-
- if (sourceProviderToUnsubscribeFrom != null)
- {
- sourceProviderToUnsubscribeFrom.ExportsChanging -= this.OnExportsChanging;
- }
-
- if (disposeLock)
- {
- this._lock.Dispose();
- }
- }
- }
- }
-
- private CompositionResult TryPreviewImportsStateMachine(PartManager partManager,
- ComposablePart part, AtomicComposition atomicComposition)
- {
- var result = CompositionResult.SucceededResult;
-
- if (partManager.State == ImportState.ImportsPreviewing)
- {
- // We shouldn't nomally ever hit this case but if we do
- // then we should just error with a cycle error.
- return new CompositionResult(ErrorBuilder.CreatePartCycle(part));
- }
-
- // Transition from NoImportsStatisified to ImportsPreviewed
- if (partManager.State == ImportState.NoImportsSatisfied)
- {
- partManager.State = ImportState.ImportsPreviewing;
-
- var requiredImports = part.ImportDefinitions.Where(IsRequiredImportForPreview);
-
- // If this atomicComposition gets rolledback for any reason we need to reset our state
- atomicComposition.AddRevertActionAllowNull(() => partManager.State = ImportState.NoImportsSatisfied);
-
- result = result.MergeResult(
- this.TrySatisfyImportSubset(partManager, requiredImports, atomicComposition));
-
- if (!result.Succeeded)
- {
- partManager.State = ImportState.NoImportsSatisfied;
- return result;
- }
-
- partManager.State = ImportState.ImportsPreviewed;
- }
-
- return result;
- }
-
- private CompositionResult TrySatisfyImportsStateMachine(PartManager partManager, ComposablePart part)
- {
- var result = CompositionResult.SucceededResult;
-
- while (partManager.State < ImportState.Composed)
- {
- var previousState = partManager.State;
-
- switch (partManager.State)
- {
- // "ed" states which represent a some sort of steady state and will
- // attempt to do a state transition
- case ImportState.NoImportsSatisfied:
- case ImportState.ImportsPreviewed:
- {
- partManager.State = ImportState.PreExportImportsSatisfying;
-
- var prereqImports = part.ImportDefinitions.Where(import => import.IsPrerequisite);
- result = result.MergeResult(
- this.TrySatisfyImportSubset(partManager, prereqImports, null));
-
- partManager.State = ImportState.PreExportImportsSatisfied;
- break;
- }
- case ImportState.PreExportImportsSatisfied:
- {
- partManager.State = ImportState.PostExportImportsSatisfying;
-
- var requiredImports = part.ImportDefinitions.Where(import => !import.IsPrerequisite);
-
- result = result.MergeResult(
- this.TrySatisfyImportSubset(partManager, requiredImports, null));
-
- partManager.State = ImportState.PostExportImportsSatisfied;
- break;
- }
- case ImportState.PostExportImportsSatisfied:
- {
- partManager.State = ImportState.ComposedNotifying;
-
- partManager.ClearSavedImports();
- result = result.MergeResult(partManager.TryOnComposed());
-
- partManager.State = ImportState.Composed;
- break;
- }
-
-
- // "ing" states which represent some sort of cycle
- // These state should always return, error or not, instead of breaking
- case ImportState.ImportsPreviewing:
- {
- // We shouldn't nomally ever hit this case but if we do
- // then we should just error with a cycle error.
- return new CompositionResult(ErrorBuilder.CreatePartCycle(part));
- }
- case ImportState.PreExportImportsSatisfying:
- case ImportState.PostExportImportsSatisfying:
- {
- if (InPrerequisiteLoop())
- {
- return result.MergeError(ErrorBuilder.CreatePartCycle(part));
- }
- // Cycles in post export imports are allowed so just return in that case
- return result;
- }
- case ImportState.ComposedNotifying:
- {
- // We are currently notifying so don't notify again just return
- return result;
- }
- }
-
- // if an error occured while doing a state transition
- if (!result.Succeeded)
- {
- // revert to the previous state and return the error
- partManager.State = previousState;
- return result;
- }
- }
- return result;
- }
-
- private CompositionResult TrySatisfyImports(PartManager partManager, ComposablePart part, bool shouldTrackImports)
- {
- Assumes.NotNull(part);
-
- var result = CompositionResult.SucceededResult;
-
- // get out if the part is already composed
- if (partManager.State == ImportState.Composed)
- {
- return result;
- }
-
- // Track number of recursive iterations and throw an exception before the stack
- // fills up and debugging the root cause becomes tricky
- if (this._recursionStateStack.Count >= MaximumNumberOfCompositionIterations)
- {
- return result.MergeError(
- ErrorBuilder.ComposeTookTooManyIterations(MaximumNumberOfCompositionIterations));
- }
-
- // Maintain the stack to detect whether recursive loops cross prerequisites
- this._recursionStateStack.Push(partManager);
- try
- {
- result = result.MergeResult(
- TrySatisfyImportsStateMachine(partManager, part));
- }
- finally
- {
- this._recursionStateStack.Pop();
- }
-
- if (shouldTrackImports)
- {
- StartSatisfyingImports(partManager, null);
- }
-
- return result;
- }
-
- private CompositionResult TrySatisfyImportSubset(PartManager partManager,
- IEnumerable<ImportDefinition> imports, AtomicComposition atomicComposition)
- {
- CompositionResult result = CompositionResult.SucceededResult;
-
- var part = partManager.Part;
- foreach (ImportDefinition import in imports)
- {
- var exports = partManager.GetSavedImport(import);
-
- if (exports == null)
- {
- CompositionResult<IEnumerable<Export>> exportsResult = TryGetExports(
- this._sourceProvider, part, import, atomicComposition);
-
- if (!exportsResult.Succeeded)
- {
- result = result.MergeResult(exportsResult.ToResult());
- continue;
- }
- exports = exportsResult.Value.AsArray();
- }
-
- if (atomicComposition == null)
- {
- result = result.MergeResult(
- partManager.TrySetImport(import, exports));
- }
- else
- {
- partManager.SetSavedImport(import, exports, atomicComposition);
- }
- }
- return result;
- }
-
- private void OnExportsChanging(object sender, ExportsChangeEventArgs e)
- {
- CompositionResult result = CompositionResult.SucceededResult;
-
- // Prepare for the recomposition effort by minimizing the amount of work we'll have to do later
- AtomicComposition atomicComposition = e.AtomicComposition;
-
- IEnumerable<PartManager> affectedParts = this._recompositionManager.GetAffectedParts(e.ChangedContractNames);
-
- // When in a atomicComposition account for everything that isn't yet reflected in the
- // index
- if (atomicComposition != null)
- {
- EngineContext engineContext;
- if (atomicComposition.TryGetValue(this, out engineContext))
- {
- // always added the new part managers to see if they will also be
- // affected by these changes
- affectedParts = affectedParts.ConcatAllowingNull(engineContext.GetAddedPartManagers())
- .Except(engineContext.GetRemovedPartManagers());
- }
- }
-
- var changedExports = e.AddedExports.ConcatAllowingNull(e.RemovedExports);
-
- foreach (var partManager in affectedParts)
- {
- result = result.MergeResult(this.TryRecomposeImports(partManager, changedExports, atomicComposition));
- }
-
- result.ThrowOnErrors(atomicComposition);
- }
-
- private CompositionResult TryRecomposeImports(PartManager partManager,
- IEnumerable<ExportDefinition> changedExports, AtomicComposition atomicComposition)
- {
- var result = CompositionResult.SucceededResult;
-
- switch (partManager.State)
- {
- case ImportState.ImportsPreviewed:
- case ImportState.Composed:
- // Validate states to continue.
- break;
-
- default:
- {
- // All other states are invalid and for recomposition.
- return new CompositionResult(ErrorBuilder.InvalidStateForRecompposition(partManager.Part));
- }
- }
-
- var affectedImports = RecompositionManager.GetAffectedImports(partManager.Part, changedExports);
- bool partComposed = (partManager.State == ImportState.Composed);
-
- bool recomposedImport = false;
- foreach (var import in affectedImports)
- {
- result = result.MergeResult(
- TryRecomposeImport(partManager, partComposed, import, atomicComposition));
-
- recomposedImport = true;
- }
-
- // Knowing that the part has already been composed before and that the only possible
- // changes are to recomposable imports, we can safely go ahead and do this now or
- // schedule it for later
- if (result.Succeeded && recomposedImport && partComposed)
- {
- if (atomicComposition == null)
- {
- result = result.MergeResult(partManager.TryOnComposed());
- }
- else
- {
- atomicComposition.AddCompleteAction(() => partManager.TryOnComposed().ThrowOnErrors());
- }
- }
-
- return result;
- }
-
- private CompositionResult TryRecomposeImport(PartManager partManager, bool partComposed,
- ImportDefinition import, AtomicComposition atomicComposition)
- {
- if (partComposed && !import.IsRecomposable)
- {
- return new CompositionResult(ErrorBuilder.PreventedByExistingImport(partManager.Part, import));
- }
-
- // During recomposition you must always requery with the new atomicComposition you cannot use any
- // cached value in the part manager
- var exportsResult = TryGetExports(this._sourceProvider, partManager.Part, import, atomicComposition);
- if (!exportsResult.Succeeded)
- {
- return exportsResult.ToResult();
- }
- var exports = exportsResult.Value.AsArray();
-
- if (partComposed)
- {
- // Knowing that the part has already been composed before and that the only possible
- // changes are to recomposable imports, we can safely go ahead and do this now or
- // schedule it for later
- if (atomicComposition == null)
- {
- return partManager.TrySetImport(import, exports);
- }
- else
- {
- atomicComposition.AddCompleteAction(() => partManager.TrySetImport(import, exports).ThrowOnErrors());
- }
- }
- else
- {
- partManager.SetSavedImport(import, exports, atomicComposition);
- }
-
- return CompositionResult.SucceededResult;
- }
-
- private void StartSatisfyingImports(PartManager partManager, AtomicComposition atomicComposition)
- {
- // When not running in a atomicCompositional state, schedule reindexing after ensuring
- // that this isn't a redundant addition
- if (atomicComposition == null)
- {
- if (!partManager.TrackingImports)
- {
- partManager.TrackingImports = true;
- this._recompositionManager.AddPartToIndex(partManager);
- }
- }
- else
- {
- // While in a atomicCompositional state use a less efficient but effective means
- // of achieving the same results
- GetEngineContext(atomicComposition).AddPartManager(partManager);
- }
- }
-
- private void StopSatisfyingImports(PartManager partManager, AtomicComposition atomicComposition)
- {
- // When not running in a atomicCompositional state, schedule reindexing after ensuring
- // that this isn't a redundant removal
- if (atomicComposition == null)
- {
- this._partManagers.Remove(partManager.Part);
-
- // Take care of lifetime requirements
- partManager.DisposeAllDependencies();
-
- if (partManager.TrackingImports)
- {
- partManager.TrackingImports = false;
- this._recompositionManager.AddPartToUnindex(partManager);
- }
- }
- else
- {
- // While in a atomicCompositional state use a less efficient but effective means
- // of achieving the same results
- GetEngineContext(atomicComposition).RemovePartManager(partManager);
- }
- }
-
- private PartManager GetPartManager(ComposablePart part, bool createIfNotpresent)
- {
- PartManager partManager = null;
- using (this._lock.LockStateForRead())
- {
- if (this._partManagers.TryGetValue(part, out partManager))
- {
- return partManager;
- }
- }
-
- if (createIfNotpresent)
- {
- using (this._lock.LockStateForWrite())
- {
- if (!this._partManagers.TryGetValue(part, out partManager))
- {
- partManager = new PartManager(this, part);
- this._partManagers.Add(part, partManager);
- }
- }
- }
- return partManager;
- }
-
-
- private EngineContext GetEngineContext(AtomicComposition atomicComposition)
- {
- Assumes.NotNull(atomicComposition);
-
- EngineContext engineContext;
- if (!atomicComposition.TryGetValue(this, true, out engineContext))
- {
- EngineContext parentContext;
- atomicComposition.TryGetValue(this, false, out parentContext);
- engineContext = new EngineContext(this, parentContext);
- atomicComposition.SetValue(this, engineContext);
- atomicComposition.AddCompleteAction(engineContext.Complete);
- }
- return engineContext;
- }
-
- private bool InPrerequisiteLoop()
- {
- PartManager firstPart = this._recursionStateStack.First();
- PartManager lastPart = null;
-
- foreach (PartManager testPart in this._recursionStateStack.Skip(1))
- {
- if (testPart.State == ImportState.PreExportImportsSatisfying)
- {
- return true;
- }
-
- if (testPart == firstPart)
- {
- lastPart = testPart;
- break;
- }
- }
-
- // This should only be called when a loop has been detected - so it should always be on the stack
- Assumes.IsTrue(lastPart == firstPart);
- return false;
- }
-
- [DebuggerStepThrough]
- private void ThrowIfDisposed()
- {
- if (this._isDisposed)
- {
- throw ExceptionBuilder.CreateObjectDisposed(this);
- }
- }
-
- private static CompositionResult<IEnumerable<Export>> TryGetExports(ExportProvider provider,
- ComposablePart part, ImportDefinition definition, AtomicComposition atomicComposition)
- {
- try
- {
- var exports = provider.GetExports(definition, atomicComposition).AsArray();
- return new CompositionResult<IEnumerable<Export>>(exports);
- }
- catch (ImportCardinalityMismatchException ex)
- {
- // Either not enough or too many exports that match the definition
- CompositionException exception = new CompositionException(ErrorBuilder.CreateImportCardinalityMismatch(ex, definition));
-
- return new CompositionResult<IEnumerable<Export>>(
- ErrorBuilder.CreatePartCannotSetImport(part, definition, exception));
- }
- }
-
- internal static bool IsRequiredImportForPreview(ImportDefinition import)
- {
- return import.Cardinality == ImportCardinality.ExactlyOne;
- }
-
- // Ordering of this enum is important so be sure to use caution if you
- // try to reorder them.
- private enum ImportState
- {
- NoImportsSatisfied = 0,
- ImportsPreviewing = 1,
- ImportsPreviewed = 2,
- PreExportImportsSatisfying = 3,
- PreExportImportsSatisfied = 4,
- PostExportImportsSatisfying = 5,
- PostExportImportsSatisfied = 6,
- ComposedNotifying = 7,
- Composed = 8,
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/TypeCatalog.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/TypeCatalog.cs deleted file mode 100644 index cabc1e5dc5c..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Hosting/TypeCatalog.cs +++ /dev/null @@ -1,347 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.AttributedModel;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.ReflectionModel;
-using System.Diagnostics;
-using System.Diagnostics.CodeAnalysis;
-using System.Globalization;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- /// <summary>
- /// An immutable ComposablePartCatalog created from a type array or a list of managed types. This class is threadsafe.
- /// It is Disposable.
- /// </summary>
- [DebuggerTypeProxy(typeof(ComposablePartCatalogDebuggerProxy))]
- public class TypeCatalog : ComposablePartCatalog, ICompositionElement
- {
- private readonly object _thisLock = new object();
- private Type[] _types = null;
- private volatile IQueryable<ComposablePartDefinition> _queryableParts;
- private volatile bool _isDisposed = false;
- private readonly ICompositionElement _definitionOrigin;
- private readonly Lazy<IDictionary<string, List<ComposablePartDefinition>>> _contractPartIndex;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="TypeCatalog"/> class
- /// with the specified types.
- /// </summary>
- /// <param name="types">
- /// An <see cref="Array"/> of attributed <see cref="Type"/> objects to add to the
- /// <see cref="TypeCatalog"/>.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="types"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ArgumentException">
- /// <paramref name="types"/> contains an element that is <see langword="null"/>.
- /// <para>
- /// -or-
- /// </para>
- /// <paramref name="types"/> contains an element that was loaded in the Reflection-only context.
- /// </exception>
- public TypeCatalog(params Type[] types)
- : this(types, (ICompositionElement)null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="TypeCatalog"/> class
- /// with the specified types.
- /// </summary>
- /// <param name="types">
- /// An <see cref="IEnumerable{T}"/> of attributed <see cref="Type"/> objects to add
- /// to the <see cref="TypeCatalog"/>.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="types"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ArgumentException">
- /// <paramref name="types"/> contains an element that is <see langword="null"/>.
- /// <para>
- /// -or-
- /// </para>
- /// <paramref name="types"/> contains an element that was loaded in the reflection-only context.
- /// </exception>
- public TypeCatalog(IEnumerable<Type> types)
- : this(types, (ICompositionElement)null)
- {
- }
-
- internal TypeCatalog(IEnumerable<Type> types, ICompositionElement definitionOrigin)
- {
- Requires.NotNull(types, "types");
-
- foreach (Type type in types)
- {
- if (type == null)
- {
- throw ExceptionBuilder.CreateContainsNullElement("types");
- }
-#if !SILVERLIGHT
- if (type.Assembly.ReflectionOnly)
- {
- throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Strings.Argument_ElementReflectionOnlyType, "types"), "types");
- }
-#endif
- }
-
- this._types = types.ToArray();
- this._definitionOrigin = definitionOrigin ?? this;
-#if !SILVERLIGHT
- this._contractPartIndex = new Lazy<IDictionary<string, List<ComposablePartDefinition>>>(this.CreateIndex, true);
-#else
- this._contractPartIndex = new Lazy<IDictionary<string, List<ComposablePartDefinition>>>(this.CreateIndex);
-#endif
-
- }
-
- /// <summary>
- /// Gets the part definitions of the catalog.
- /// </summary>
- /// <value>
- /// A <see cref="IQueryable{T}"/> of <see cref="ComposablePartDefinition"/> objects of the
- /// <see cref="TypeCatalog"/>.
- /// </value>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="TypeCatalog"/> has been disposed of.
- /// </exception>
- public override IQueryable<ComposablePartDefinition> Parts
- {
- get
- {
- this.ThrowIfDisposed();
-
- return this.PartsInternal;
- }
- }
-
- /// <summary>
- /// Gets the display name of the type catalog.
- /// </summary>
- /// <value>
- /// A <see cref="String"/> containing a human-readable display name of the <see cref="TypeCatalog"/>.
- /// </value>
- [SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
- string ICompositionElement.DisplayName
- {
- get { return this.GetDisplayName(); }
- }
-
- /// <summary>
- /// Gets the composition element from which the type catalog originated.
- /// </summary>
- /// <value>
- /// This property always returns <see langword="null"/>.
- /// </value>
- [SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
- ICompositionElement ICompositionElement.Origin
- {
- get { return null; }
- }
-
- private IQueryable<ComposablePartDefinition> PartsInternal
- {
- get
- {
- if (this._queryableParts == null)
- {
- lock (this._thisLock)
- {
- if (this._queryableParts == null)
- {
- Assumes.NotNull(this._types);
-
- var collection = new List<ComposablePartDefinition>();
- foreach (Type type in this._types)
- {
- var definition = AttributedModelDiscovery.CreatePartDefinitionIfDiscoverable(type, _definitionOrigin);
- if (definition != null)
- {
- collection.Add(definition);
- }
- }
- IQueryable<ComposablePartDefinition> queryableParts = collection.AsQueryable();
- Thread.MemoryBarrier();
-
- this._types = null;
- this._queryableParts = queryableParts;
- }
- }
- }
-
- return this._queryableParts;
- }
- }
-
- /// <summary>
- /// Returns the export definitions that match the constraint defined by the specified definition.
- /// </summary>
- /// <param name="definition">
- /// The <see cref="ImportDefinition"/> that defines the conditions of the
- /// <see cref="ExportDefinition"/> objects to return.
- /// </param>
- /// <returns>
- /// An <see cref="IEnumerable{T}"/> of <see cref="Tuple{T1, T2}"/> containing the
- /// <see cref="ExportDefinition"/> objects and their associated
- /// <see cref="ComposablePartDefinition"/> for objects that match the constraint defined
- /// by <paramref name="definition"/>.
- /// </returns>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="definition"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="ComposablePartCatalog"/> has been disposed of.
- /// </exception>
- /// <remarks>
- /// <note type="inheritinfo">
- /// Overriders of this property should never return <see langword="null"/>, if no
- /// <see cref="ExportDefinition"/> match the conditions defined by
- /// <paramref name="definition"/>, return an empty <see cref="IEnumerable{T}"/>.
- /// </note>
- /// </remarks>
- public override IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>> GetExports(ImportDefinition definition)
- {
- this.ThrowIfDisposed();
-
- Requires.NotNull(definition, "definition");
-
- IEnumerable<ComposablePartDefinition> candidateParts = this.GetCandidateParts(definition);
- if (candidateParts == null)
- {
- return Enumerable.Empty<Tuple<ComposablePartDefinition, ExportDefinition>>();
- }
-
- var exports = new List<Tuple<ComposablePartDefinition, ExportDefinition>>();
- foreach (var part in candidateParts)
- {
- foreach (var export in part.ExportDefinitions)
- {
- if (definition.IsConstraintSatisfiedBy(export))
- {
- exports.Add(new Tuple<ComposablePartDefinition, ExportDefinition>(part, export));
- }
- }
- }
- return exports;
- }
-
- private IEnumerable<ComposablePartDefinition> GetCandidateParts(ImportDefinition definition)
- {
- string contractName = definition.ContractName;
-
- // Empty string represents a non-contract based import and thus the constraint needs
- // to be applied to all the possible exports in this catalog.
- if (string.IsNullOrEmpty(contractName))
- {
- return this.PartsInternal;
- }
-
- List<ComposablePartDefinition> candidateParts = null;
- if (this._contractPartIndex.Value.TryGetValue(contractName, out candidateParts))
- {
- return candidateParts;
- }
- else
- {
- return null;
- }
- }
-
- private IDictionary<string, List<ComposablePartDefinition>> CreateIndex()
- {
- Dictionary<string, List<ComposablePartDefinition>> index = new Dictionary<string, List<ComposablePartDefinition>>(StringComparers.ContractName);
-
- foreach (var part in this.PartsInternal)
- {
- foreach (string contractName in part.ExportDefinitions.Select(export => export.ContractName).Distinct())
- {
- List<ComposablePartDefinition> contractParts = null;
- if (!index.TryGetValue(contractName, out contractParts))
- {
- contractParts = new List<ComposablePartDefinition>();
- index.Add(contractName, contractParts);
- }
- contractParts.Add(part);
- }
- }
- return index;
- }
-
- /// <summary>
- /// Returns a string representation of the type catalog.
- /// </summary>
- /// <returns>
- /// A <see cref="String"/> containing the string representation of the <see cref="TypeCatalog"/>.
- /// </returns>
- public override string ToString()
- {
- return this.GetDisplayName();
- }
-
- protected override void Dispose(bool disposing)
- {
- if (disposing)
- {
- this._isDisposed = true;
- }
-
- base.Dispose(disposing);
- }
-
- private string GetDisplayName()
- {
- return String.Format(CultureInfo.CurrentCulture,
- Strings.TypeCatalog_DisplayNameFormat,
- this.GetType().Name,
- this.GetTypesDisplay());
- }
-
- private string GetTypesDisplay()
- {
- int count = this.PartsInternal.Count();
- if (count == 0)
- {
- return Strings.TypeCatalog_Empty;
- }
-
- const int displayCount = 2;
- StringBuilder builder = new StringBuilder();
- foreach (ReflectionComposablePartDefinition definition in this.PartsInternal.Take(displayCount))
- {
- if (builder.Length > 0)
- {
- builder.Append(CultureInfo.CurrentCulture.TextInfo.ListSeparator);
- builder.Append(" ");
- }
-
- builder.Append(definition.GetPartType().GetDisplayName());
- }
-
- if (count > displayCount)
- { // Add an elipse to indicate that there
- // are more types than actually listed
- builder.Append(CultureInfo.CurrentCulture.TextInfo.ListSeparator);
- builder.Append(" ...");
- }
-
- return builder.ToString();
- }
-
- private void ThrowIfDisposed()
- {
- if (this._isDisposed)
- {
- throw ExceptionBuilder.CreateObjectDisposed(this);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/IAttributedImport.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/IAttributedImport.cs deleted file mode 100644 index a2f9c166d27..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/IAttributedImport.cs +++ /dev/null @@ -1,17 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition
-{
- internal interface IAttributedImport
- {
- string ContractName { get; }
- Type ContractType { get; }
- bool AllowRecomposition { get; }
- CreationPolicy RequiredCreationPolicy { get; }
- ImportCardinality Cardinality { get; }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ICompositionError.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ICompositionError.cs deleted file mode 100644 index a31430ff72d..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ICompositionError.cs +++ /dev/null @@ -1,29 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition
-{
- // Internal interface for providing access to the composition error
- // identifier for an exception or error that participates in composition.
- internal interface ICompositionError
- {
- CompositionErrorId Id
- {
- get;
- }
-
- ICompositionElement Element
- {
- get;
- }
-
- Exception InnerException
- {
- get;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ICompositionService.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ICompositionService.cs deleted file mode 100644 index 45a4dd90162..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ICompositionService.cs +++ /dev/null @@ -1,34 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition
-{
- /// <summary>
- /// Provides methods for composing <see cref="ComposablePart"/> objects.
- /// </summary>
- public interface ICompositionService
- {
- /// <summary>
- /// Sets the imports of the specified composable part exactly once and they will not
- /// ever be recomposed.
- /// </summary>
- /// <param name="part">
- /// The <see cref="ComposablePart"/> to set the imports.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="part"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="CompositionException">
- /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
- /// contain a collection of errors that occurred.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="ICompositionService"/> has been disposed of.
- /// </exception>
- void SatisfyImportsOnce(ComposablePart part);
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/IPartImportsSatisfiedNotification.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/IPartImportsSatisfiedNotification.cs deleted file mode 100644 index 60d592016ca..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/IPartImportsSatisfiedNotification.cs +++ /dev/null @@ -1,12 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-
-namespace System.ComponentModel.Composition
-{
- public interface IPartImportsSatisfiedNotification
- {
- void OnImportsSatisfied();
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ImportAttribute.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ImportAttribute.cs deleted file mode 100644 index b4015271fbc..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ImportAttribute.cs +++ /dev/null @@ -1,181 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Diagnostics.CodeAnalysis;
-
-namespace System.ComponentModel.Composition
-{
- /// <summary>
- /// Specifies that a property, field, or parameter imports a particular export.
- /// </summary>
- [SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
- [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter,
- AllowMultiple = false, Inherited = false)]
- public class ImportAttribute : Attribute, IAttributedImport
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ImportAttribute"/> class, importing the
- /// export with the default contract name.
- /// </summary>
- /// <remarks>
- /// <para>
- /// The default contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the property, field,
- /// or parameter type that this is marked with this attribute.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- public ImportAttribute()
- : this((string)null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ImportAttribute"/> class, importing the
- /// export with the contract name derived from the specified type.
- /// </summary>
- /// <param name="contractType">
- /// A <see cref="Type"/> of which to derive the contract name of the export to import, or
- /// <see langword="null"/> to use the default contract name.
- /// </param>
- /// <remarks>
- /// <para>
- /// The contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on
- /// <paramref name="contractType"/>.
- /// </para>
- /// <para>
- /// The default contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the property, field,
- /// or parameter type that is marked with this attribute.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- public ImportAttribute(Type contractType)
- : this((string)null, contractType)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ImportAttribute"/> class, importing the
- /// export with the specified contract name.
- /// </summary>
- /// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the export to import, or
- /// <see langword="null"/> or an empty string ("") to use the default contract name.
- /// </param>
- /// <remarks>
- /// <para>
- /// The default contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the property, field,
- /// or parameter type that is marked with this attribute.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- public ImportAttribute(string contractName)
- : this(contractName, (Type)null)
- {
- }
-
- public ImportAttribute(string contractName, Type contractType)
- {
- this.ContractName = contractName;
- this.ContractType = contractType;
- }
-
- /// <summary>
- /// Gets the contract name of the export to import.
- /// </summary>
- /// <value>
- /// A <see cref="String"/> containing the contract name of the export to import. The
- /// default value is an empty string ("").
- /// </value>
- public string ContractName { get; private set; }
-
- /// <summary>
- /// Get the contract type of the export to import.
- /// </summary>
- /// <value>
- /// A <see cref="Type"/> of the export that this import is expecting. The default value is
- /// <see langword="null"/> which means that the type will be obtained by looking at the type on
- /// the member that this import is attached to. If the type is <see cref="object"/> then the
- /// importer is delaring they can accept any exported type.
- /// </value>
- public Type ContractType { get; private set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether the property, field or parameter will be set
- /// to its type's default value when an export with the contract name is not present in
- /// the container.
- /// </summary>
- /// <value>
- /// <see langword="true"/> if the property, field or parameter will be set
- /// its type's default value when an export with the <see cref="ContractName"/> is not
- /// present in the <see cref="CompositionContainer"/>; otherwise, <see langword="false"/>.
- /// The default value is <see langword="false"/>.
- /// </value>
- /// <remarks>
- /// <para>
- /// The default value of a property's, field's or parameter's type is
- /// <see langword="null"/> for reference types and 0 for numeric value types. For
- /// other value types, the default value will be each field of the value type
- /// initialized to zero, if the field is a value type or <see langword="null"/> if
- /// the field is a reference type.
- /// </para>
- /// </remarks>
- public bool AllowDefault { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether the property or field will be recomposed
- /// when exports that provide the same contract that this import expects, have changed
- /// in the container.
- /// </summary>
- /// <value>
- /// <see langword="true"/> if the property or field allows for recomposition when exports
- /// that provide the same <see cref="ContractName"/> are added or removed from the
- /// <see cref="CompositionContainer"/>; otherwise, <see langword="false"/>.
- /// The default value is <see langword="false"/>.
- /// </value>
- public bool AllowRecomposition { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating that the importer requires a specific
- /// <see cref="CreationPolicy"/> for the exports used to satisfy this import. T
- /// </summary>
- /// <value>
- /// <see cref="CreationPolicy.Any"/> - default value, used if the importer doesn't
- /// require a specific <see cref="CreationPolicy"/>.
- ///
- /// <see cref="CreationPolicy.Shared"/> - Requires that all exports used should be shared
- /// by everyone in the container.
- ///
- /// <see cref="CreationPolicy.NonShared"/> - Requires that all exports used should be
- /// non-shared in a container and thus everyone gets their own instance.
- /// </value>
- public CreationPolicy RequiredCreationPolicy { get; set; }
-
- ImportCardinality IAttributedImport.Cardinality
- {
- get
- {
- if (this.AllowDefault == true)
- {
- return ImportCardinality.ZeroOrOne;
- }
- return ImportCardinality.ExactlyOne;
- }
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ImportCardinalityMismatchException.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ImportCardinalityMismatchException.cs deleted file mode 100644 index 9048f5c6362..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ImportCardinalityMismatchException.cs +++ /dev/null @@ -1,91 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Runtime.Serialization;
-
-namespace System.ComponentModel.Composition
-{
- /// <summary>
- /// The exception that is thrown when the cardinality of a <see cref="ImportDefinition"/>
- /// does not match the cardinality of the <see cref="Export"/> objects available in an
- /// <see cref="ExportProvider"/>.
- /// </summary>
- [Serializable]
- public class ImportCardinalityMismatchException : Exception
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ImportCardinalityMismatchException"/> class.
- /// </summary>
- public ImportCardinalityMismatchException()
- : this((string)null, (Exception)null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ImportCardinalityMismatchException"/> class
- /// with the specified error message.
- /// </summary>
- /// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
- /// <see cref="ImportCardinalityMismatchException"/>; or <see langword="null"/> to set
- /// the <see cref="Exception.Message"/> property to its default value.
- /// </param>
- public ImportCardinalityMismatchException(string message)
- : this(message, (Exception)null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ImportCardinalityMismatchException"/> class
- /// with the specified error message and exception that is the cause of the
- /// exception.
- /// </summary>
- /// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
- /// <see cref="ImportCardinalityMismatchException"/>; or <see langword="null"/> to set
- /// the <see cref="Exception.Message"/> property to its default value.
- /// </param>
- /// <param name="innerException">
- /// The <see cref="Exception"/> that is the underlying cause of the
- /// <see cref="ImportCardinalityMismatchException"/>; or <see langword="null"/> to set
- /// the <see cref="Exception.InnerException"/> property to <see langword="null"/>.
- /// </param>
- public ImportCardinalityMismatchException(string message, Exception innerException)
- : base(message, innerException)
- {
- }
-
-#if !SILVERLIGHT
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ImportCardinalityMismatchException"/> class
- /// with the specified serialization data.
- /// </summary>
- /// <param name="info">
- /// The <see cref="SerializationInfo"/> that holds the serialized object data about the
- /// <see cref="ImportCardinalityMismatchException"/>.
- /// </param>
- /// <param name="context">
- /// The <see cref="StreamingContext"/> that contains contextual information about the
- /// source or destination.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="info"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="SerializationException">
- /// <paramref name="info"/> is missing a required value.
- /// </exception>
- /// <exception cref="InvalidCastException">
- /// <paramref name="info"/> contains a value that cannot be cast to the correct type.
- /// </exception>
- [System.Security.SecuritySafeCritical]
- protected ImportCardinalityMismatchException(SerializationInfo info, StreamingContext context)
- : base(info, context)
- {
- }
-#endif //!SILVERLIGHT
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ImportManyAttribute.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ImportManyAttribute.cs deleted file mode 100644 index 79f706f6044..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ImportManyAttribute.cs +++ /dev/null @@ -1,152 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Diagnostics.CodeAnalysis;
-
-namespace System.ComponentModel.Composition
-{
- /// <summary>
- /// Specifies that a property, field, or parameter imports a particular set of exports.
- /// </summary>
- [SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
- [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter,
- AllowMultiple = false, Inherited = false)]
- public class ImportManyAttribute : Attribute, IAttributedImport
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ImportManyAttribute"/> class, importing the
- /// set of exports with the default contract name.
- /// </summary>
- /// <remarks>
- /// <para>
- /// The default contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the element\item type of
- /// theproperty, field, or parameter type that this is marked with this attribute.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- public ImportManyAttribute()
- : this((string)null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ImportManyAttribute"/> class, importing the
- /// set of exports with the contract name derived from the specified type.
- /// </summary>
- /// <param name="contractType">
- /// A <see cref="Type"/> of which to derive the contract name of the exports to import, or
- /// <see langword="null"/> to use the default contract name.
- /// </param>
- /// <remarks>
- /// <para>
- /// The contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on
- /// <paramref name="contractType"/>.
- /// </para>
- /// <para>
- /// The default contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the property, field,
- /// or parameter type that is marked with this attribute.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- public ImportManyAttribute(Type contractType)
- : this((string)null, contractType)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ImportManyAttribute"/> class, importing the
- /// set of exports with the specified contract name.
- /// </summary>
- /// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the exports to import, or
- /// <see langword="null"/> or an empty string ("") to use the default contract name.
- /// </param>
- /// <remarks>
- /// <para>
- /// The default contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the property, field,
- /// or parameter type that is marked with this attribute.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- public ImportManyAttribute(string contractName)
- : this(contractName, (Type)null)
- {
- }
-
- public ImportManyAttribute(string contractName, Type contractType)
- {
- this.ContractName = contractName;
- this.ContractType = contractType;
- }
-
- /// <summary>
- /// Gets the contract name of the exports to import.
- /// </summary>
- /// <value>
- /// A <see cref="String"/> containing the contract name of the exports to import. The
- /// default value is an empty string ("").
- /// </value>
- public string ContractName { get; private set; }
-
- /// <summary>
- /// Get the contract type of the export to import.
- /// </summary>
- /// <value>
- /// A <see cref="Type"/> of the export that this import is expecting. The default value is
- /// <see langword="null"/> which means that the type will be obtained by looking at the type on
- /// the member that this import is attached to. If the type is <see cref="object"/> then the
- /// importer is delaring they can accept any exported type.
- /// </value>
- public Type ContractType { get; private set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether the property or field will be recomposed
- /// when exports that provide the same contract that this import expects, have changed
- /// in the container.
- /// </summary>
- /// <value>
- /// <see langword="true"/> if the property or field allows for recomposition when exports
- /// that provide the same <see cref="ContractName"/> are added or removed from the
- /// <see cref="CompositionContainer"/>; otherwise, <see langword="false"/>.
- /// The default value is <see langword="false"/>.
- /// </value>
- public bool AllowRecomposition { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating that the importer requires a specific
- /// <see cref="CreationPolicy"/> for the exports used to satisfy this import. T
- /// </summary>
- /// <value>
- /// <see cref="CreationPolicy.Any"/> - default value, used if the importer doesn't
- /// require a specific <see cref="CreationPolicy"/>.
- ///
- /// <see cref="CreationPolicy.Shared"/> - Requires that all exports used should be shared
- /// by everyone in the container.
- ///
- /// <see cref="CreationPolicy.NonShared"/> - Requires that all exports used should be
- /// non-shared in a container and thus everyone gets their own instance.
- /// </value>
- public CreationPolicy RequiredCreationPolicy { get; set; }
-
- ImportCardinality IAttributedImport.Cardinality
- {
- get { return ImportCardinality.ZeroOrMore; }
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ImportingConstructorAttribute.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ImportingConstructorAttribute.cs deleted file mode 100644 index 2263316d43c..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ImportingConstructorAttribute.cs +++ /dev/null @@ -1,28 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Diagnostics.CodeAnalysis;
-
-namespace System.ComponentModel.Composition
-{
- /// <summary>
- /// Specifies that a constructor should be used when constructing an attributed part.
- /// </summary>
- /// <remarks>
- /// By default, only a default parameter-less constructor, if available, is used to
- /// construct an attributed part. Use this attribute to indicate that a specific constructor
- /// should be used.
- /// </remarks>
- [SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
- [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
- public class ImportingConstructorAttribute : Attribute
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ImportingConstructorAttribute"/> class.
- /// </summary>
- public ImportingConstructorAttribute()
- {
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/InheritedExportAttribute.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/InheritedExportAttribute.cs deleted file mode 100644 index ab42dfab9ab..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/InheritedExportAttribute.cs +++ /dev/null @@ -1,122 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Hosting;
-using System.Diagnostics.CodeAnalysis;
-
-namespace System.ComponentModel.Composition
-{
- /// <summary>
- /// Specifies that a type or interface that provides a particular export.
- /// </summary>
- [SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
- [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true, Inherited = true)]
- public class InheritedExportAttribute : ExportAttribute
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
- /// type marked with this attribute under the default contract name.
- /// </summary>
- /// <remarks>
- /// <para>
- /// The default contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the type itself,
- /// that is marked with this attribute.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- public InheritedExportAttribute()
- : this((string)null, (Type)null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
- /// type marked with this attribute under a contract name derived from the specified type.
- /// </summary>
- /// <param name="contractType">
- /// A <see cref="Type"/> of which to derive the contract name to export the type
- /// marked with this attribute, under; or <see langword="null"/> to use the
- /// default contract name.
- /// </param>
- /// <remarks>
- /// <para>
- /// The contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on
- /// <paramref name="contractType"/>.
- /// </para>
- /// <para>
- /// The default contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the type of the
- /// itself, that is marked with this attribute.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- public InheritedExportAttribute(Type contractType)
- : this((string)null, contractType)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
- /// type or member marked with this attribute under the specified contract name.
- /// </summary>
- /// <param name="contractName">
- /// A <see cref="String"/> containing the contract name to export the type
- /// marked with this attribute, under; or <see langword="null"/> or an empty string
- /// ("") to use the default contract name.
- /// </param>
- /// <remarks>
- /// <para>
- /// The default contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on
- /// the type itself that this is marked with this attribute.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- public InheritedExportAttribute(string contractName)
- : this(contractName, (Type)null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
- /// type or member marked with this attribute under the specified contract name.
- /// </summary>
- /// <param name="contractName">
- /// A <see cref="String"/> containing the contract name to export the type
- /// marked with this attribute, under; or <see langword="null"/> or an empty string
- /// ("") to use the default contract name.
- /// </param>
- /// <param name="contractType">
- /// A <see cref="Type"/> of which to derive the contract name to export the type
- /// marked with this attribute, under; or <see langword="null"/> to use the
- /// default contract name.
- /// </param>
- /// <remarks>
- /// <para>
- /// The default contract name is the result of calling
- /// <see cref="AttributedModelServices.GetContractName(Type)"/> on
- /// the type itself that this is marked with this attribute.
- /// </para>
- /// <para>
- /// The contract name is compared using a case-sensitive, non-linguistic comparison
- /// using <see cref="StringComparer.Ordinal"/>.
- /// </para>
- /// </remarks>
- public InheritedExportAttribute(string contractName, Type contractType)
- : base(contractName, contractType)
- {
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/MetadataAttributeAttribute.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/MetadataAttributeAttribute.cs deleted file mode 100644 index 59aad485329..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/MetadataAttributeAttribute.cs +++ /dev/null @@ -1,23 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-
-namespace System.ComponentModel.Composition
-{
- /// <summary>
- /// Specifies that an attribute can be used to provide metadata for a type, property, field,
- /// or method marked with the <see cref="ExportAttribute"/>.
- /// </summary>
- [AttributeUsage(AttributeTargets.Class,
- AllowMultiple=false, Inherited=true)]
- public sealed class MetadataAttributeAttribute : Attribute
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="MetadataAttributeAttribute"/> class.
- /// </summary>
- public MetadataAttributeAttribute()
- {
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/MetadataServices.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/MetadataServices.cs deleted file mode 100644 index 6446c665ea8..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/MetadataServices.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-
-namespace System.ComponentModel.Composition
-{
- internal static class MetadataServices
- {
- public static readonly IDictionary<string, object> EmptyMetadata = new ReadOnlyDictionary<string, object>(null);
-
- public static IDictionary<string, object> AsReadOnly(this IDictionary<string, object> metadata)
- {
- if (metadata == null)
- {
- return EmptyMetadata;
- }
-
- if (metadata is ReadOnlyDictionary<string, object>)
- {
- return metadata;
- }
-
- return new ReadOnlyDictionary<string, object>(metadata);
- }
-
- public static T GetValue<T>(this IDictionary<string, object> metadata, string key)
- {
- Assumes.NotNull(metadata, "metadata");
-
- object untypedValue = true;
- if (!metadata.TryGetValue(key, out untypedValue))
- {
- return default(T);
- }
-
- if (untypedValue is T)
- {
- return (T)untypedValue;
- }
- else
- {
- return default(T);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/MetadataViewGenerator.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/MetadataViewGenerator.cs deleted file mode 100644 index e582774eaa4..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/MetadataViewGenerator.cs +++ /dev/null @@ -1,321 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Globalization;
-using System.Linq;
-using System.Reflection;
-using System.Threading;
-using Microsoft.Internal;
-using System.Reflection.Emit;
-using System.Collections;
-
-namespace System.ComponentModel.Composition
-{
- // // Assume TMetadataView is
- // //interface Foo
- // //{
- // // public typeRecord1 Record1 { get; }
- // // public typeRecord2 Record2 { get; }
- // // public typeRecord3 Record3 { get; }
- // // public typeRecord4 Record4 { get; }
- // //}
- // // The class to be generated will look approximately like:
- // public class __Foo__MedataViewProxy : TMetadataView
- // {
- // public __Foo__MedataViewProxy (IDictionary<string, object> metadata)
- // {
- // if(metadata == null)
- // {
- // throw InvalidArgumentException("metadata");
- // }
- // try
- // {
- // Record1 = (typeRecord1)Record1;
- // Record2 = (typeRecord1)Record2;
- // Record3 = (typeRecord1)Record3;
- // Record4 = (typeRecord1)Record4;
- // }
- // catch(InvalidCastException ice)
- // {
- // //Annotate exception .Data with diagnostic info
- // }
- // catch(NulLReferenceException ice)
- // {
- // //Annotate exception .Data with diagnostic info
- // }
- // }
- // // Interface
- // public typeRecord1 Record1 { get; }
- // public typeRecord2 Record2 { get; }
- // public typeRecord3 Record3 { get; }
- // public typeRecord4 Record4 { get; }
- // }
- internal static class MetadataViewGenerator
- {
- public const string MetadataViewType = "MetadataViewType";
- public const string MetadataItemKey = "MetadataItemKey";
- public const string MetadataItemTargetType = "MetadataItemTargetType";
- public const string MetadataItemSourceType = "MetadataItemSourceType";
- public const string MetadataItemValue = "MetadataItemValue";
-
- private static Lock _lock = new Lock();
- private static Dictionary<Type, Type> _proxies = new Dictionary<Type, Type>();
-
- private static AssemblyName ProxyAssemblyName = new AssemblyName(string.Format(CultureInfo.InvariantCulture, "MetadataViewProxies_{0}", Guid.NewGuid()));
- private static AssemblyBuilder ProxyAssemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(ProxyAssemblyName, AssemblyBuilderAccess.Run);
- private static ModuleBuilder ProxyModuleBuilder = ProxyAssemblyBuilder.DefineDynamicModule("MetadataViewProxiesModule");
- private static Type[] CtorArgumentTypes = new Type[] { typeof(IDictionary<string, object>) };
- private static MethodInfo _mdvDictionaryTryGet = CtorArgumentTypes[0].GetMethod("TryGetValue");
- private static readonly MethodInfo ObjectGetType = typeof(object).GetMethod("GetType", Type.EmptyTypes);
-
- public static Type GenerateView(Type viewType)
- {
- Assumes.NotNull(viewType);
- Assumes.IsTrue(viewType.IsInterface);
-
- Type proxyType;
- bool foundProxy;
-
- using (new ReadLock(_lock))
- {
- foundProxy = _proxies.TryGetValue(viewType, out proxyType);
- }
-
- // No factory exists
- if(!foundProxy)
- {
- // Try again under a write lock if still none generate the proxy
- using (new WriteLock(_lock))
- {
- foundProxy = _proxies.TryGetValue(viewType, out proxyType);
-
- if (!foundProxy)
- {
- proxyType = GenerateInterfaceViewProxyType(viewType);
- Assumes.NotNull(proxyType);
-
- _proxies.Add(viewType, proxyType);
- }
- }
- }
- return proxyType;
- }
-
- private static void GenerateLocalAssignmentFromDefaultAttribute(this ILGenerator IL, DefaultValueAttribute[] attrs, LocalBuilder local)
- {
- if (attrs.Length > 0)
- {
- DefaultValueAttribute defaultAttribute = attrs[0];
- IL.LoadValue(defaultAttribute.Value);
- if ((defaultAttribute.Value != null) && (defaultAttribute.Value.GetType().IsValueType))
- {
- IL.Emit(OpCodes.Box, defaultAttribute.Value.GetType());
- }
- IL.Emit(OpCodes.Stloc, local);
- }
- }
-
- private static void GenerateFieldAssignmentFromLocalValue(this ILGenerator IL, LocalBuilder local, FieldBuilder field)
- {
- IL.Emit(OpCodes.Ldarg_0);
- IL.Emit(OpCodes.Ldloc, local);
- IL.Emit(field.FieldType.IsValueType ? OpCodes.Unbox_Any : OpCodes.Castclass, field.FieldType);
- IL.Emit(OpCodes.Stfld, field);
- }
-
- private static void GenerateLocalAssignmentFromFlag(this ILGenerator IL, LocalBuilder local, bool flag)
- {
- IL.Emit(flag ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0);
- IL.Emit(OpCodes.Stloc, local);
- }
-
- // This must be called with _readerWriterLock held for Write
- private static Type GenerateInterfaceViewProxyType(Type viewType)
- {
- // View type is an interface let's cook an implementation
- Type proxyType;
- TypeBuilder proxyTypeBuilder;
- Type[] interfaces = { viewType };
-
- proxyTypeBuilder = ProxyModuleBuilder.DefineType(
- string.Format(CultureInfo.InvariantCulture, "_proxy_{0}_{1}", viewType.FullName, Guid.NewGuid()),
- TypeAttributes.Public,
- typeof(object),
- interfaces);
-
- // Implement Constructor
- ILGenerator proxyCtorIL = proxyTypeBuilder.CreateGeneratorForPublicConstructor(CtorArgumentTypes);
- LocalBuilder exception = proxyCtorIL.DeclareLocal(typeof(Exception));
- LocalBuilder exceptionData = proxyCtorIL.DeclareLocal(typeof(IDictionary));
- LocalBuilder sourceType = proxyCtorIL.DeclareLocal(typeof(Type));
- LocalBuilder value = proxyCtorIL.DeclareLocal(typeof(object));
- LocalBuilder usesExportedMD = proxyCtorIL.DeclareLocal(typeof(bool));
-
- Label tryConstructView = proxyCtorIL.BeginExceptionBlock();
-
- // Implement interface properties
- foreach (PropertyInfo propertyInfo in viewType.GetAllProperties())
- {
- string fieldName = string.Format(CultureInfo.InvariantCulture, "_{0}_{1}", propertyInfo.Name, Guid.NewGuid());
-
- // Cache names and type for exception
- string propertyName = string.Format(CultureInfo.InvariantCulture, "{0}", propertyInfo.Name);
-
- Type[] propertyTypeArguments = new Type[] { propertyInfo.PropertyType };
- Type[] optionalModifiers = null;
- Type[] requiredModifiers = null;
-
-#if !SILVERLIGHT
- // PropertyInfo does not support GetOptionalCustomModifiers and GetRequiredCustomModifiers on Silverlight
- optionalModifiers = propertyInfo.GetOptionalCustomModifiers();
- requiredModifiers = propertyInfo.GetRequiredCustomModifiers();
- Array.Reverse(optionalModifiers);
- Array.Reverse(requiredModifiers);
-#endif
- // Generate field
- FieldBuilder proxyFieldBuilder = proxyTypeBuilder.DefineField(
- fieldName,
- propertyInfo.PropertyType,
- FieldAttributes.Private);
-
- // Generate property
- PropertyBuilder proxyPropertyBuilder = proxyTypeBuilder.DefineProperty(
- propertyName,
- PropertyAttributes.None,
- propertyInfo.PropertyType,
- propertyTypeArguments);
-
- // Generate constructor code for retrieving the metadata value and setting the field
- Label tryCastValue = proxyCtorIL.BeginExceptionBlock();
- Label innerTryCastValue;
-
- DefaultValueAttribute[] attrs = propertyInfo.GetAttributes<DefaultValueAttribute>(false);
- if(attrs.Length > 0)
- {
- innerTryCastValue = proxyCtorIL.BeginExceptionBlock();
- }
-
- // In constructor set the backing field with the value from the dictionary
- Label doneGettingDefaultValue = proxyCtorIL.DefineLabel();
- GenerateLocalAssignmentFromFlag(proxyCtorIL, usesExportedMD, true);
-
- proxyCtorIL.Emit(OpCodes.Ldarg_1);
- proxyCtorIL.Emit(OpCodes.Ldstr, propertyInfo.Name);
- proxyCtorIL.Emit(OpCodes.Ldloca, value);
- proxyCtorIL.Emit(OpCodes.Callvirt, _mdvDictionaryTryGet);
- proxyCtorIL.Emit(OpCodes.Brtrue, doneGettingDefaultValue);
-
- proxyCtorIL.GenerateLocalAssignmentFromFlag(usesExportedMD, false);
- proxyCtorIL.GenerateLocalAssignmentFromDefaultAttribute(attrs, value);
-
- proxyCtorIL.MarkLabel(doneGettingDefaultValue);
- proxyCtorIL.GenerateFieldAssignmentFromLocalValue(value, proxyFieldBuilder);
- proxyCtorIL.Emit(OpCodes.Leave, tryCastValue);
-
- // catch blocks for innerTryCastValue start here
- if (attrs.Length > 0)
- {
- proxyCtorIL.BeginCatchBlock(typeof(InvalidCastException));
- {
- Label notUsesExportedMd = proxyCtorIL.DefineLabel();
- proxyCtorIL.Emit(OpCodes.Ldloc, usesExportedMD);
- proxyCtorIL.Emit(OpCodes.Brtrue, notUsesExportedMd);
- proxyCtorIL.Emit(OpCodes.Rethrow);
- proxyCtorIL.MarkLabel(notUsesExportedMd);
- proxyCtorIL.GenerateLocalAssignmentFromDefaultAttribute(attrs, value);
- proxyCtorIL.GenerateFieldAssignmentFromLocalValue(value, proxyFieldBuilder);
- }
- proxyCtorIL.EndExceptionBlock();
- }
-
- // catch blocks for tryCast start here
- proxyCtorIL.BeginCatchBlock(typeof(NullReferenceException));
- {
- proxyCtorIL.Emit(OpCodes.Stloc, exception);
-
- proxyCtorIL.GetExceptionDataAndStoreInLocal(exception, exceptionData);
- proxyCtorIL.AddItemToLocalDictionary(exceptionData, MetadataItemKey, propertyName);
- proxyCtorIL.AddItemToLocalDictionary(exceptionData, MetadataItemTargetType, propertyInfo.PropertyType);
- proxyCtorIL.Emit(OpCodes.Rethrow);
- }
-
- proxyCtorIL.BeginCatchBlock(typeof(InvalidCastException));
- {
- proxyCtorIL.Emit(OpCodes.Stloc, exception);
-
- proxyCtorIL.GetExceptionDataAndStoreInLocal(exception, exceptionData);
- proxyCtorIL.AddItemToLocalDictionary(exceptionData, MetadataItemKey, propertyName);
- proxyCtorIL.AddItemToLocalDictionary(exceptionData, MetadataItemTargetType, propertyInfo.PropertyType);
- proxyCtorIL.Emit(OpCodes.Rethrow);
- }
-
- proxyCtorIL.EndExceptionBlock();
-
- if (propertyInfo.CanWrite)
- {
- // The MetadataView '{0}' is invalid because property '{1}' has a property set method.
- throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture,
- Strings.InvalidSetterOnMetadataField,
- viewType,
- propertyName));
- }
- if (propertyInfo.CanRead)
- {
- // Generate "get" method implementation.
- MethodBuilder getMethodBuilder = proxyTypeBuilder.DefineMethod(
- string.Format(CultureInfo.InvariantCulture, "get_{0}", propertyName),
- MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.SpecialName | MethodAttributes.NewSlot | MethodAttributes.Virtual | MethodAttributes.Final,
- CallingConventions.HasThis,
- propertyInfo.PropertyType,
- requiredModifiers,
- optionalModifiers,
- Type.EmptyTypes, null, null);
-
- proxyTypeBuilder.DefineMethodOverride(getMethodBuilder, propertyInfo.GetGetMethod());
- ILGenerator getMethodIL = getMethodBuilder.GetILGenerator();
- getMethodIL.Emit(OpCodes.Ldarg_0);
- getMethodIL.Emit(OpCodes.Ldfld, proxyFieldBuilder);
- getMethodIL.Emit(OpCodes.Ret);
-
- proxyPropertyBuilder.SetGetMethod(getMethodBuilder);
- }
- }
-
- proxyCtorIL.Emit(OpCodes.Leave, tryConstructView);
-
- // catch blocks for constructView start here
- proxyCtorIL.BeginCatchBlock(typeof(NullReferenceException));
- {
- proxyCtorIL.Emit(OpCodes.Stloc, exception);
-
- proxyCtorIL.GetExceptionDataAndStoreInLocal(exception, exceptionData);
- proxyCtorIL.AddItemToLocalDictionary(exceptionData, MetadataViewType, viewType);
- proxyCtorIL.Emit(OpCodes.Rethrow);
- }
- proxyCtorIL.BeginCatchBlock(typeof(InvalidCastException));
- {
- proxyCtorIL.Emit(OpCodes.Stloc, exception);
-
- proxyCtorIL.GetExceptionDataAndStoreInLocal(exception, exceptionData);
- proxyCtorIL.Emit(OpCodes.Ldloc, value);
- proxyCtorIL.Emit(OpCodes.Call, ObjectGetType);
- proxyCtorIL.Emit(OpCodes.Stloc, sourceType);
- proxyCtorIL.AddItemToLocalDictionary(exceptionData, MetadataViewType, viewType);
- proxyCtorIL.AddLocalToLocalDictionary(exceptionData, MetadataItemSourceType, sourceType);
- proxyCtorIL.AddLocalToLocalDictionary(exceptionData, MetadataItemValue, value);
- proxyCtorIL.Emit(OpCodes.Rethrow);
- }
- proxyCtorIL.EndExceptionBlock();
-
- // Finished implementing interface and constructor
- proxyCtorIL.Emit(OpCodes.Ret);
- proxyType = proxyTypeBuilder.CreateType();
-
- return proxyType;
- }
-
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/MetadataViewProvider.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/MetadataViewProvider.cs deleted file mode 100644 index 8e22770cad6..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/MetadataViewProvider.cs +++ /dev/null @@ -1,106 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using Microsoft.Internal;
-using System.Globalization;
-using System.Runtime.InteropServices;
-using System.Diagnostics.CodeAnalysis;
-
-namespace System.ComponentModel.Composition
-{
- internal static class MetadataViewProvider
- {
- [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
- public static TMetadataView GetMetadataView<TMetadataView>(IDictionary<string, object> metadata)
- {
- Type metadataViewType = typeof(TMetadataView);
-
- // If the Metadata dictionary is cast compatible with the passed in type
- if (metadataViewType.IsAssignableFrom(typeof(IDictionary<string, object>)))
- {
- return (TMetadataView)metadata;
- }
- // otherwise is it a metadata view
- else
- {
- Type proxyType;
- if (metadataViewType.IsInterface)
- {
- try
- {
- proxyType = MetadataViewGenerator.GenerateView(metadataViewType);
- }
- catch (TypeLoadException ex)
- {
- throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, Strings.NotSupportedInterfaceMetadataView, metadataViewType.FullName), ex);
- }
- }
- else
- {
- proxyType = metadataViewType;
- }
-
- // Now we have the type for the proxy create it
- try
- {
- return (TMetadataView)proxyType.SafeCreateInstance(metadata);
- }
- catch (MissingMethodException ex)
- {
- // Unable to create an Instance of the Metadata view '{0}' because a constructor could not be selected. Ensure that the type implements a constructor which takes an argument of type IDictionary<string, object>.
- throw new CompositionContractMismatchException(string.Format(CultureInfo.CurrentCulture,
- Strings.CompositionException_MetadataViewInvalidConstructor,
- proxyType.AssemblyQualifiedName), ex);
- }
- catch (TargetInvocationException ex)
- {
- //Unwrap known failures that we want to present as CompositionContractMismatchException
- if(metadataViewType.IsInterface)
- {
- if(ex.InnerException.GetType() == typeof(InvalidCastException))
- {
- // Unable to create an Instance of the Metadata view {0} because the exporter exported the metadata for the item {1} with the value {2} as type {3} but the view imports it as type {4}.
- throw new CompositionContractMismatchException(string.Format(CultureInfo.CurrentCulture,
- Strings.ContractMismatch_InvalidCastOnMetadataField,
- ex.InnerException.Data[MetadataViewGenerator.MetadataViewType],
- ex.InnerException.Data[MetadataViewGenerator.MetadataItemKey],
- ex.InnerException.Data[MetadataViewGenerator.MetadataItemValue],
- ex.InnerException.Data[MetadataViewGenerator.MetadataItemSourceType],
- ex.InnerException.Data[MetadataViewGenerator.MetadataItemTargetType]), ex);
- }
- else if (ex.InnerException.GetType() == typeof(NullReferenceException))
- {
- // Unable to create an Instance of the Metadata view {0} because the exporter exported the metadata for the item {1} with a null value and null is not a valid value for type {2}.
- throw new CompositionContractMismatchException(string.Format(CultureInfo.CurrentCulture,
- Strings.ContractMismatch_NullReferenceOnMetadataField,
- ex.InnerException.Data[MetadataViewGenerator.MetadataViewType],
- ex.InnerException.Data[MetadataViewGenerator.MetadataItemKey],
- ex.InnerException.Data[MetadataViewGenerator.MetadataItemTargetType]), ex);
- }
- }
- throw;
- }
- }
- }
-
- public static bool IsViewTypeValid(Type metadataViewType)
- {
- Assumes.NotNull(metadataViewType);
-
- // If the Metadata dictionary is cast compatible with the passed in type
- if (ExportServices.IsDefaultMetadataViewType(metadataViewType)
- || metadataViewType.IsInterface
- || ExportServices.IsDictionaryConstructorViewType(metadataViewType))
- {
- return true;
- }
-
- return false;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/PartCreationPolicyAttribute.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/PartCreationPolicyAttribute.cs deleted file mode 100644 index 844fb3925de..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/PartCreationPolicyAttribute.cs +++ /dev/null @@ -1,36 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition
-{
- /// <summary>
- /// Specifies <see cref="CreationPolicy"/> for a given <see cref="ComposablePart" />.
- /// </summary>
- [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
- public sealed class PartCreationPolicyAttribute : Attribute
- {
- internal static PartCreationPolicyAttribute Default = new PartCreationPolicyAttribute(CreationPolicy.Any);
- internal static PartCreationPolicyAttribute Shared = new PartCreationPolicyAttribute(CreationPolicy.Shared);
-
- /// <summary>
- /// Initializes a new instance of the <see cref="PartCreationPolicyAttribute"/> class.
- /// </summary>
- public PartCreationPolicyAttribute(CreationPolicy creationPolicy)
- {
- this.CreationPolicy = creationPolicy;
- }
-
- /// <summary>
- /// Gets or sets a value indicating the creation policy of the attributed part.
- /// </summary>
- /// <value>
- /// One of the <see cref="CreationPolicy"/> values indicating the creation policy of the
- /// attributed part. The default is
- /// <see cref="System.ComponentModel.Composition.CreationPolicy.Any"/>.
- /// </value>
- public CreationPolicy CreationPolicy { get; private set; }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/PartCreatorOfT.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/PartCreatorOfT.cs deleted file mode 100644 index 37198b1b214..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/PartCreatorOfT.cs +++ /dev/null @@ -1,29 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using Microsoft.Internal;
-
-#if SILVERLIGHT
-
-namespace System.ComponentModel.Composition
-{
- public class PartCreator<T>
- {
- private readonly Func<PartLifetimeContext<T>> _creator;
-
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
- public PartCreator(Func<PartLifetimeContext<T>> creator)
- {
- Requires.NotNull(creator, "creator");
- this._creator = creator;
- }
-
- public PartLifetimeContext<T> CreatePart()
- {
- return this._creator();
- }
- }
-}
-
-#endif
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/PartCreatorOfTTMetadata.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/PartCreatorOfTTMetadata.cs deleted file mode 100644 index c352adfd839..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/PartCreatorOfTTMetadata.cs +++ /dev/null @@ -1,28 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-
-#if SILVERLIGHT
-
-namespace System.ComponentModel.Composition
-{
- public class PartCreator<T, TMetadata> : PartCreator<T>
- {
- private readonly TMetadata _metadata;
-
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
- public PartCreator(Func<PartLifetimeContext<T>> creator, TMetadata metadata)
- : base(creator)
- {
- this._metadata = metadata;
- }
-
- public TMetadata Metadata
- {
- get { return this._metadata; }
- }
- }
-}
-
-#endif
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/PartLifetimeContextOfT.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/PartLifetimeContextOfT.cs deleted file mode 100644 index 75aea437971..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/PartLifetimeContextOfT.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-
-#if SILVERLIGHT
-
-namespace System.ComponentModel.Composition
-{
- public sealed class PartLifetimeContext<T> : IDisposable
- {
- private readonly T _exportedValue;
- private readonly Action _dispose;
-
- public PartLifetimeContext(T exportedValue, Action dispose)
- {
- this._exportedValue = exportedValue;
- this._dispose = dispose;
- }
-
- public T ExportedValue
- {
- get { return this._exportedValue; }
- }
-
- public void Dispose()
- {
- this._dispose();
- }
- }
-}
-
-#endif
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/PartMetadataAttribute.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/PartMetadataAttribute.cs deleted file mode 100644 index a700a293c1b..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/PartMetadataAttribute.cs +++ /dev/null @@ -1,58 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition
-{
- /// <summary>
- /// Specifies metadata for a type to be used as a <see cref="ComposablePartDefinition"/> and
- /// <see cref="ComposablePart"/>.
- /// </summary>
- [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
- public sealed class PartMetadataAttribute : Attribute
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="PartMetadataAttribute"/> with the
- /// specified name and metadata value.
- /// </summary>
- /// <param name="name">
- /// A <see cref="String"/> containing the name of the metadata value; or
- /// <see langword="null"/> to use an empty string ("").
- /// </param>
- /// <param name="value">
- /// An <see cref="object"/> containing the metadata value. This can be
- /// <see langword="null"/>.
- /// </param>
- public PartMetadataAttribute(string name, object value)
- {
- this.Name = name ?? string.Empty;
- this.Value = value;
- }
-
- /// <summary>
- /// Gets the name of the metadata value.
- /// </summary>
- /// <value>
- /// A <see cref="String"/> containing the name of the metadata value.
- /// </value>
- public string Name
- {
- get;
- private set;
- }
-
- /// <summary>
- /// Gets the metadata value.
- /// </summary>
- /// <value>
- /// An <see cref="object"/> containing the metadata value.
- /// </value>
- public object Value
- {
- get;
- private set;
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/PartNotDiscoverableAttribute.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/PartNotDiscoverableAttribute.cs deleted file mode 100644 index 1436a6a9725..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/PartNotDiscoverableAttribute.cs +++ /dev/null @@ -1,23 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition
-{
- /// <summary>
- /// Place on a type that should not be discovered as a <see cref="ComposablePart" /> in
- /// a <see cref="ComposablePartCatalog" />.
- /// </summary>
- [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
- public sealed class PartNotDiscoverableAttribute : Attribute
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="PartNotDiscoverableAttribute"/> class.
- /// </summary>
- public PartNotDiscoverableAttribute()
- {
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/.gitattributes b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/.gitattributes deleted file mode 100644 index 5aa9b2a9d55..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/.gitattributes +++ /dev/null @@ -1,17 +0,0 @@ -/ComposablePart.cs -crlf -/ComposablePartCatalog.cs -crlf -/ComposablePartCatalogDebuggerProxy.cs -crlf -/ComposablePartDefinition.cs -crlf -/ComposablePartException.cs -crlf -/CompositionElement.cs -crlf -/CompositionElementDebuggerProxy.cs -crlf -/CompositionElementExtensions.cs -crlf -/ContractBasedImportDefinition.cs -crlf -/Export.cs -crlf -/ExportDefinition.cs -crlf -/ExportedDelegate.cs -crlf -/ICompositionElement.cs -crlf -/IPartCreatorImportDefinition.cs -crlf -/ImportCardinality.cs -crlf -/ImportDefinition.cs -crlf -/SerializableCompositionElement.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ComposablePart.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ComposablePart.cs deleted file mode 100644 index 3b74eecc307..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ComposablePart.cs +++ /dev/null @@ -1,210 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-
-namespace System.ComponentModel.Composition.Primitives
-{
- /// <summary>
- /// Defines the <see langword="abstract"/> base class for composable parts, which
- /// import and produce exported values.
- /// </summary>
- public abstract class ComposablePart
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ComposablePart"/> class.
- /// </summary>
- protected ComposablePart()
- {
- }
-
- /// <summary>
- /// Gets the export definitions that describe the exported values provided by the part.
- /// </summary>
- /// <value>
- /// An <see cref="IEnumerable{T}"/> of <see cref="ExportDefinition"/> objects describing
- /// the exported values provided by the <see cref="ComposablePart"/>.
- /// </value>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="ComposablePart"/> has been disposed of.
- /// </exception>
- /// <remarks>
- /// <para>
- /// <note type="inheritinfo">
- /// If the <see cref="ComposablePart"/> was created from a
- /// <see cref="ComposablePartDefinition"/>, this property should return the result of
- /// <see cref="ComposablePartDefinition.ExportDefinitions"/>.
- /// </note>
- /// </para>
- /// <para>
- /// <note type="inheritinfo">
- /// Overriders of this property should never return <see langword="null"/>.
- /// If the <see cref="ComposablePart"/> does not have exports, return an empty
- /// <see cref="IEnumerable{T}"/> instead.
- /// </note>
- /// </para>
- /// </remarks>
- public abstract IEnumerable<ExportDefinition> ExportDefinitions { get; }
-
- /// <summary>
- /// Gets the import definitions that describe the imports required by the part.
- /// </summary>
- /// <value>
- /// An <see cref="IEnumerable{T}"/> of <see cref="ImportDefinition"/> objects describing
- /// the imports required by the <see cref="ComposablePart"/>.
- /// </value>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="ComposablePart"/> has been disposed of.
- /// </exception>
- /// <remarks>
- /// <para>
- /// <note type="inheritinfo">
- /// If the <see cref="ComposablePart"/> was created from a
- /// <see cref="ComposablePartDefinition"/>, this property should return the result of
- /// <see cref="ComposablePartDefinition.ImportDefinitions"/>.
- /// </note>
- /// </para>
- /// <para>
- /// <note type="inheritinfo">
- /// Overrides of this property should never return <see langword="null"/>.
- /// If the <see cref="ComposablePart"/> does not have imports, return an empty
- /// <see cref="IEnumerable{T}"/> instead.
- /// </note>
- /// </para>
- /// </remarks>
- public abstract IEnumerable<ImportDefinition> ImportDefinitions { get; }
-
- /// <summary>
- /// Gets the metadata of the part.
- /// </summary>
- /// <value>
- /// An <see cref="IDictionary{TKey, TValue}"/> containing the metadata of the
- /// <see cref="ComposablePart"/>. The default is an empty, read-only
- /// <see cref="IDictionary{TKey, TValue}"/>.
- /// </value>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="ComposablePart"/> has been disposed of.
- /// </exception>
- /// <remarks>
- /// <para>
- /// <note type="inheritinfo">
- /// If the <see cref="ComposablePart"/> was created from a
- /// <see cref="ComposablePartDefinition"/>, this property should return the result of
- /// <see cref="ComposablePartDefinition.Metadata"/>.
- /// </note>
- /// </para>
- /// <para>
- /// <note type="inheritinfo">
- /// Overriders of this property should return a read-only
- /// <see cref="IDictionary{TKey, TValue}"/> object with a case-sensitive,
- /// non-linguistic comparer, such as <see cref="StringComparer.Ordinal"/>,
- /// and should never return <see langword="null"/>. If the
- /// <see cref="ComposablePart"/> does not contain metadata, return an
- /// empty <see cref="IDictionary{TKey, TValue}"/> instead.
- /// </note>
- /// </para>
- /// </remarks>
- public virtual IDictionary<string, object> Metadata
- {
- get
- {
- return MetadataServices.EmptyMetadata;
- }
- }
-
- /// <summary>
- /// Called by the composition engine when all required imports on the part have been
- /// satisfied.
- /// </summary>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="ComposablePart"/> has been disposed of.
- /// </exception>
- /// <exception cref="ComposablePartException">
- /// An error occurred activating the <see cref="ComposablePart"/>.
- /// </exception>
- public virtual void Activate()
- {
- }
-
- /// <summary>
- /// Gets the exported value described by the specified definition.
- /// </summary>
- /// <param name="definition">
- /// One of the <see cref="ExportDefinition"/> objects from the
- /// <see cref="ExportDefinitions"/> property describing the exported value
- /// to return.
- /// </param>
- /// <returns>
- /// The exported value described by <paramref name="definition"/>.
- /// </returns>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="definition"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ArgumentException">
- /// <paramref name="definition"/> did not originate from the <see cref="ExportDefinitions"/>
- /// property on the <see cref="ComposablePart"/>.
- /// </exception>
- /// <exception cref="InvalidOperationException">
- /// One or more pre-requisite imports, indicated by <see cref="ImportDefinition.IsPrerequisite"/>,
- /// have not been set.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="ComposablePart"/> has been disposed of.
- /// </exception>
- /// <exception cref="ComposablePartException">
- /// An error occurred getting the exported value described by the <see cref="ExportDefinition"/>.
- /// </exception>
- public abstract object GetExportedValue(ExportDefinition definition);
-
- /// <summary>
- /// Sets the import described by the specified definition with the specified exports.
- /// </summary>
- /// <param name="definition">
- /// One of the <see cref="ImportDefinition"/> objects from the
- /// <see cref="ImportDefinitions"/> property describing the import to be set.
- /// </param>
- /// <param name="exports">
- /// An <see cref="IEnumerable{T}"/> of <see cref="Export"/> objects of which
- /// to set the import described by <paramref name="definition"/>.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="definition"/> is <see langword="null"/>.
- /// <para>
- /// -or-
- /// </para>
- /// <paramref name="exports"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ArgumentException">
- /// <paramref name="definition"/> did not originate from the <see cref="ImportDefinitions"/>
- /// property on the <see cref="ComposablePart"/>.
- /// <para>
- /// -or-
- /// </para>
- /// <paramref name="exports"/> contains an element that is <see langword="null"/>.
- /// <para>
- /// -or-
- /// </para>
- /// <paramref name="exports"/> is empty and <see cref="ImportDefinition.Cardinality"/> is
- /// <see cref="ImportCardinality.ExactlyOne"/>.
- /// <para>
- /// -or-
- /// </para>
- /// <paramref name="exports"/> contains more than one element and
- /// <see cref="ImportDefinition.Cardinality"/> is <see cref="ImportCardinality.ZeroOrOne"/> or
- /// <see cref="ImportCardinality.ExactlyOne"/>.
- /// </exception>
- /// <exception cref="InvalidOperationException">
- /// <see cref="Activate"/> has been previously called and
- /// <see cref="ImportDefinition.IsRecomposable"/> is <see langword="false"/>.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="ComposablePart"/> has been disposed of.
- /// </exception>
- /// <exception cref="ComposablePartException">
- /// An error occurred setting the import described by the <see cref="ImportDefinition"/>.
- /// </exception>
- public abstract void SetImport(ImportDefinition definition, IEnumerable<Export> exports);
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ComposablePartCatalog.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ComposablePartCatalog.cs deleted file mode 100644 index 22fe9a20ff4..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ComposablePartCatalog.cs +++ /dev/null @@ -1,129 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.Diagnostics;
-using System.Diagnostics.CodeAnalysis;
-using System.Linq;
-using System.Linq.Expressions;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.Primitives
-{
- /// <summary>
- /// Defines the <see langword="abstract"/> base class for composable part catalogs, which produce
- /// and return <see cref="ComposablePartDefinition"/> objects.
- /// </summary>
- /// <remarks>
- /// This type is thread safe.
- /// </remarks>
- [DebuggerTypeProxy(typeof(ComposablePartCatalogDebuggerProxy))]
- public abstract class ComposablePartCatalog : IDisposable
- {
- private bool _isDisposed;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComposablePartCatalog"/> class.
- /// </summary>
- protected ComposablePartCatalog()
- {
- }
-
- /// <summary>
- /// Gets the part definitions of the catalog.
- /// </summary>
- /// <value>
- /// A <see cref="IQueryable{T}"/> of <see cref="ComposablePartDefinition"/> objects of the
- /// <see cref="ComposablePartCatalog"/>.
- /// </value>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="ComposablePartCatalog"/> has been disposed of.
- /// </exception>
- /// <remarks>
- /// <note type="inheritinfo">
- /// Overriders of this property should never return <see langword="null"/>.
- /// </note>
- /// </remarks>
- public abstract IQueryable<ComposablePartDefinition> Parts
- {
- get;
- }
-
- /// <summary>
- /// Returns the export definitions that match the constraint defined by the specified definition.
- /// </summary>
- /// <param name="definition">
- /// The <see cref="ImportDefinition"/> that defines the conditions of the
- /// <see cref="ExportDefinition"/> objects to return.
- /// </param>
- /// <returns>
- /// An <see cref="IEnumerable{T}"/> of <see cref="Tuple{T1, T2}"/> containing the
- /// <see cref="ExportDefinition"/> objects and their associated
- /// <see cref="ComposablePartDefinition"/> for objects that match the constraint defined
- /// by <paramref name="definition"/>.
- /// </returns>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="definition"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="ComposablePartCatalog"/> has been disposed of.
- /// </exception>
- /// <remarks>
- /// <note type="inheritinfo">
- /// Overriders of this property should never return <see langword="null"/>, if no
- /// <see cref="ExportDefinition"/> match the conditions defined by
- /// <paramref name="definition"/>, return an empty <see cref="IEnumerable{T}"/>.
- /// </note>
- /// </remarks>
- [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
- public virtual IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>> GetExports(ImportDefinition definition)
- {
- this.ThrowIfDisposed();
-
- Requires.NotNull(definition, "definition");
-
- var exports = new List<Tuple<ComposablePartDefinition, ExportDefinition>>();
- foreach (var part in this.Parts)
- {
- foreach (var export in part.ExportDefinitions)
- {
- if (definition.IsConstraintSatisfiedBy(export))
- {
- exports.Add(new Tuple<ComposablePartDefinition, ExportDefinition>(part, export));
- }
- }
- }
- return exports;
-
- }
-
- /// <summary>
- /// Releases the unmanaged resources used by the <see cref="ComposablePartCatalog"/> and
- /// optionally releases the managed resources.
- /// </summary>
- /// <param name="disposing">
- /// <see langword="true"/> to release both managed and unmanaged resources;
- /// <see langword="false"/> to release only unmanaged resources.
- /// </param>
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- this._isDisposed = true;
- }
-
- private void ThrowIfDisposed()
- {
- if (this._isDisposed)
- {
- throw ExceptionBuilder.CreateObjectDisposed(this);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ComposablePartCatalogDebuggerProxy.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ComposablePartCatalogDebuggerProxy.cs deleted file mode 100644 index 3d5f72af59b..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ComposablePartCatalogDebuggerProxy.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.ObjectModel;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-
-namespace System.ComponentModel.Composition.Primitives
-{
- // This proxy is needed to pretty up ComposablePartCatalog.Parts; IQueryable<T>
- // instances are not displayed in a very friendly way in the debugger.
- internal class ComposablePartCatalogDebuggerProxy
- {
- private readonly ComposablePartCatalog _catalog;
-
- public ComposablePartCatalogDebuggerProxy(ComposablePartCatalog catalog)
- {
- Requires.NotNull(catalog, "catalog");
-
- this._catalog = catalog;
- }
-
- public ReadOnlyCollection<ComposablePartDefinition> Parts
- {
- // NOTE: This shouldn't be cached, so that on every query of
- // the current value of the underlying catalog is respected.
- // We use ReadOnlyCollection as arrays do not have the
- // appropriate debugger display attributes applied to them.
- get { return this._catalog.Parts.ToReadOnlyCollection(); }
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ComposablePartDefinition.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ComposablePartDefinition.cs deleted file mode 100644 index 979022a4f82..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ComposablePartDefinition.cs +++ /dev/null @@ -1,102 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-
-namespace System.ComponentModel.Composition.Primitives
-{
- /// <summary>
- /// Defines the <see langword="abstract"/> base class for composable part definitions, which
- /// describe, and allow the creation of, <see cref="ComposablePart"/> objects.
- /// </summary>
- public abstract class ComposablePartDefinition
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ComposablePartDefinition"/> class.
- /// </summary>
- protected ComposablePartDefinition()
- {
- }
-
- /// <summary>
- /// Gets the export definitions that describe the exported values provided by parts
- /// created by the definition.
- /// </summary>
- /// <value>
- /// An <see cref="IEnumerable{T}"/> of <see cref="ExportDefinition"/> objects describing
- /// the exported values provided by <see cref="ComposablePart"/> objects created by the
- /// <see cref="ComposablePartDefinition"/>.
- /// </value>
- /// <remarks>
- /// <note type="inheritinfo">
- /// Overrides of this property should never return <see langword="null"/>.
- /// If the <see cref="ComposablePart"/> objects created by the
- /// <see cref="ComposablePartDefinition"/> do not provide exported values, return
- /// an empty <see cref="IEnumerable{T}"/> instead.
- /// </note>
- /// </remarks>
- public abstract IEnumerable<ExportDefinition> ExportDefinitions { get; }
-
- /// <summary>
- /// Gets the import definitions that describe the imports required by parts created
- /// by the definition.
- /// </summary>
- /// <value>
- /// An <see cref="IEnumerable{T}"/> of <see cref="ImportDefinition"/> objects describing
- /// the imports required by <see cref="ComposablePart"/> objects created by the
- /// <see cref="ComposablePartDefinition"/>.
- /// </value>
- /// <remarks>
- /// <note type="inheritinfo">
- /// Overriders of this property should never return <see langword="null"/>.
- /// If the <see cref="ComposablePart"/> objects created by the
- /// <see cref="ComposablePartDefinition"/> do not have imports, return an empty
- /// <see cref="IEnumerable{T}"/> instead.
- /// </note>
- /// </remarks>
- public abstract IEnumerable<ImportDefinition> ImportDefinitions { get; }
-
- /// <summary>
- /// Gets the metadata of the definition.
- /// </summary>
- /// <value>
- /// An <see cref="IDictionary{TKey, TValue}"/> containing the metadata of the
- /// <see cref="ComposablePartDefinition"/>. The default is an empty, read-only
- /// <see cref="IDictionary{TKey, TValue}"/>.
- /// </value>
- /// <remarks>
- /// <para>
- /// <note type="inheritinfo">
- /// Overriders of this property should return a read-only
- /// <see cref="IDictionary{TKey, TValue}"/> object with a case-sensitive,
- /// non-linguistic comparer, such as <see cref="StringComparer.Ordinal"/>,
- /// and should never return <see langword="null"/>. If the
- /// <see cref="ComposablePartDefinition"/> does contain metadata,
- /// return an empty <see cref="IDictionary{TKey, TValue}"/> instead.
- /// </note>
- /// </para>
- /// </remarks>
- public virtual IDictionary<string, object> Metadata
- {
- get { return MetadataServices.EmptyMetadata; }
- }
-
- /// <summary>
- /// Creates a new instance of a part that the definition describes.
- /// </summary>
- /// <returns>
- /// The created <see cref="ComposablePart"/>.
- /// </returns>
- /// <remarks>
- /// <para>
- /// <note type="inheritinfo">
- /// Derived types overriding this method should return a new instance of a
- /// <see cref="ComposablePart"/> on every invoke and should never return
- /// <see langword="null"/>.
- /// </note>
- /// </para>
- /// </remarks>
- public abstract ComposablePart CreatePart();
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ComposablePartException.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ComposablePartException.cs deleted file mode 100644 index 2f05593f13a..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ComposablePartException.cs +++ /dev/null @@ -1,214 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Hosting;
-using System.Runtime.Serialization;
-using System.Security.Permissions;
-using Microsoft.Internal;
-
-#if !SILVERLIGHT
-using Microsoft.Internal.Runtime.Serialization;
-#endif
-
-namespace System.ComponentModel.Composition.Primitives
-{
- /// <summary>
- /// The exception that is thrown when an error occurs when calling methods on a
- /// <see cref="ComposablePart"/>.
- /// </summary>
- [Serializable]
- public class ComposablePartException : Exception, ICompositionError
- {
- private readonly CompositionErrorId _id;
- private readonly ICompositionElement _element;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComposablePartException"/> class.
- /// </summary>
- public ComposablePartException()
- : this(CompositionErrorId.Unknown, (string)null, (ICompositionElement)null, (Exception)null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComposablePartException"/> class
- /// with the specified error message.
- /// </summary>
- /// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
- /// <see cref="ComposablePartException"/>; or <see langword="null"/> to set
- /// the <see cref="Exception.Message"/> property to its default value.
- /// </param>
- /// <param name="element">
- /// The <see cref="ICompositionElement"/> that is the cause of the
- /// <see cref="ComposablePartException"/>; or <see langword="null"/> to set
- /// the <see cref="ComposablePartException.Element"/> property to
- /// <see langword="null"/>.
- /// </param>
- public ComposablePartException(string message)
- : this(CompositionErrorId.Unknown, message, (ICompositionElement)null, (Exception)null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComposablePartException"/> class
- /// with the specified error message and composition element that is the cause of
- /// the exception.
- /// </summary>
- /// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
- /// <see cref="ComposablePartException"/>; or <see langword="null"/> to set
- /// the <see cref="Exception.Message"/> property to its default value.
- /// </param>
- public ComposablePartException(string message, ICompositionElement element)
- : this(CompositionErrorId.Unknown, message, element, (Exception)null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComposablePartException"/> class
- /// with the specified error message and exception that is the cause of the
- /// exception.
- /// </summary>
- /// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
- /// <see cref="ComposablePartException"/>; or <see langword="null"/> to set
- /// the <see cref="Exception.Message"/> property to its default value.
- /// </param>
- /// <param name="innerException">
- /// The <see cref="Exception"/> that is the underlying cause of the
- /// <see cref="ComposablePartException"/>; or <see langword="null"/> to set
- /// the <see cref="Exception.InnerException"/> property to <see langword="null"/>.
- /// </param>
- public ComposablePartException(string message, Exception innerException)
- : this(CompositionErrorId.Unknown, message, (ICompositionElement)null, innerException)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComposablePartException"/> class
- /// with the specified error message, and composition element and exception that
- /// are the cause of the exception.
- /// </summary>
- /// <param name="message">
- /// A <see cref="String"/> containing a message that describes the
- /// <see cref="ComposablePartException"/>; or <see langword="null"/> to set
- /// the <see cref="Exception.Message"/> property to its default value.
- /// </param>
- /// <param name="element">
- /// The <see cref="ICompositionElement"/> that is the cause of the
- /// <see cref="ComposablePartException"/>; or <see langword="null"/> to set
- /// the <see cref="ComposablePartException.Element"/> property to
- /// <see langword="null"/>.
- /// </param>
- /// <param name="innerException">
- /// The <see cref="Exception"/> that is the underlying cause of the
- /// <see cref="ComposablePartException"/>; or <see langword="null"/> to set
- /// the <see cref="Exception.InnerException"/> property to <see langword="null"/>.
- /// </param>
- public ComposablePartException(string message, ICompositionElement element, Exception innerException)
- : this(CompositionErrorId.Unknown, message, element, innerException)
- {
- }
-
- internal ComposablePartException(CompositionErrorId id, string message)
- : this(id, message, (ICompositionElement)null, (Exception)null)
- {
- }
-
- internal ComposablePartException(CompositionErrorId id, string message, Exception exception)
- : this(id, message, (ICompositionElement)null, exception)
- {
- }
-
- internal ComposablePartException(CompositionErrorId id, string message, ICompositionElement element)
- : this(id, message, (ICompositionElement)element, (Exception)null)
- {
- }
-
- internal ComposablePartException(CompositionErrorId id, string message, ICompositionElement element, Exception innerException)
- : base(message, innerException)
- {
- _id = id;
- _element = element;
- }
-
-#if !SILVERLIGHT
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComposablePartException"/> class
- /// with the specified serialization data.
- /// </summary>
- /// <param name="info">
- /// The <see cref="SerializationInfo"/> that holds the serialized object data about the
- /// <see cref="ComposablePartException"/>.
- /// </param>
- /// <param name="context">
- /// The <see cref="StreamingContext"/> that contains contextual information about the
- /// source or destination.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="info"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="SerializationException">
- /// <paramref name="info"/> is missing a required value.
- /// </exception>
- /// <exception cref="InvalidCastException">
- /// <paramref name="info"/> contains a value that cannot be cast to the correct type.
- /// </exception>
- [System.Security.SecuritySafeCritical]
- protected ComposablePartException(SerializationInfo info, StreamingContext context)
- : base(info, context)
- {
- _id = info.GetValue<CompositionErrorId>("Id");
- _element = info.GetValue<ICompositionElement>("Element");
- }
-
-#endif
-
- /// <summary>
- /// Gets the composition element that is the cause of the exception.
- /// </summary>
- /// <value>
- /// The <see cref="ICompositionElement"/> that is the cause of the
- /// <see cref="ComposablePartException"/>. The default is <see langword="null"/>.
- /// </value>
- public ICompositionElement Element
- {
- get { return _element; }
- }
-
- CompositionErrorId ICompositionError.Id
- {
- get { return _id; }
- }
-
-#if !SILVERLIGHT
-
- /// <summary>
- /// Gets the serialization data of the exception.
- /// </summary>
- /// <param name="info">
- /// The <see cref="SerializationInfo"/> that holds the serialized object data about the
- /// <see cref="ComposablePartException"/>.
- /// </param>
- /// <param name="context">
- /// The <see cref="StreamingContext"/> that contains contextual information about the
- /// source or destination.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="info"/> is <see langword="null"/>.
- /// </exception>
- [System.Security.SecurityCritical]
- public override void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- base.GetObjectData(info, context);
-
- info.AddValue("Id", _id);
- info.AddValue("Element", _element.ToSerializableElement());
- }
-
-#endif
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/CompositionElement.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/CompositionElement.cs deleted file mode 100644 index 4cb34de38d7..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/CompositionElement.cs +++ /dev/null @@ -1,30 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Diagnostics;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.Primitives
-{
- // Represents the ICompositionElement placeholder for an
- // object that does not implement ICompositionElement
- [DebuggerTypeProxy(typeof(CompositionElementDebuggerProxy))]
- [Serializable]
- internal class CompositionElement : SerializableCompositionElement
- {
- private static readonly ICompositionElement UnknownOrigin = new SerializableCompositionElement(Strings.CompositionElement_UnknownOrigin, (ICompositionElement)null);
- private readonly object _underlyingObject;
-
- public CompositionElement(object underlyingObject)
- : base(underlyingObject.ToString(), UnknownOrigin)
- {
- this._underlyingObject = underlyingObject;
- }
-
- public object UnderlyingObject
- {
- get { return _underlyingObject; }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/CompositionElementDebuggerProxy.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/CompositionElementDebuggerProxy.cs deleted file mode 100644 index 9a12a7d99f3..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/CompositionElementDebuggerProxy.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.Primitives
-{
- // Because the debugger displays only the members available on ICompositionElement
- // when viewing CompositionError.Element in the watch and data tips windows, we
- // need this proxy so that the underlying object wrapped by the CompositionElement
- // placeholder is displayed by default.
- internal class CompositionElementDebuggerProxy
- {
- private readonly CompositionElement _element;
-
- public CompositionElementDebuggerProxy(CompositionElement element)
- {
- Requires.NotNull(element, "element");
-
- this._element = element;
- }
-
- public string DisplayName
- {
- get { return this._element.DisplayName; }
- }
-
- public ICompositionElement Origin
- {
- get { return this._element.Origin; }
- }
-
- public object UnderlyingObject
- {
- get { return this._element.UnderlyingObject; }
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/CompositionElementExtensions.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/CompositionElementExtensions.cs deleted file mode 100644 index 62fe9678d3e..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/CompositionElementExtensions.cs +++ /dev/null @@ -1,82 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.Primitives
-{
- internal static class CompositionElementExtensions
- {
-#if !SILVERLIGHT
- public static ICompositionElement ToSerializableElement(this ICompositionElement element)
- {
- return SerializableCompositionElement.FromICompositionElement(element);
- }
-#endif
- public static ICompositionElement ToElement(this Export export)
- {
- // First try the export
- ICompositionElement element = export as ICompositionElement;
- if (element != null)
- {
- return element;
- }
-
- // Otherwise, try the definition
- return ToElement(export.Definition);
- }
-
- public static ICompositionElement ToElement(this ExportDefinition definition)
- {
- return ToElementCore(definition);
- }
-
- public static ICompositionElement ToElement(this ImportDefinition definition)
- {
- return ToElementCore(definition);
- }
-
- public static ICompositionElement ToElement(this ComposablePart part)
- {
- return ToElementCore(part);
- }
-
- public static ICompositionElement ToElement(this ComposablePartDefinition definition)
- {
- return ToElementCore(definition);
- }
-
- public static string GetDisplayName(this ComposablePartDefinition definition)
- {
- return GetDisplayNameCore(definition);
- }
-
- public static string GetDisplayName(this ComposablePartCatalog catalog)
- {
- return GetDisplayNameCore(catalog);
- }
-
- private static string GetDisplayNameCore(object value)
- {
- ICompositionElement element = value as ICompositionElement;
- if (element != null)
- {
- return element.DisplayName;
- }
-
- return value.ToString();
- }
-
- private static ICompositionElement ToElementCore(object value)
- {
- ICompositionElement element = value as ICompositionElement;
- if (element != null)
- {
- return element;
- }
-
- return new CompositionElement(value);
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ContractBasedImportDefinition.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ContractBasedImportDefinition.cs deleted file mode 100644 index 010fad17899..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ContractBasedImportDefinition.cs +++ /dev/null @@ -1,309 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.Diagnostics.CodeAnalysis;
-using System.Linq;
-using System.Linq.Expressions;
-using Microsoft.Internal;
-using System.Globalization;
-
-namespace System.ComponentModel.Composition.Primitives
-{
- /// <summary>
- /// Represents a contract name and metadata-based import
- /// required by a <see cref="ComposablePart"/> object.
- /// </summary>
- public class ContractBasedImportDefinition : ImportDefinition
- {
- // Unlike contract name, required metadata has a sensible default; set it to an empty
- // enumerable, so that derived definitions only need to override ContractName by default.
- private readonly IEnumerable<KeyValuePair<string, Type>> _requiredMetadata = Enumerable.Empty<KeyValuePair<string, Type>>();
- private Expression<Func<ExportDefinition, bool>> _constraint;
- private readonly CreationPolicy _requiredCreationPolicy = CreationPolicy.Any;
- private readonly string _requiredTypeIdentity = null;
- private bool _isRequiredMetadataValidated = false;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ContractBasedImportDefinition"/> class.
- /// </summary>
- /// <remarks>
- /// <note type="inheritinfo">
- /// Derived types calling this constructor can optionally override the
- /// <see cref="ImportDefinition.ContractName"/>, <see cref="RequiredTypeIdentity"/>,
- /// <see cref="RequiredMetadata"/>, <see cref="ImportDefinition.Cardinality"/>,
- /// <see cref="ImportDefinition.IsPrerequisite"/>, <see cref="ImportDefinition.IsRecomposable"/>
- /// and <see cref="RequiredCreationPolicy"/> properties.
- /// </note>
- /// </remarks>
- protected ContractBasedImportDefinition()
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ContractBasedImportDefinition"/> class
- /// with the specified contract name, required metadataq, cardinality, value indicating
- /// if the import definition is recomposable and a value indicating if the import definition
- /// is a prerequisite.
- /// </summary>
- /// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the
- /// <see cref="Export"/> required by the <see cref="ContractBasedImportDefinition"/>.
- /// </param>
- /// <param name="requiredTypeIdentity">
- /// The type identity of the export type expected. Use <see cref="AttributedModelServices.GetTypeIdentity(Type)"/>
- /// to generate a type identity for a given type. If no specific type is required pass <see langword="null"/>.
- /// </param>
- /// <param name="requiredMetadata">
- /// An <see cref="IEnumerable{T}"/> of <see cref="String"/> objects containing
- /// the metadata names of the <see cref="Export"/> required by the
- /// <see cref="ContractBasedImportDefinition"/>; or <see langword="null"/> to
- /// set the <see cref="RequiredMetadata"/> property to an empty <see cref="IEnumerable{T}"/>.
- /// </param>
- /// <param name="cardinality">
- /// One of the <see cref="ImportCardinality"/> values indicating the
- /// cardinality of the <see cref="Export"/> objects required by the
- /// <see cref="ContractBasedImportDefinition"/>.
- /// </param>
- /// <param name="isRecomposable">
- /// <see langword="true"/> if the <see cref="ContractBasedImportDefinition"/> can be satisfied
- /// multiple times throughout the lifetime of a <see cref="ComposablePart"/>, otherwise,
- /// <see langword="false"/>.
- /// </param>
- /// <param name="isPrerequisite">
- /// <see langword="true"/> if the <see cref="ContractBasedImportDefinition"/> is required to be
- /// satisfied before a <see cref="ComposablePart"/> can start producing exported
- /// objects; otherwise, <see langword="false"/>.
- /// </param>
- /// <param name="requiredCreationPolicy">
- /// A value indicating that the importer requires a specific <see cref="CreationPolicy"/> for
- /// the exports used to satisfy this import. If no specific <see cref="CreationPolicy"/> is needed
- /// pass the default <see cref="CreationPolicy.Any"/>.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="contractName"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ArgumentException">
- /// <paramref name="contractName"/> is an empty string ("").
- /// <para>
- /// -or-
- /// </para>
- /// <paramref name="requiredMetadata"/> contains an element that is <see langword="null"/>.
- /// <para>
- /// -or-
- /// </para>
- /// <paramref name="cardinality"/> is not one of the <see cref="ImportCardinality"/>
- /// values.
- /// </exception>
- [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
- public ContractBasedImportDefinition(string contractName, string requiredTypeIdentity, IEnumerable<KeyValuePair<string, Type>> requiredMetadata,
- ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite, CreationPolicy requiredCreationPolicy)
- : base(contractName, cardinality, isRecomposable, isPrerequisite)
- {
- Requires.NotNullOrEmpty(contractName, "contractName");
-
- this._requiredTypeIdentity = requiredTypeIdentity;
-
- if (requiredMetadata != null)
- {
- this._requiredMetadata = requiredMetadata;
- }
-
- this._requiredCreationPolicy = requiredCreationPolicy;
- }
-
- /// <summary>
- /// The type identity of the export type expected.
- /// </summary>
- /// <value>
- /// A <see cref="string"/> that is generated by <see cref="AttributedModelServices.GetTypeIdentity(Type)"/>
- /// on the type that this import expects. If the value is <see langword="null"/> then this import
- /// doesn't expect a particular type.
- /// </value>
- public virtual string RequiredTypeIdentity
- {
- get { return this._requiredTypeIdentity; }
- }
-
- /// <summary>
- /// Gets the metadata names of the export required by the import definition.
- /// </summary>
- /// <value>
- /// An <see cref="IEnumerable{T}"/> of pairs of metadata keys and types of the <see cref="Export"/> required by the
- /// <see cref="ContractBasedImportDefinition"/>. The default is an empty
- /// <see cref="IEnumerable{T}"/>.
- /// </value>
- /// <remarks>
- /// <note type="inheritinfo">
- /// Overriders of this property should never return <see langword="null"/>
- /// or return an <see cref="IEnumerable{T}"/> that contains an element that is
- /// <see langword="null"/>. If the definition does not contain required metadata,
- /// return an empty <see cref="IEnumerable{T}"/> instead.
- /// </note>
- /// </remarks>
- [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
- public virtual IEnumerable<KeyValuePair<string, Type>> RequiredMetadata
- {
- get
- {
- // NOTE : unlike other arguments, we validate this one as late as possible, because its validation may lead to type loading
- this.ValidateRequiredMetadata();
-
- return this._requiredMetadata;
- }
- }
-
- private void ValidateRequiredMetadata()
- {
- if (!this._isRequiredMetadataValidated)
- {
- foreach (KeyValuePair<string, Type> metadataItem in this._requiredMetadata)
- {
- if ((metadataItem.Key == null) || (metadataItem.Value == null))
- {
- throw new InvalidOperationException(
- string.Format(CultureInfo.CurrentCulture, Strings.Argument_NullElement, "requiredMetadata"));
- }
- }
- this._isRequiredMetadataValidated = true;
- }
- }
-
- /// <summary>
- /// Gets or sets a value indicating that the importer requires a specific
- /// <see cref="CreationPolicy"/> for the exports used to satisfy this import. T
- /// </summary>
- /// <value>
- /// <see cref="CreationPolicy.Any"/> - default value, used if the importer doesn't
- /// require a specific <see cref="CreationPolicy"/>.
- ///
- /// <see cref="CreationPolicy.Shared"/> - Requires that all exports used should be shared
- /// by everyone in the container.
- ///
- /// <see cref="CreationPolicy.NonShared"/> - Requires that all exports used should be
- /// non-shared in a container and thus everyone gets their own instance.
- /// </value>
- public virtual CreationPolicy RequiredCreationPolicy
- {
- get { return this._requiredCreationPolicy; }
- }
-
- /// <summary>
- /// Gets an expression that defines conditions that must be matched for the import
- /// described by the import definition to be satisfied.
- /// </summary>
- /// <returns>
- /// A <see cref="Expression{TDelegate}"/> containing a <see cref="Func{T, TResult}"/>
- /// that defines the conditions that must be matched for the
- /// <see cref="ImportDefinition"/> to be satisfied by an <see cref="Export"/>.
- /// </returns>
- /// <remarks>
- /// <para>
- /// This property returns an expression that defines conditions based on the
- /// <see cref="ImportDefinition.ContractName"/>, <see cref="RequiredTypeIdentity"/>,
- /// <see cref="RequiredMetadata"/>, and <see cref="RequiredCreationPolicy"/>
- /// properties.
- /// </para>
- /// </remarks>
- public override Expression<Func<ExportDefinition, bool>> Constraint
- {
- get
- {
- if (this._constraint == null)
- {
- this._constraint = ConstraintServices.CreateConstraint(this.ContractName, this.RequiredTypeIdentity, this.RequiredMetadata, this.RequiredCreationPolicy);
- }
-
- return this._constraint;
- }
- }
-
- /// <summary>
- /// Executes an optimized version of the contraint given by the <see cref="Constraint"/> property
- /// </summary>
- /// <param name="exportDefinition">
- /// A definition for a <see cref="Export"/> used to determine if it satisfies the
- /// requirements for this <see cref="ImportDefinition"/>.
- /// </param>
- /// <returns>
- /// <see langword="True"/> if the <see cref="Export"/> satisfies the requirements for
- /// this <see cref="ImportDefinition"/>, otherwise returns <see langword="False"/>.
- /// </returns>
- /// <remarks>
- /// <note type="inheritinfo">
- /// Overrides of this method can provide a more optimized execution of the
- /// <see cref="Constraint"/> property but the result should remain consistent.
- /// </note>
- /// </remarks>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="exportDefinition"/> is <see langword="null"/>.
- /// </exception>
- public override bool IsConstraintSatisfiedBy(ExportDefinition exportDefinition)
- {
- Requires.NotNull(exportDefinition, "exportDefinition");
-
- if (!StringComparers.ContractName.Equals(this.ContractName, exportDefinition.ContractName))
- {
- return false;
- }
-
- return MatchRequiredMatadata(exportDefinition);
- }
-
- private bool MatchRequiredMatadata(ExportDefinition definition)
- {
- if (!string.IsNullOrEmpty(this.RequiredTypeIdentity))
- {
- string exportTypeIdentity = definition.Metadata.GetValue<string>(CompositionConstants.ExportTypeIdentityMetadataName);
-
- if (!StringComparers.ContractName.Equals(this.RequiredTypeIdentity, exportTypeIdentity))
- {
- return false;
- }
- }
-
- foreach (KeyValuePair<string, Type> metadataItem in this.RequiredMetadata)
- {
- string metadataKey = metadataItem.Key;
- Type metadataValueType = metadataItem.Value;
-
- object metadataValue = null;
- if (!definition.Metadata.TryGetValue(metadataKey, out metadataValue))
- {
- return false;
- }
-
- if (metadataValue != null)
- {
- // the metadata value is not null, we can rely on IsInstanceOfType to do the right thing
- if (!metadataValueType.IsInstanceOfType(metadataValue))
- {
- return false;
- }
- }
- else
- {
- // this is an unfortunate special case - typeof(object).IsInstanceofType(null) == false
- // basically nulls are not considered valid values for anything
- // We want them to match anything that is a reference type
- if (metadataValueType.IsValueType)
- {
- // this is a pretty expensive check, but we only invoke it when metadata values are null, which is very rare
- return false;
- }
- }
- }
-
- if (this.RequiredCreationPolicy == CreationPolicy.Any)
- {
- return true;
- }
-
- CreationPolicy exportPolicy = definition.Metadata.GetValue<CreationPolicy>(CompositionConstants.PartCreationPolicyMetadataName);
- return exportPolicy == CreationPolicy.Any ||
- exportPolicy == this.RequiredCreationPolicy;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/Export.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/Export.cs deleted file mode 100644 index 8beaa09b907..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/Export.cs +++ /dev/null @@ -1,245 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
-using Microsoft.Internal;
-using System.Threading;
-
-namespace System.ComponentModel.Composition.Primitives
-{
- /// <summary>
- /// Represents an export. That is, a type that is made up of a delay-created exported value
- /// and metadata that describes that object.
- /// </summary>
- public class Export
- {
- private readonly ExportDefinition _definition;
- private readonly Func<object> _exportedValueGetter;
- private static readonly object _EmptyValue = new object();
- private volatile object _exportedValue = Export._EmptyValue;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="Export"/> class.
- /// </summary>
- /// <remarks>
- /// <note type="inheritinfo">
- /// Derived types calling this constructor must override <see cref="Definition"/>
- /// and <see cref="GetExportedValueCore"/>.
- /// </note>
- /// </remarks>
- protected Export()
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="Export"/> class
- /// with the specified contract name and exported value getter.
- /// </summary>
- /// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the
- /// <see cref="Export"/>.
- /// </param>
- /// <param name="exportedValueGetter">
- /// A <see cref="Func{T}"/> that is called to create the exported value of the
- /// <see cref="Export"/>. This allows the creation of the object to be delayed
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="contractName"/> is <see langword="null"/>.
- /// <para>
- /// -or-
- /// </para>
- /// <paramref name="exportedValueGetter"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ArgumentException">
- /// <paramref name="contractName"/> is an empty string ("").
- /// </exception>
- public Export(string contractName, Func<object> exportedValueGetter)
- : this(new ExportDefinition(contractName, (IDictionary<string, object>)null), exportedValueGetter)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="Export"/> class
- /// with the specified contract name, metadata and exported value getter.
- /// </summary>
- /// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the
- /// <see cref="Export"/>.
- /// </param>
- /// <param name="metadata">
- /// An <see cref="IDictionary{TKey, TValue}"/> containing the metadata of the
- /// <see cref="Export"/>; or <see langword="null"/> to set the
- /// <see cref="Metadata"/> property to an empty, read-only
- /// <see cref="IDictionary{TKey, TValue}"/>.
- /// </param>
- /// <param name="exportedValueGetter">
- /// A <see cref="Func{T}"/> that is called to create the exported value of the
- /// <see cref="Export"/>. This allows the creation of the object to be delayed.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="contractName"/> is <see langword="null"/>.
- /// <para>
- /// -or-
- /// </para>
- /// <paramref name="exportedValueGetter"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ArgumentException">
- /// <paramref name="contractName"/> is an empty string ("").
- /// </exception>
- public Export(string contractName, IDictionary<string, object> metadata, Func<object> exportedValueGetter)
- : this(new ExportDefinition(contractName, metadata), exportedValueGetter)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="Export"/> class
- /// with the specified export definition and exported value getter.
- /// </summary>
- /// <param name="definition">
- /// An <see cref="ExportDefinition"/> that describes the contract that the
- /// <see cref="Export"/> satisfies.
- /// </param>
- /// <param name="exportedValueGetter">
- /// A <see cref="Func{T}"/> that is called to create the exported value of the
- /// <see cref="Export"/>. This allows the creation of the object to be delayed.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="definition"/> is <see langword="null"/>.
- /// <para>
- /// -or-
- /// </para>
- /// <paramref name="exportedValueGetter"/> is <see langword="null"/>.
- /// </exception>
- public Export(ExportDefinition definition, Func<object> exportedValueGetter)
- {
- Requires.NotNull(definition, "definition");
- Requires.NotNull(exportedValueGetter, "exportedValueGetter");
-
- this._definition = definition;
- this._exportedValueGetter = exportedValueGetter;
- }
-
- /// <summary>
- /// Gets the definition that describes the contract that the export satisfies.
- /// </summary>
- /// <value>
- /// An <see cref="ExportDefinition"/> that describes the contract that
- /// the <see cref="Export"/> satisfies.
- /// </value>
- /// <exception cref="NotImplementedException">
- /// This property was not overridden by a derived class.
- /// </exception>
- /// <remarks>
- /// <note type="inheritinfo">
- /// Overriders of this property should never return
- /// <see langword="null"/>.
- /// </note>
- /// </remarks>
- public virtual ExportDefinition Definition
- {
- get
- {
- if (_definition != null)
- {
- return _definition;
- }
-
- throw ExceptionBuilder.CreateNotOverriddenByDerived("Definition");
- }
- }
-
- /// <summary>
- /// Gets the metadata of the export.
- /// </summary>
- /// <value>
- /// An <see cref="IDictionary{TKey, TValue}"/> containing the metadata of the
- /// <see cref="Export"/>.
- /// </value>
- /// <exception cref="NotImplementedException">
- /// The <see cref="Definition"/> property was not overridden by a derived class.
- /// </exception>
- /// <remarks>
- /// <para>
- /// This property returns the value of <see cref="ExportDefinition.Metadata"/>
- /// of the <see cref="Definition"/> property.
- /// </para>
- /// </remarks>
- public IDictionary<string, object> Metadata
- {
- get { return Definition.Metadata; }
- }
-
- /// <summary>
- /// Returns the exported value of the export.
- /// </summary>
- /// <returns>
- /// The exported <see cref="Object"/> of the <see cref="Export"/>.
- /// </returns>
- /// <exception cref="CompositionException">
- /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
- /// contain a collection of errors that occurred.
- /// </exception>
- /// <exception cref="CompositionContractMismatchException">
- /// The current instance is an instance of <see cref="Lazy{T}"/> and the underlying
- /// exported value cannot be cast to <c>T</c>.
- /// </exception>
- /// <exception cref="NotImplementedException">
- /// The <see cref="GetExportedValueCore"/> method was not overridden by a derived class.
- /// </exception>
- public object Value
- {
- get
- {
- // NOTE : the logic below guarantees that the value will be set exactly once. It DOES NOT, however, guarantee that GetExportedValueCore() will be executed
- // more than once, as locking would be required for that. The said locking is problematic, as we can't reliable call 3rd party code under a lock.
- if (this._exportedValue == Export._EmptyValue)
- {
- object exportedValue = this.GetExportedValueCore();
-
- // NOTE : According to http://msdn.microsoft.com/en-us/library/4bw5ewxy.aspx, the warning is bogus when used with Interlocked API.
-#pragma warning disable 420
- Interlocked.CompareExchange(ref this._exportedValue, exportedValue, Export._EmptyValue);
-#pragma warning restore 420
- }
-
- return this._exportedValue;
- }
- }
-
- /// <summary>
- /// Returns the exported value of the export.
- /// </summary>
- /// <returns>
- /// The exported <see cref="Object"/> of the <see cref="Export"/>.
- /// </returns>
- /// <exception cref="CompositionException">
- /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
- /// contain a collection of errors that occurred.
- /// </exception>
- /// <exception cref="CompositionContractMismatchException">
- /// The current instance is an instance of <see cref="Lazy{T}"/> and the underlying
- /// exported value cannot be cast to <c>T</c>.
- /// </exception>
- /// <exception cref="NotImplementedException">
- /// The method was not overridden by a derived class.
- /// </exception>
- /// <remarks>
- /// <note type="inheritinfo">
- /// Overriders of this method should never return
- /// <see langword="null"/>.
- /// </note>
- /// </remarks>
- [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
- protected virtual object GetExportedValueCore()
- {
- if (this._exportedValueGetter != null)
- {
- return this._exportedValueGetter.Invoke();
- }
-
- throw ExceptionBuilder.CreateNotOverriddenByDerived("GetExportedValueCore");
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ExportDefinition.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ExportDefinition.cs deleted file mode 100644 index f4bf8291a7e..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ExportDefinition.cs +++ /dev/null @@ -1,131 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.Primitives
-{
- /// <summary>
- /// Describes the contract that an <see cref="Export"/> object satisfies.
- /// </summary>
- public class ExportDefinition
- {
- // Unlike contract name, metadata has a sensible default; set it to an empty bag,
- // so that derived definitions only need to override ContractName by default.
- private readonly IDictionary<string, object> _metadata = MetadataServices.EmptyMetadata;
- private readonly string _contractName;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ExportDefinition"/> class.
- /// </summary>
- /// <remarks>
- /// <note type="inheritinfo">
- /// Derived types calling this constructor must override <see cref="ContractName"/>
- /// and optionally, <see cref="Metadata"/>. By default, <see cref="Metadata"/>
- /// returns an empty, read-only dictionary.
- /// </note>
- /// </remarks>
- protected ExportDefinition()
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ExportDefinition"/> class with
- /// the specified contract name and metadata.
- /// </summary>
- /// <param name="contractName">
- /// A <see cref="String"/> containing the contract name of the
- /// <see cref="ExportDefinition"/>.
- /// </param>
- /// <param name="metadata">
- /// An <see cref="IDictionary{TKey, TValue}"/> containing the metadata of the
- /// <see cref="ExportDefinition"/>; or <see langword="null"/> to set the
- /// <see cref="Metadata"/> property to an empty, read-only
- /// <see cref="IDictionary{TKey, TValue}"/>.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="contractName"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ArgumentException">
- /// <paramref name="contractName"/> is an empty string ("").
- /// </exception>
- public ExportDefinition(string contractName, IDictionary<string, object> metadata)
- {
- Requires.NotNullOrEmpty(contractName, "contractName");
-
- _contractName = contractName;
-
- if (metadata != null)
- {
- _metadata = metadata.AsReadOnly();
- }
- }
-
- /// <summary>
- /// Gets the contract name of the export definition.
- /// </summary>
- /// <value>
- /// A <see cref="String"/> containing the contract name of the
- /// <see cref="ExportDefinition"/>.
- /// </value>
- /// <exception cref="NotImplementedException">
- /// The property was not overridden by a derived class.
- /// </exception>
- /// <remarks>
- /// <note type="inheritinfo">
- /// Overriders of this property should never return <see langword="null"/>
- /// or an empty string ("").
- /// </note>
- /// </remarks>
- public virtual string ContractName
- {
- get
- {
- if (_contractName != null)
- {
- return _contractName;
- }
-
- throw ExceptionBuilder.CreateNotOverriddenByDerived("ContractName");
- }
- }
-
- /// <summary>
- /// Gets the metadata of the export definition.
- /// </summary>
- /// <value>
- /// An <see cref="IDictionary{TKey, TValue}"/> containing the metadata of the
- /// <see cref="ExportDefinition"/>. The default is an empty, read-only
- /// <see cref="IDictionary{TKey, TValue}"/>.
- /// </value>
- /// <remarks>
- /// <para>
- /// <note type="inheritinfo">
- /// Overriders of this property should return a read-only
- /// <see cref="IDictionary{TKey, TValue}"/> object with a case-sensitive,
- /// non-linguistic comparer, such as <see cref="StringComparer.Ordinal"/>,
- /// and should never return <see langword="null"/>.
- /// If the <see cref="ExportDefinition"/> does not contain metadata
- /// return an empty <see cref="IDictionary{TKey, TValue}"/> instead.
- /// </note>
- /// </para>
- /// </remarks>
- public virtual IDictionary<string, object> Metadata
- {
- get { return _metadata; }
- }
-
- /// <summary>
- /// Returns a string representation of the export definition.
- /// </summary>
- /// <returns>
- /// A <see cref="String"/> containing the value of the <see cref="ContractName"/> property.
- /// </returns>
- public override string ToString()
- {
- return this.ContractName;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ExportedDelegate.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ExportedDelegate.cs deleted file mode 100644 index d6bc6297170..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ExportedDelegate.cs +++ /dev/null @@ -1,97 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Diagnostics.CodeAnalysis;
-using System.Reflection;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.Primitives
-{
- [SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
- public class ExportedDelegate
- {
- private object _instance;
- private MethodInfo _method;
-
- protected ExportedDelegate() { }
-#if !SILVERLIGHT
- [System.Security.SecurityCritical]
-#endif
- public ExportedDelegate(object instance, MethodInfo method)
- {
- Requires.NotNull(method, "method");
-
- this._instance = instance;
- this._method = method;
- }
-
- public virtual Delegate CreateDelegate(Type delegateType)
- {
- Requires.NotNull(delegateType, "delegateType");
-
- if (delegateType == typeof(Delegate) || delegateType == typeof(MulticastDelegate))
- {
- Type funcOrAction = ConvertMethodInfoToFuncOrActionType(this._method);
-
- if (funcOrAction != null)
- {
- delegateType = funcOrAction;
- }
- else
- {
- return null;
- }
- }
-
- return Delegate.CreateDelegate(delegateType, this._instance, this._method, false);
- }
-
- private static Type[] _funcTypes =
- {
- typeof(Func<>), typeof(Func<,>), typeof(Func<,,>), typeof(Func<,,,>), typeof(Func<,,,,>)
-#if CLR40 && !SILVERLIGHT
- , typeof(Func<,,,,,>), typeof(Func<,,,,,,>), typeof(Func<,,,,,,,>), typeof(Func<,,,,,,,,>)
-#endif
- };
-
- private static Type[] _actionTypes =
- {
- typeof(Action), typeof(Action<>), typeof(Action<,>), typeof(Action<,,>), typeof(Action<,,,>)
-#if CLR40 && !SILVERLIGHT
- , typeof(Action<,,,,>), typeof(Action<,,,,,>), typeof(Action<,,,,,,>), typeof(Action<,,,,,,,>)
-#endif
- };
-
- private static Type ConvertMethodInfoToFuncOrActionType(MethodInfo method)
- {
- ParameterInfo[] parameters = method.GetParameters();
-
- bool isVoid = method.ReturnType == typeof(void);
- Type[] typeArray = isVoid ? _actionTypes : _funcTypes;
-
- if (parameters.Length >= typeArray.Length)
- {
- return null;
- }
-
- Type[] genericArgTypes = new Type[parameters.Length + (isVoid ? 0 : 1)];
-
- for (int i = 0; i < parameters.Length; i++)
- {
- genericArgTypes[i] = parameters[i].ParameterType;
- }
-
- if (!isVoid)
- {
- genericArgTypes[parameters.Length] = method.ReturnType;
- }
-
- Type delegateType = typeArray[parameters.Length].IsGenericType ?
- typeArray[parameters.Length].MakeGenericType(genericArgTypes) :
- typeArray[parameters.Length];
-
- return delegateType;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ICompositionElement.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ICompositionElement.cs deleted file mode 100644 index 6c4863ef067..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ICompositionElement.cs +++ /dev/null @@ -1,44 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-
-namespace System.ComponentModel.Composition.Primitives
-{
- /// <summary>
- /// Represents an element that participates in composition.
- /// </summary>
- public interface ICompositionElement
- {
- /// <summary>
- /// Gets the display name of the composition element.
- /// </summary>
- /// <value>
- /// A <see cref="String"/> containing a human-readable display name of the <see cref="ICompositionElement"/>.
- /// </value>
- /// <remarks>
- /// <note type="implementnotes">
- /// Implementors of this property should never return <see langword="null"/> or an empty
- /// string ("").
- /// </note>
- /// </remarks>
- string DisplayName
- {
- get;
- }
-
- /// <summary>
- /// Gets the composition element from which the current composition element
- /// originated.
- /// </summary>
- /// <value>
- /// A <see cref="ICompositionElement"/> from which the current
- /// <see cref="ICompositionElement"/> originated, or <see langword="null"/>
- /// if the <see cref="ICompositionElement"/> is the root composition element.
- /// </value>
- ICompositionElement Origin
- {
- get;
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/IPartCreatorImportDefinition.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/IPartCreatorImportDefinition.cs deleted file mode 100644 index 307481c847f..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/IPartCreatorImportDefinition.cs +++ /dev/null @@ -1,12 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-
-namespace System.ComponentModel.Composition.Primitives
-{
- internal interface IPartCreatorImportDefinition
- {
- ContractBasedImportDefinition ProductImportDefinition { get; }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ImportCardinality.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ImportCardinality.cs deleted file mode 100644 index d59dc9bea0b..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ImportCardinality.cs +++ /dev/null @@ -1,28 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-
-namespace System.ComponentModel.Composition.Primitives
-{
- /// <summary>
- /// Indicates the cardinality of the <see cref="Export"/> objects required by an <see cref="ImportDefinition"/>.
- /// </summary>
- public enum ImportCardinality
- {
- /// <summary>
- /// Zero or one <see cref="Export"/> objects are required by an <see cref="ImportDefinition"/>.
- /// </summary>
- ZeroOrOne = 0,
-
- /// <summary>
- /// Exactly one <see cref="Export"/> object is required by an <see cref="ImportDefinition"/>.
- /// </summary>
- ExactlyOne = 1,
-
- /// <summary>
- /// Zero or more <see cref="Export"/> objects are required by an <see cref="ImportDefinition"/>.
- /// </summary>
- ZeroOrMore = 2,
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ImportDefinition.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ImportDefinition.cs deleted file mode 100644 index 9c81b51c90f..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/ImportDefinition.cs +++ /dev/null @@ -1,236 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Diagnostics.CodeAnalysis;
-using System.Globalization;
-using System.Linq.Expressions;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.Primitives
-{
- /// <summary>
- /// Represents an import required by a <see cref="ComposablePart"/> object.
- /// </summary>
- public class ImportDefinition
- {
- internal static readonly string EmptyContractName = string.Empty;
- private readonly Expression<Func<ExportDefinition, bool>> _constraint;
- private readonly ImportCardinality _cardinality = ImportCardinality.ExactlyOne;
- private readonly string _contractName = EmptyContractName;
- private readonly bool _isRecomposable;
- private readonly bool _isPrerequisite = true;
- private Func<ExportDefinition, bool> _compiledConstraint;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ImportDefinition"/> class.
- /// </summary>
- /// <remarks>
- /// <note type="inheritinfo">
- /// Derived types calling this constructor must override the <see cref="Constraint"/>
- /// property, and optionally, the <see cref="Cardinality"/>, <see cref="IsPrerequisite"/>
- /// and <see cref="IsRecomposable"/>
- /// properties.
- /// </note>
- /// </remarks>
- protected ImportDefinition()
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ImportDefinition"/> class
- /// with the specified constraint, cardinality, value indicating if the import
- /// definition is recomposable and a value indicating if the import definition
- /// is a prerequisite.
- /// </summary>
- /// <param name="constraint">
- /// A <see cref="Expression{TDelegate}"/> containing a <see cref="Func{T, TResult}"/>
- /// that defines the conditions that must be matched for the <see cref="ImportDefinition"/>
- /// to be satisfied by an <see cref="Export"/>.
- /// </param>
- /// <param name="contractName">
- /// The contract name of the export that this import is interested in. The contract name
- /// property is used as guidance and not automatically enforced in the constraint. If
- /// the contract name is a required in the constraint then it should be added to the constraint
- /// by the caller of this constructor.
- /// </param>
- /// <param name="cardinality">
- /// One of the <see cref="ImportCardinality"/> values indicating the
- /// cardinality of the <see cref="Export"/> objects required by the
- /// <see cref="ImportDefinition"/>.
- /// </param>
- /// <param name="isRecomposable">
- /// <see langword="true"/> if the <see cref="ImportDefinition"/> can be satisfied
- /// multiple times throughout the lifetime of a <see cref="ComposablePart"/>, otherwise,
- /// <see langword="false"/>.
- /// </param>
- /// <param name="isPrerequisite">
- /// <see langword="true"/> if the <see cref="ImportDefinition"/> is required to be
- /// satisfied before a <see cref="ComposablePart"/> can start producing exported
- /// objects; otherwise, <see langword="false"/>.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="constraint"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ArgumentException">
- /// <paramref name="cardinality"/> is not one of the <see cref="ImportCardinality"/>
- /// values.
- /// </exception>
- [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
- public ImportDefinition(Expression<Func<ExportDefinition, bool>> constraint, string contractName, ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite)
- : this(contractName, cardinality, isRecomposable, isPrerequisite)
- {
- Requires.NotNull(constraint, "constraint");
-
- this._constraint = constraint;
- }
-
- internal ImportDefinition(string contractName, ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite)
- {
- if (
- (cardinality != ImportCardinality.ExactlyOne) &&
- (cardinality != ImportCardinality.ZeroOrMore) &&
- (cardinality != ImportCardinality.ZeroOrOne)
- )
- {
- throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Strings.ArgumentOutOfRange_InvalidEnum, "cardinality", cardinality, typeof(ImportCardinality).Name), "cardinality");
- }
-
- this._contractName = contractName ?? EmptyContractName;
- this._cardinality = cardinality;
- this._isRecomposable = isRecomposable;
- this._isPrerequisite = isPrerequisite;
- }
-
- /// <summary>
- /// Gets the contract name of the export required by the import definition.
- /// </summary>
- /// <value>
- /// A <see cref="String"/> containing the contract name of the <see cref="Export"/>
- /// required by the <see cref="ContractBasedImportDefinition"/>. This property should
- /// return <see cref="String.Empty"/> for imports that do not require a specific
- /// contract name.
- /// </value>
- public virtual string ContractName
- {
- get { return this._contractName; }
- }
-
- /// <summary>
- /// Gets the cardinality of the exports required by the import definition.
- /// </summary>
- /// <value>
- /// One of the <see cref="ImportCardinality"/> values indicating the
- /// cardinality of the <see cref="Export"/> objects required by the
- /// <see cref="ImportDefinition"/>. The default is
- /// <see cref="ImportCardinality.ExactlyOne"/>
- /// </value>
- public virtual ImportCardinality Cardinality
- {
- get { return this._cardinality; }
- }
-
- /// <summary>
- /// Gets an expression that defines conditions that must be matched for the import
- /// described by the import definition to be satisfied.
- /// </summary>
- /// <returns>
- /// A <see cref="Expression{TDelegate}"/> containing a <see cref="Func{T, TResult}"/>
- /// that defines the conditions that must be matched for the
- /// <see cref="ImportDefinition"/> to be satisfied by an <see cref="Export"/>.
- /// </returns>
- /// <exception cref="NotImplementedException">
- /// The property was not overridden by a derived class.
- /// </exception>
- /// <remarks>
- /// <note type="inheritinfo">
- /// Overriders of this property should never return <see langword="null"/>.
- /// </note>
- /// </remarks>
- [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
- public virtual Expression<Func<ExportDefinition, bool>> Constraint
- {
- get
- {
- if (this._constraint != null)
- {
- return this._constraint;
- }
-
- throw ExceptionBuilder.CreateNotOverriddenByDerived("Constraint");
- }
- }
-
- /// <summary>
- /// Gets a value indicating whether the import definition is required to be
- /// satisfied before a part can start producing exported values.
- /// </summary>
- /// <value>
- /// <see langword="true"/> if the <see cref="ImportDefinition"/> is required to be
- /// satisfied before a <see cref="ComposablePart"/> can start producing exported
- /// objects; otherwise, <see langword="false"/>. The default is <see langword="true"/>.
- /// </value>
- public virtual bool IsPrerequisite
- {
- get { return this._isPrerequisite; }
- }
-
- /// <summary>
- /// Gets a value indicating whether the import definition can be satisfied multiple times.
- /// </summary>
- /// <value>
- /// <see langword="true"/> if the <see cref="ImportDefinition"/> can be satisfied
- /// multiple times throughout the lifetime of a <see cref="ComposablePart"/>, otherwise,
- /// <see langword="false"/>. The default is <see langword="false"/>.
- /// </value>
- public virtual bool IsRecomposable
- {
- get { return this._isRecomposable; }
- }
-
- /// <summary>
- /// Executes of the constraint provided by the <see cref="Constraint"/> property
- /// against a given <see cref="ExportDefinition"/> to determine if this
- /// <see cref="ImportDefinition"/> can be satisfied by the given <see cref="Export"/>.
- /// </summary>
- /// <param name="exportDefinition">
- /// A definition for a <see cref="Export"/> used to determine if it satisfies the
- /// requirements for this <see cref="ImportDefinition"/>.
- /// </param>
- /// <returns>
- /// <see langword="True"/> if the <see cref="Export"/> satisfies the requirements for
- /// this <see cref="ImportDefinition"/>, otherwise returns <see langword="False"/>.
- /// </returns>
- /// <remarks>
- /// <note type="inheritinfo">
- /// Overrides of this method can provide a more optimized execution of the
- /// <see cref="Constraint"/> property but the result should remain consistent.
- /// </note>
- /// </remarks>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="exportDefinition"/> is <see langword="null"/>.
- /// </exception>
- public virtual bool IsConstraintSatisfiedBy(ExportDefinition exportDefinition)
- {
- Requires.NotNull(exportDefinition, "exportDefinition");
-
- if (this._compiledConstraint == null)
- {
- this._compiledConstraint = this.Constraint.Compile();
- }
-
- return this._compiledConstraint.Invoke(exportDefinition);
- }
-
- /// <summary>
- /// Returns a string representation of the import definition.
- /// </summary>
- /// <returns>
- /// A <see cref="String"/> containing the value of the <see cref="Constraint"/> property.
- /// </returns>
- public override string ToString()
- {
- return this.Constraint.Body.ToString();
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/SerializableCompositionElement.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/SerializableCompositionElement.cs deleted file mode 100644 index f84d5a1ec50..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/Primitives/SerializableCompositionElement.cs +++ /dev/null @@ -1,57 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.Primitives
-{
- // As most objects that implement ICompositionElement (such as Export, ComposablePart,
- // ComposablePartCatalog, etc) are not serializable, this class is used as a serializable
- // placeholder for these types when ICompositionElement is used within serializable types,
- // such as CompositionException, CompositionIssue, etc.
- [Serializable]
- internal class SerializableCompositionElement : ICompositionElement
- {
- private readonly string _displayName;
- private readonly ICompositionElement _origin;
-
- public SerializableCompositionElement(string displayName, ICompositionElement origin)
- {
-#if !SILVERLIGHT
- Assumes.IsTrue(origin == null || origin.GetType().IsSerializable);
-#endif
- this._displayName = displayName ?? string.Empty;
- this._origin = origin;
- }
-
- public string DisplayName
- {
- get { return this._displayName; }
- }
-
- public ICompositionElement Origin
- {
- get { return this._origin; }
- }
-
- public override string ToString()
- {
- return this.DisplayName;
- }
-
- public static ICompositionElement FromICompositionElement(ICompositionElement element)
- {
- if (element == null)
- { // Null is always serializable
-
- return null;
- }
-
- ICompositionElement origin = FromICompositionElement(element.Origin);
-
- // Otherwise, we need to create a serializable wrapper
- return new SerializableCompositionElement(element.DisplayName, origin);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/.gitattributes b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/.gitattributes deleted file mode 100644 index 8fcb7fbb6d5..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/.gitattributes +++ /dev/null @@ -1,28 +0,0 @@ -/DisposableReflectionComposablePart.cs -crlf -/ExportingMember.cs -crlf -/IReflectionPartCreationInfo.cs -crlf -/ImportType.cs -crlf -/ImportingItem.cs -crlf -/ImportingMember.cs -crlf -/ImportingParameter.cs -crlf -/LazyMemberInfo.cs -crlf -/PartCreatorExportDefinition.cs -crlf -/PartCreatorMemberImportDefinition.cs -crlf -/PartCreatorParameterImportDefinition.cs -crlf -/ReflectionComposablePart.cs -crlf -/ReflectionComposablePartDefinition.cs -crlf -/ReflectionExtensions.cs -crlf -/ReflectionField.cs -crlf -/ReflectionImportDefinition.cs -crlf -/ReflectionItem.cs -crlf -/ReflectionItemType.cs -crlf -/ReflectionMember.cs -crlf -/ReflectionMemberExportDefinition.cs -crlf -/ReflectionMemberImportDefinition.cs -crlf -/ReflectionMethod.cs -crlf -/ReflectionModelServices.cs -crlf -/ReflectionParameter.cs -crlf -/ReflectionParameterImportDefinition.cs -crlf -/ReflectionProperty.cs -crlf -/ReflectionType.cs -crlf -/ReflectionWritableMember.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/DisposableReflectionComposablePart.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/DisposableReflectionComposablePart.cs deleted file mode 100644 index c6b9854691a..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/DisposableReflectionComposablePart.cs +++ /dev/null @@ -1,57 +0,0 @@ -
-// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Diagnostics.CodeAnalysis;
-using System.Globalization;
-using System.Linq;
-using System.Reflection;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-using System.Threading;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- internal sealed class DisposableReflectionComposablePart : ReflectionComposablePart, IDisposable
- {
- private volatile int _isDisposed = 0;
-
- public DisposableReflectionComposablePart(ReflectionComposablePartDefinition definition)
- : base(definition)
- {
- }
-
- protected override void ReleaseInstanceIfNecessary(object instance)
- {
- IDisposable disposable = instance as IDisposable;
- if (disposable != null)
- {
- disposable.Dispose();
- }
- }
-
- protected override void EnsureRunning()
- {
- base.EnsureRunning();
- if (this._isDisposed == 1)
- {
- throw ExceptionBuilder.CreateObjectDisposed(this);
- }
- }
-
- void IDisposable.Dispose()
- {
- // NOTE : According to http://msdn.microsoft.com/en-us/library/4bw5ewxy.aspx, the warning is bogus when used with Interlocked API.
-#pragma warning disable 420
- if (Interlocked.CompareExchange(ref this._isDisposed, 1, 0) == 0)
-#pragma warning restore 420
- {
- this.ReleaseInstanceIfNecessary(this.CachedInstance);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ExportingMember.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ExportingMember.cs deleted file mode 100644 index 5276e7a1528..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ExportingMember.cs +++ /dev/null @@ -1,93 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Globalization;
-using System.Reflection;
-using Microsoft.Internal;
-using System.Threading;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- internal class ExportingMember
- {
- private readonly ExportDefinition _definition;
- private readonly ReflectionMember _member;
- private object _cachedValue = null;
- private volatile bool _isValueCached = false;
-
- public ExportingMember(ExportDefinition definition, ReflectionMember member)
- {
- Assumes.NotNull(definition, member);
-
- this._definition = definition;
- this._member = member;
- }
-
- public bool RequiresInstance
- {
- get { return _member.RequiresInstance; }
- }
-
- public ExportDefinition Definition
- {
- get { return _definition; }
- }
-
- public object GetExportedValue(object instance, object @lock)
- {
- this.EnsureReadable();
-
- if (!this._isValueCached)
- {
- object exportedValue;
- try
- {
- exportedValue = this._member.GetValue(instance);
- }
- catch (TargetInvocationException exception)
- { // Member threw an exception. Avoid letting this
- // leak out as a 'raw' unhandled exception, instead,
- // we'll add some context and rethrow.
-
- throw new ComposablePartException(
- CompositionErrorId.ReflectionModel_ExportThrewException,
- String.Format(CultureInfo.CurrentCulture,
- Strings.ReflectionModel_ExportThrewException,
- this._member.GetDisplayName()),
- Definition.ToElement(),
- exception.InnerException);
- }
-
- lock (@lock)
- {
- if (!this._isValueCached)
- {
- this._cachedValue = exportedValue;
- Thread.MemoryBarrier();
-
- this._isValueCached = true;
- }
- }
- }
-
- return this._cachedValue;
- }
-
- private void EnsureReadable()
- {
- if (!this._member.CanRead)
- { // Property does not have a getter
-
- throw new ComposablePartException(
- CompositionErrorId.ReflectionModel_ExportNotReadable,
- String.Format(CultureInfo.CurrentCulture,
- Strings.ReflectionModel_ExportNotReadable,
- this._member.GetDisplayName()),
- Definition.ToElement());
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/IReflectionPartCreationInfo.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/IReflectionPartCreationInfo.cs deleted file mode 100644 index ac2a31a98f0..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/IReflectionPartCreationInfo.cs +++ /dev/null @@ -1,22 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-using System.Reflection;
-using System.Threading;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- internal interface IReflectionPartCreationInfo : ICompositionElement
- {
- Type GetPartType();
- Lazy<Type> GetLazyPartType();
- ConstructorInfo GetConstructor();
- IDictionary<string, object> GetMetadata();
- IEnumerable<ExportDefinition> GetExports();
- IEnumerable<ImportDefinition> GetImports();
- bool IsDisposalRequired { get; }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ImportType.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ImportType.cs deleted file mode 100644 index 60da83d83a9..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ImportType.cs +++ /dev/null @@ -1,140 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Primitives;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-using System.Reflection;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- // Describes the import type of a Reflection-based import definition
- internal class ImportType
- {
- private static readonly Type LazyOfTType = typeof(Lazy<>);
- private static readonly Type LazyOfTMType = typeof(Lazy<,>);
- private const string ExportFactoryTypeName = "System.ComponentModel.Composition.ExportFactory";
-
- private readonly Type _type;
- private readonly bool _isAssignableCollectionType;
- private readonly Type _contractType;
- private Func<Export, object> _castSingleValue;
-
- public ImportType(Type type, ImportCardinality cardinality)
- {
- Assumes.NotNull(type);
-
- this._type = type;
- this._contractType = type;
-
- if (cardinality == ImportCardinality.ZeroOrMore)
- {
- this._isAssignableCollectionType = IsTypeAssignableCollectionType(type);
- this._contractType = CheckForCollection(type);
- }
-
- this._contractType = CheckForLazyAndPartCreator(this._contractType);
- }
-
- public bool IsAssignableCollectionType
- {
- get { return this._isAssignableCollectionType; }
- }
-
- public Type ElementType { get; private set; }
-
- public Type ActualType
- {
- get { return this._type; }
- }
-
- public bool IsPartCreator { get; private set; }
-
- public Type ContractType { get { return this._contractType; } }
-
- public Func<Export, object> CastExport { get { return this._castSingleValue; } }
-
- public Type MetadataViewType { get; private set; }
-
- private Type CheckForCollection(Type type)
- {
- this.ElementType = CollectionServices.GetEnumerableElementType(type);
- if (this.ElementType != null)
- {
- return this.ElementType;
- }
- return type;
- }
-
- private Type CheckForLazyAndPartCreator(Type type)
- {
- if (type.IsGenericType)
- {
- Type genericType = type.GetGenericTypeDefinition();
- Type[] arguments = type.GetGenericArguments();
-
- if (genericType == LazyOfTType)
- {
- this._castSingleValue = ExportServices.CreateStronglyTypedLazyFactory(arguments[0], null);
- return arguments[0];
- }
-
- if (genericType == LazyOfTMType)
- {
- this.MetadataViewType = arguments[1];
- this._castSingleValue = ExportServices.CreateStronglyTypedLazyFactory(arguments[0], arguments[1]);
- return arguments[0];
- }
-
- if (
- type.FullName.StartsWith(ExportFactoryTypeName, StringComparison.Ordinal) &&
- ((arguments.Length == 1) || (arguments.Length == 2)))
- {
- // Func<Tuple<T, Action>>
- Type exportLifetimeContextCreatorType = typeof(Func<>).MakeGenericType(typeof(Tuple<,>).MakeGenericType(arguments[0], typeof(Action)));
- ConstructorInfo constructor = null;
-
- if (arguments.Length == 1)
- {
- constructor = type.GetConstructor(new Type[] { exportLifetimeContextCreatorType });
- }
- else
- {
- Assumes.IsTrue(arguments.Length == 2);
- constructor = type.GetConstructor(new Type[] { exportLifetimeContextCreatorType, arguments[1] });
- }
-
- if (constructor != null)
- {
- this.IsPartCreator = true;
- if (arguments.Length == 1)
- {
- this._castSingleValue = ExportServices.CreateStronglyTypedExportFactoryFactory(arguments[0], null, constructor);
- }
- else
- {
- Assumes.IsTrue(arguments.Length == 2);
- this._castSingleValue = ExportServices.CreateStronglyTypedExportFactoryFactory(arguments[0], arguments[1], constructor);
- this.MetadataViewType = arguments[1];
- }
-
- return arguments[0];
- }
- }
- }
-
- return type;
- }
-
- private static bool IsTypeAssignableCollectionType(Type type)
- {
- if (type.IsArray || CollectionServices.IsEnumerableOfT(type))
- {
- return true;
- }
-
- return false;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ImportingItem.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ImportingItem.cs deleted file mode 100644 index 3b07368b974..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ImportingItem.cs +++ /dev/null @@ -1,116 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Globalization;
-using System.Linq;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- internal abstract class ImportingItem
- {
- private readonly ContractBasedImportDefinition _definition;
- private readonly ImportType _importType;
-
- protected ImportingItem(ContractBasedImportDefinition definition, ImportType importType)
- {
- Assumes.NotNull(definition);
-
- this._definition = definition;
- this._importType = importType;
- }
-
- public ContractBasedImportDefinition Definition
- {
- get { return this._definition; }
- }
-
- public ImportType ImportType
- {
- get { return this._importType; }
- }
-
- public object CastExportsToImportType(Export[] exports)
- {
- if (this.Definition.Cardinality == ImportCardinality.ZeroOrMore)
- {
- return CastExportsToCollectionImportType(exports);
- }
- else
- {
- return CastExportsToSingleImportType(exports);
- }
- }
-
- private object CastExportsToCollectionImportType(Export[] exports)
- {
- Assumes.NotNull(exports);
-
- // Element type could be null if the actually import type of the member is not a collection
- // This particular case will end up failing when we set the member.
- Type elementType = this.ImportType.ElementType ?? typeof(object);
-
- Array array = Array.CreateInstance(elementType, exports.Length);
-
- for (int i = 0; i < array.Length; i++)
- {
- object value = CastSingleExportToImportType(elementType, exports[i]);
-
- array.SetValue(value, i);
- }
-
- return array;
- }
-
- private object CastExportsToSingleImportType(Export[] exports)
- {
- Assumes.NotNull(exports);
- Assumes.IsTrue(exports.Length < 2);
-
- if (exports.Length == 0)
- {
- return null;
- }
-
- return CastSingleExportToImportType(this.ImportType.ActualType, exports[0]);
- }
-
- private object CastSingleExportToImportType(Type type, Export export)
- {
- if (this.ImportType.CastExport != null)
- {
- return this.ImportType.CastExport(export);
- }
-
- return Cast(type, export);
- }
-
- private object Cast(Type type, Export export)
- {
- // TODO: Need to catch CompositionException to provide
- // additional information about what member we're setting
- // and the current dependency graph.
- object value = export.Value;
-
- object result;
- if (!ContractServices.TryCast(type, value, out result))
- {
- throw new ComposablePartException(
- CompositionErrorId.ReflectionModel_ImportNotAssignableFromExport,
- String.Format(CultureInfo.CurrentCulture,
- Strings.ReflectionModel_ImportNotAssignableFromExport,
- export.ToElement().DisplayName,
- type.FullName),
- this.Definition.ToElement());
- }
-
- return result;
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ImportingMember.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ImportingMember.cs deleted file mode 100644 index 6e5cffe183a..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ImportingMember.cs +++ /dev/null @@ -1,253 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
-using System.Globalization;
-using System.Reflection;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- internal class ImportingMember : ImportingItem
- {
- private readonly ReflectionWritableMember _member;
-
- public ImportingMember(ContractBasedImportDefinition definition, ReflectionWritableMember member, ImportType importType)
- : base(definition, importType)
- {
- Assumes.NotNull(definition, member);
-
- this._member = member;
- }
-
- public void SetExportedValue(object instance, object value)
- {
- if (RequiresCollectionNormalization())
- {
- this.SetCollectionMemberValue(instance, (IEnumerable)value);
- }
- else
- {
- this.SetSingleMemberValue(instance, value);
- }
- }
-
- private bool RequiresCollectionNormalization()
- {
- if (this.Definition.Cardinality != ImportCardinality.ZeroOrMore)
- { // If we're not looking at a collection import, then don't
- // 'normalize' the collection.
-
- return false;
- }
-
- if (this._member.CanWrite && this.ImportType.IsAssignableCollectionType)
- { // If we can simply replace the entire value of the property/field, then
- // we don't need to 'normalize' the collection.
-
- return false;
- }
-
- return true;
- }
-
- private void SetSingleMemberValue(object instance, object value)
- {
- EnsureWritable();
-
- try
- {
- this._member.SetValue(instance, value);
- }
- catch (TargetInvocationException exception)
- { // Member threw an exception. Avoid letting this
- // leak out as a 'raw' unhandled exception, instead,
- // we'll add some context and rethrow.
-
- throw new ComposablePartException(
- CompositionErrorId.ReflectionModel_ImportThrewException,
- String.Format(CultureInfo.CurrentCulture,
- Strings.ReflectionModel_ImportThrewException,
- this._member.GetDisplayName()),
- Definition.ToElement(),
- exception.InnerException);
- }
- }
-
- private void EnsureWritable()
- {
- if (!this._member.CanWrite)
- { // Property does not have a setter, or
- // field is marked as read-only.
-
- throw new ComposablePartException(
- CompositionErrorId.ReflectionModel_ImportNotWritable,
- String.Format(CultureInfo.CurrentCulture,
- Strings.ReflectionModel_ImportNotWritable,
- this._member.GetDisplayName()),
- Definition.ToElement());
- }
- }
-
- private void SetCollectionMemberValue(object instance, IEnumerable values)
- {
- Assumes.NotNull(values);
-
- ICollection<object> collection = null;
- Type itemType = CollectionServices.GetCollectionElementType(this.ImportType.ActualType);
- if (itemType != null)
- {
- collection = GetNormalizedCollection(itemType, instance);
- }
-
- EnsureCollectionIsWritable(collection);
- PopulateCollection(collection, values);
- }
-
- private ICollection<object> GetNormalizedCollection(Type itemType, object instance)
- {
- Assumes.NotNull(itemType);
-
- object collectionObject = null;
-
- if (this._member.CanRead)
- {
- try
- {
- collectionObject = this._member.GetValue(instance);
- }
- catch (TargetInvocationException exception)
- {
- throw new ComposablePartException(
- CompositionErrorId.ReflectionModel_ImportCollectionGetThrewException,
- String.Format(CultureInfo.CurrentCulture,
- Strings.ReflectionModel_ImportCollectionGetThrewException,
- this._member.GetDisplayName()),
- this.Definition.ToElement(),
- exception.InnerException);
- }
- }
-
- if (collectionObject == null)
- {
- ConstructorInfo constructor = this.ImportType.ActualType.GetConstructor(Type.EmptyTypes);
-
- // If it contains a default public constructor create a new instance.
- if (constructor != null)
- {
- try
- {
- collectionObject = constructor.SafeInvoke();
- }
- catch (TargetInvocationException exception)
- {
- throw new ComposablePartException(
- CompositionErrorId.ReflectionModel_ImportCollectionConstructionThrewException,
- String.Format(CultureInfo.CurrentCulture,
- Strings.ReflectionModel_ImportCollectionConstructionThrewException,
- this._member.GetDisplayName(),
- this.ImportType.ActualType.FullName),
- this.Definition.ToElement(),
- exception.InnerException);
- }
-
- SetSingleMemberValue(instance, collectionObject);
- }
- }
-
- if (collectionObject == null)
- {
- throw new ComposablePartException(
- CompositionErrorId.ReflectionModel_ImportCollectionNull,
- String.Format(CultureInfo.CurrentCulture,
- Strings.ReflectionModel_ImportCollectionNull,
- this._member.GetDisplayName()),
- this.Definition.ToElement());
- }
-
- return CollectionServices.GetCollectionWrapper(itemType, collectionObject);
- }
-
- [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
- private void EnsureCollectionIsWritable(ICollection<object> collection)
- {
- bool isReadOnly = true;
-
- try
- {
- if (collection != null)
- {
- isReadOnly = collection.IsReadOnly;
- }
- }
- catch (Exception exception)
- {
- throw new ComposablePartException(
- CompositionErrorId.ReflectionModel_ImportCollectionIsReadOnlyThrewException,
- String.Format(CultureInfo.CurrentCulture,
- Strings.ReflectionModel_ImportCollectionIsReadOnlyThrewException,
- this._member.GetDisplayName(),
- collection.GetType().FullName),
- this.Definition.ToElement(),
- exception);
- }
-
- if (isReadOnly)
- {
- throw new ComposablePartException(
- CompositionErrorId.ReflectionModel_ImportCollectionNotWritable,
- String.Format(CultureInfo.CurrentCulture,
- Strings.ReflectionModel_ImportCollectionNotWritable,
- this._member.GetDisplayName()),
- this.Definition.ToElement());
- }
- }
-
- [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
- private void PopulateCollection(ICollection<object> collection, IEnumerable values)
- {
- Assumes.NotNull(collection, values);
-
- try
- {
- collection.Clear();
- }
- catch (Exception exception)
- {
- throw new ComposablePartException(
- CompositionErrorId.ReflectionModel_ImportCollectionClearThrewException,
- String.Format(CultureInfo.CurrentCulture,
- Strings.ReflectionModel_ImportCollectionClearThrewException,
- this._member.GetDisplayName(),
- collection.GetType().FullName),
- this.Definition.ToElement(),
- exception);
- }
-
- foreach (object value in values)
- {
- try
- {
- collection.Add(value);
- }
- catch (Exception exception)
- {
- throw new ComposablePartException(
- CompositionErrorId.ReflectionModel_ImportCollectionAddThrewException,
- String.Format(CultureInfo.CurrentCulture,
- Strings.ReflectionModel_ImportCollectionAddThrewException,
- this._member.GetDisplayName(),
- collection.GetType().FullName),
- this.Definition.ToElement(),
- exception);
- }
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ImportingParameter.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ImportingParameter.cs deleted file mode 100644 index a454189613a..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ImportingParameter.cs +++ /dev/null @@ -1,16 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- internal class ImportingParameter : ImportingItem
- {
- public ImportingParameter(ContractBasedImportDefinition definition, ImportType importType)
- : base(definition, importType)
- {
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/LazyMemberInfo.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/LazyMemberInfo.cs deleted file mode 100644 index 6b492cf7308..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/LazyMemberInfo.cs +++ /dev/null @@ -1,207 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Diagnostics.CodeAnalysis;
-using System.Globalization;
-using System.Linq;
-using System.Reflection;
-using System.Threading;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- public struct LazyMemberInfo
- {
- private readonly MemberTypes _memberType;
- private MemberInfo[] _accessors;
- private readonly Func<MemberInfo[]> _accessorsCreator;
-
- public LazyMemberInfo(MemberInfo member)
- {
- Requires.NotNull(member, "member");
- EnsureSupportedMemberType(member.MemberType, "member");
-
- this._accessorsCreator = null;
- this._memberType = member.MemberType;
-
- switch(this._memberType)
- {
- case MemberTypes.Property:
- PropertyInfo property = (PropertyInfo)member;
- Assumes.NotNull(property);
- this._accessors = new MemberInfo[] { property.GetGetMethod(true), property.GetSetMethod(true) };
- break;
- case MemberTypes.Event:
- EventInfo event_ = (EventInfo)member;
- this._accessors = new MemberInfo[] { event_.GetRaiseMethod(true), event_.GetAddMethod(true), event_.GetRemoveMethod(true) };
- break;
- default:
- this._accessors = new MemberInfo[] { member };
- break;
- }
- }
-
- public LazyMemberInfo(MemberTypes memberType, params MemberInfo[] accessors)
- {
- EnsureSupportedMemberType(memberType, "memberType");
- Requires.NotNull(accessors, "accessors");
-
- string errorMessage;
- if (!LazyMemberInfo.AreAccessorsValid(memberType, accessors, out errorMessage))
- {
- throw new ArgumentException(errorMessage, "accessors");
- }
-
- this._memberType = memberType;
- this._accessors = accessors;
- this._accessorsCreator = null;
- }
-
- public LazyMemberInfo(MemberTypes memberType, Func<MemberInfo[]> accessorsCreator)
- {
- EnsureSupportedMemberType(memberType, "memberType");
- Requires.NotNull(accessorsCreator, "accessorsCreator");
-
- this._memberType = memberType;
- this._accessors = null;
- this._accessorsCreator = accessorsCreator;
- }
-
- public MemberTypes MemberType
- {
- get { return this._memberType; }
- }
-
- public MemberInfo[] GetAccessors()
- {
- if ((this._accessors == null) && (this._accessorsCreator != null))
- {
- MemberInfo[] accessors = this._accessorsCreator.Invoke();
-
- string errorMessage;
- if (!LazyMemberInfo.AreAccessorsValid(this.MemberType, accessors, out errorMessage))
- {
- throw new InvalidOperationException(errorMessage);
- }
-
- this._accessors = accessors;
- }
-
- return this._accessors;
- }
-
- public override int GetHashCode()
- {
- if (this._accessorsCreator != null)
- {
- return this.MemberType.GetHashCode() ^ this._accessorsCreator.GetHashCode();
- }
- else
- {
- Assumes.NotNull(this._accessors);
- Assumes.NotNull(this._accessors[0]);
- return this.MemberType.GetHashCode() ^ this._accessors[0].GetHashCode();
- }
- }
-
- public override bool Equals(object obj)
- {
- LazyMemberInfo that = (LazyMemberInfo)obj;
-
- // Difefrent member types mean different members
- if (this._memberType != that._memberType)
- {
- return false;
- }
-
- // if any of the lazy memebers create accessors in a delay-loaded fashion, we simply compare the creators
- if ((this._accessorsCreator != null) || (that._accessorsCreator != null))
- {
- return object.Equals(this._accessorsCreator, that._accessorsCreator);
- }
-
- // we are dealing with explicitly passed accessors in both cases
- Assumes.NotNull(this._accessors);
- Assumes.NotNull(that._accessors);
- return this._accessors.SequenceEqual(that._accessors);
- }
-
- public static bool operator ==(LazyMemberInfo left, LazyMemberInfo right)
- {
- return left.Equals(right);
- }
-
- public static bool operator !=(LazyMemberInfo left, LazyMemberInfo right)
- {
- return !left.Equals(right);
- }
-
- private static void EnsureSupportedMemberType(MemberTypes memberType, string argument)
- {
- MemberTypes supportedTypes = MemberTypes.TypeInfo | MemberTypes.NestedType | MemberTypes.Constructor | MemberTypes.Field | MemberTypes.Method | MemberTypes.Property | MemberTypes.Event;
- Requires.IsInMembertypeSet(memberType, argument, supportedTypes);
- }
-
- private static bool AreAccessorsValid(MemberTypes memberType, MemberInfo[] accessors, out string errorMessage)
- {
- errorMessage = string.Empty;
- if (accessors == null)
- {
- errorMessage = Strings.LazyMemberInfo_AccessorsNull;
- return false;
- }
-
- if (accessors.All(accessor => accessor == null))
- {
- errorMessage = Strings.LazyMemberInfo_NoAccessors;
- return false;
- }
-
- switch (memberType)
- {
- case MemberTypes.Property:
- if (accessors.Length != 2)
- {
- errorMessage = Strings.LazyMemberInfo_InvalidPropertyAccessors_Cardinality;
- return false;
- }
-
- if (accessors.Where(accessor => (accessor != null) && (accessor.MemberType != MemberTypes.Method)).Any())
- {
- errorMessage = Strings.LazyMemberinfo_InvalidPropertyAccessors_AccessorType;
- return false;
- }
-
- break;
-
- case MemberTypes.Event:
- if (accessors.Length != 3)
- {
- errorMessage = Strings.LazyMemberInfo_InvalidEventAccessors_Cardinality;
- return false;
- }
-
- if (accessors.Where(accessor => (accessor != null) && (accessor.MemberType != MemberTypes.Method)).Any())
- {
- errorMessage = Strings.LazyMemberinfo_InvalidPropertyAccessors_AccessorType;
- return false;
- }
-
- break;
-
- default:
- if (
- (accessors.Length != 1) ||
- ((accessors.Length == 1) && (accessors[0].MemberType != memberType)))
- {
- errorMessage = string.Format(CultureInfo.CurrentCulture, Strings.LazyMemberInfo_InvalidAccessorOnSimpleMember, memberType);
- return false;
- }
-
- break;
- }
- return true;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/PartCreatorExportDefinition.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/PartCreatorExportDefinition.cs deleted file mode 100644 index 2b135441a39..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/PartCreatorExportDefinition.cs +++ /dev/null @@ -1,62 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- internal class PartCreatorExportDefinition : ExportDefinition
- {
- private readonly ExportDefinition _productDefinition;
- private IDictionary<string, object> _metadata;
-
- public PartCreatorExportDefinition(ExportDefinition productDefinition)
- : base()
- {
- this._productDefinition = productDefinition;
- }
-
- public override string ContractName
- {
- get
- {
- return CompositionConstants.PartCreatorContractName;
- }
- }
-
- public override IDictionary<string, object> Metadata
- {
- get
- {
- if (this._metadata == null)
- {
- var metadata = new Dictionary<string, object>(this._productDefinition.Metadata);
- metadata[CompositionConstants.ExportTypeIdentityMetadataName] = CompositionConstants.PartCreatorTypeIdentity;
- metadata[CompositionConstants.ProductDefinitionMetadataName] = this._productDefinition;
-
- this._metadata = metadata.AsReadOnly();
- }
- return this._metadata;
- }
- }
-
- internal static bool IsProductConstraintSatisfiedBy(ImportDefinition productImportDefinition, ExportDefinition exportDefinition)
- {
- object productValue = null;
- if (exportDefinition.Metadata.TryGetValue(CompositionConstants.ProductDefinitionMetadataName, out productValue))
- {
- ExportDefinition productDefinition = productValue as ExportDefinition;
-
- if (productDefinition != null)
- {
- return productImportDefinition.IsConstraintSatisfiedBy(productDefinition);
- }
- }
-
- return false;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/PartCreatorMemberImportDefinition.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/PartCreatorMemberImportDefinition.cs deleted file mode 100644 index 8eb39638fe3..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/PartCreatorMemberImportDefinition.cs +++ /dev/null @@ -1,48 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Linq.Expressions;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- internal class PartCreatorMemberImportDefinition : ReflectionMemberImportDefinition, IPartCreatorImportDefinition
- {
- private readonly ContractBasedImportDefinition _productImportDefinition;
-
- public PartCreatorMemberImportDefinition(
- LazyMemberInfo importingLazyMember,
- ICompositionElement origin,
- ContractBasedImportDefinition productImportDefinition)
- : base(importingLazyMember, CompositionConstants.PartCreatorContractName, CompositionConstants.PartCreatorTypeIdentity,
- productImportDefinition.RequiredMetadata, productImportDefinition.Cardinality, productImportDefinition.IsRecomposable, CreationPolicy.Any, origin)
- {
- Assumes.NotNull(productImportDefinition);
- this._productImportDefinition = productImportDefinition;
- }
-
- public ContractBasedImportDefinition ProductImportDefinition { get { return this._productImportDefinition; } }
-
- public override bool IsConstraintSatisfiedBy(ExportDefinition exportDefinition)
- {
- if (!base.IsConstraintSatisfiedBy(exportDefinition))
- {
- return false;
- }
-
- return PartCreatorExportDefinition.IsProductConstraintSatisfiedBy(this._productImportDefinition, exportDefinition);
- }
-
- public override Expression<Func<ExportDefinition, bool>> Constraint
- {
- get
- {
- return ConstraintServices.CreatePartCreatorConstraint(base.Constraint, this._productImportDefinition);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/PartCreatorParameterImportDefinition.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/PartCreatorParameterImportDefinition.cs deleted file mode 100644 index df498e2a057..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/PartCreatorParameterImportDefinition.cs +++ /dev/null @@ -1,48 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Linq.Expressions;
-using System.Reflection;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- internal class PartCreatorParameterImportDefinition : ReflectionParameterImportDefinition, IPartCreatorImportDefinition
- {
- private readonly ContractBasedImportDefinition _productImportDefinition;
-
- public PartCreatorParameterImportDefinition(
- Lazy<ParameterInfo> importingLazyParameter,
- ICompositionElement origin,
- ContractBasedImportDefinition productImportDefinition)
- : base(importingLazyParameter, CompositionConstants.PartCreatorContractName, CompositionConstants.PartCreatorTypeIdentity,
- productImportDefinition.RequiredMetadata, productImportDefinition.Cardinality, CreationPolicy.Any, origin)
- {
- Assumes.NotNull(productImportDefinition);
- this._productImportDefinition = productImportDefinition;
- }
-
- public ContractBasedImportDefinition ProductImportDefinition { get { return this._productImportDefinition; } }
-
- public override bool IsConstraintSatisfiedBy(ExportDefinition exportDefinition)
- {
- if (!base.IsConstraintSatisfiedBy(exportDefinition))
- {
- return false;
- }
- return PartCreatorExportDefinition.IsProductConstraintSatisfiedBy(this._productImportDefinition, exportDefinition);
- }
-
- public override Expression<Func<ExportDefinition, bool>> Constraint
- {
- get
- {
- return ConstraintServices.CreatePartCreatorConstraint(base.Constraint, this._productImportDefinition);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionComposablePart.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionComposablePart.cs deleted file mode 100644 index 908b99baa41..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionComposablePart.cs +++ /dev/null @@ -1,565 +0,0 @@ -
-// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Diagnostics.CodeAnalysis;
-using System.Globalization;
-using System.Linq;
-using System.Reflection;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- // This
- internal class ReflectionComposablePart : ComposablePart, ICompositionElement
- {
- private readonly ReflectionComposablePartDefinition _definition;
- private readonly Dictionary<ImportDefinition, object> _importValues = new Dictionary<ImportDefinition, object>();
- private readonly Dictionary<ImportDefinition, ImportingItem> _importsCache = new Dictionary<ImportDefinition, ImportingItem>();
- private readonly Dictionary<ExportDefinition, ExportingMember> _exportsCache = new Dictionary<ExportDefinition, ExportingMember>();
- private bool _invokeImportsSatisfied = true;
- private bool _invokingImportsSatisfied = false;
- private bool _initialCompositionComplete = false;
- private volatile object _cachedInstance;
- private object _lock = new object();
-
- public ReflectionComposablePart(ReflectionComposablePartDefinition definition)
- {
- Requires.NotNull(definition, "definition");
-
- this._definition = definition;
- }
-
- public ReflectionComposablePart(ReflectionComposablePartDefinition definition, object attributedPart)
- {
- Requires.NotNull(definition, "definition");
- Requires.NotNull(attributedPart, "attributedPart");
-
- this._definition = definition;
-
- if (attributedPart is ValueType)
- {
- throw new ArgumentException(Strings.ArgumentValueType, "attributedPart");
- }
- this._cachedInstance = attributedPart;
- }
-
- protected virtual void EnsureRunning()
- {
- }
-
- protected virtual void ReleaseInstanceIfNecessary(object instance)
- {
- }
-
- protected object CachedInstance
- {
- get
- {
- lock (this._lock)
- {
- return this._cachedInstance;
- }
- }
- }
-
- public ReflectionComposablePartDefinition Definition
- {
- get
- {
- this.EnsureRunning();
- return this._definition;
- }
- }
-
- public override IDictionary<string, object> Metadata
- {
- get
- {
- this.EnsureRunning();
- return this.Definition.Metadata;
- }
- }
-
- public sealed override IEnumerable<ImportDefinition> ImportDefinitions
- {
- get
- {
- this.EnsureRunning();
- return this.Definition.ImportDefinitions;
- }
- }
-
- public sealed override IEnumerable<ExportDefinition> ExportDefinitions
- {
- get
- {
- this.EnsureRunning();
- return this.Definition.ExportDefinitions;
- }
- }
-
-
- string ICompositionElement.DisplayName
- {
- get { return GetDisplayName(); }
- }
-
- ICompositionElement ICompositionElement.Origin
- {
- get { return Definition; }
- }
-
- // This is the ONLY method which is not executed under the ImportEngine composition lock.
- // We need to protect all state that is accesses
- public override object GetExportedValue(ExportDefinition definition)
- {
- // given the implementation of the ImportEngine, this iwll be called under a lock if the part is still being composed
- // This is only called outside of the lock when the part is fully composed
- // based on that we only protect:
- // _exportsCache - and thus all calls to GetExportingMemberFromDefinition
- // access to _importValues
- // access to _initialCompositionComplete
- // access to _instance
- this.EnsureRunning();
- Requires.NotNull(definition, "definition");
-
- ExportingMember member = null;
- lock (this._lock)
- {
- member = GetExportingMemberFromDefinition(definition);
- if (member == null)
- {
- throw ExceptionBuilder.CreateExportDefinitionNotOnThisComposablePart("definition");
- }
- this.EnsureGettable();
- }
-
- return this.GetExportedValue(member);
- }
-
- public override void SetImport(ImportDefinition definition, IEnumerable<Export> exports)
- {
- this.EnsureRunning();
-
- Requires.NotNull(definition, "definition");
- Requires.NotNull(exports, "exports");
-
- ImportingItem item = GetImportingItemFromDefinition(definition);
- if (item == null)
- {
- throw ExceptionBuilder.CreateImportDefinitionNotOnThisComposablePart("definition");
- }
-
- EnsureSettable(definition);
-
- // Avoid walking over exports many times
- Export[] exportsAsArray = exports.AsArray();
- EnsureCardinality(definition, exportsAsArray);
-
- SetImport(item, exportsAsArray);
- }
-
- public override void Activate()
- {
- this.EnsureRunning();
-
- this.SetNonPrerequisiteImports();
-
- // Whenever we are composed/recomposed notify the instance
- this.NotifyImportSatisfied();
-
- lock (this._lock)
- {
- this._initialCompositionComplete = true;
- }
- }
-
- public override string ToString()
- {
- return this.GetDisplayName();
- }
-
- private object GetExportedValue(ExportingMember member)
- {
- object instance = null;
- if (member.RequiresInstance)
- { // Only activate the instance if we actually need to
-
- instance = this.GetInstanceActivatingIfNeeded();
- }
-
- return member.GetExportedValue(instance, this._lock);
- }
-
- private void SetImport(ImportingItem item, Export[] exports)
- {
- object value = item.CastExportsToImportType(exports);
-
- lock (this._lock)
- {
- this._invokeImportsSatisfied = true;
- this._importValues[item.Definition] = value;
- }
- }
-
- private object GetInstanceActivatingIfNeeded()
- {
- if (this._cachedInstance != null)
- {
- return this._cachedInstance;
- }
- else
- {
- ConstructorInfo constructor = null;
- object[] arguments = null;
- // determine whether activation is required, and collect necessary information for activation
- // we need to do that under a lock
- lock (this._lock)
- {
- if (!this.RequiresActivation())
- {
- return null;
- }
-
- constructor = this.Definition.GetConstructor();
- if (constructor == null)
- {
- throw new ComposablePartException(
- CompositionErrorId.ReflectionModel_PartConstructorMissing,
- String.Format(CultureInfo.CurrentCulture,
- Strings.ReflectionModel_PartConstructorMissing,
- this.Definition.GetPartType().FullName),
- this.Definition.ToElement());
- }
- arguments = this.GetConstructorArguments();
- }
-
- // create instance outside of the lock
- object createdInstance = this.CreateInstance(constructor, arguments);
-
- // set the created instance
- lock (this._lock)
- {
- if (this._cachedInstance == null)
- {
- this._cachedInstance = createdInstance;
- createdInstance = null;
- }
- }
-
- // if the instance has been already set
- if (createdInstance == null)
- {
- this.ReleaseInstanceIfNecessary(createdInstance);
- }
- }
-
- return this._cachedInstance;
- }
-
- private object[] GetConstructorArguments()
- {
- ReflectionParameterImportDefinition[] parameterImports = this.ImportDefinitions.OfType<ReflectionParameterImportDefinition>().ToArray();
- object[] arguments = new object[parameterImports.Length];
-
- this.UseImportedValues(
- parameterImports,
- (import, definition, value) =>
- {
- if (definition.Cardinality == ImportCardinality.ZeroOrMore && !import.ImportType.IsAssignableCollectionType)
- {
- throw new ComposablePartException(
- CompositionErrorId.ReflectionModel_ImportManyOnParameterCanOnlyBeAssigned,
- String.Format(CultureInfo.CurrentCulture,
- Strings.ReflectionModel_ImportManyOnParameterCanOnlyBeAssigned,
- this.Definition.GetPartType().FullName,
- definition.ImportingLazyParameter.Value.Name),
- this.Definition.ToElement());
- }
-
- arguments[definition.ImportingLazyParameter.Value.Position] = value;
- },
- true);
-
- return arguments;
- }
-
- // alwayc called under a lock
- private bool RequiresActivation()
- {
- // If we have any imports then we need activation
- // (static imports are not supported)
- if (this.ImportDefinitions.Any())
- {
- return true;
- }
-
- // If we have any instance exports, then we also
- // need activation.
- return this.ExportDefinitions.Any(definition =>
- {
- ExportingMember member = GetExportingMemberFromDefinition(definition);
-
- return member.RequiresInstance;
- });
- }
-
- // this is called under a lock
- private void EnsureGettable()
- {
- // If we're already composed then we know that
- // all pre-req imports have been satisfied
- if (_initialCompositionComplete)
- {
- return;
- }
-
- // Make sure all pre-req imports have been set
- foreach (ImportDefinition definition in ImportDefinitions.Where(definition => definition.IsPrerequisite))
- {
- if (!this._importValues.ContainsKey(definition))
- {
- throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture,
- Strings.InvalidOperation_GetExportedValueBeforePrereqImportSet,
- definition.ToElement().DisplayName));
- }
- }
- }
-
- private void EnsureSettable(ImportDefinition definition)
- {
- lock (this._lock)
- {
- if (this._initialCompositionComplete && !definition.IsRecomposable)
- {
- throw new InvalidOperationException(Strings.InvalidOperation_DefinitionCannotBeRecomposed);
- }
- }
- }
-
- private static void EnsureCardinality(ImportDefinition definition, Export[] exports)
- {
- Requires.NullOrNotNullElements(exports, "exports");
-
- ExportCardinalityCheckResult result = ExportServices.CheckCardinality(definition, exports);
-
- switch (result)
- {
- case ExportCardinalityCheckResult.NoExports:
- throw new ArgumentException(Strings.Argument_ExportsEmpty, "exports");
-
- case ExportCardinalityCheckResult.TooManyExports:
- throw new ArgumentException(Strings.Argument_ExportsTooMany, "exports");
-
- default:
- Assumes.IsTrue(result == ExportCardinalityCheckResult.Match);
- break;
- }
- }
-
- private object CreateInstance(ConstructorInfo constructor, object[] arguments)
- {
- Exception exception = null;
- object instance = null;
-
- try
- {
- instance = constructor.SafeInvoke(arguments);
- }
- catch (TypeInitializationException ex)
- {
- exception = ex;
- }
- catch (TargetInvocationException ex)
- {
- exception = ex.InnerException;
- }
-
- if (exception != null)
- {
- throw new ComposablePartException(
- CompositionErrorId.ReflectionModel_PartConstructorThrewException,
- String.Format(CultureInfo.CurrentCulture,
- Strings.ReflectionModel_PartConstructorThrewException,
- Definition.GetPartType().FullName),
- Definition.ToElement(),
- exception);
- }
-
- return instance;
- }
-
- private void SetNonPrerequisiteImports()
- {
- IEnumerable<ImportDefinition> members = this.ImportDefinitions.Where(import => !import.IsPrerequisite);
-
- // NOTE: Dev10 484204 The validation is turned off for post imports because of it broke declarative composition
- this.UseImportedValues(members, SetExportedValueForImport, false);
- }
-
- private void SetExportedValueForImport(ImportingItem import, ImportDefinition definition, object value)
- {
- ImportingMember importMember = (ImportingMember)import;
-
- object instance = this.GetInstanceActivatingIfNeeded();
-
- importMember.SetExportedValue(instance, value);
- }
-
- private void UseImportedValues<TImportDefinition>(IEnumerable<TImportDefinition> definitions, Action<ImportingItem, TImportDefinition, object> useImportValue, bool errorIfMissing)
- where TImportDefinition : ImportDefinition
- {
- var result = CompositionResult.SucceededResult;
-
- foreach (var definition in definitions)
- {
- ImportingItem import = GetImportingItemFromDefinition(definition);
-
- object value;
- if (!TryGetImportValue(definition, out value))
- {
- if (!errorIfMissing)
- {
- continue;
- }
-
- if (definition.Cardinality == ImportCardinality.ExactlyOne)
- {
- var error = CompositionError.Create(
- CompositionErrorId.ImportNotSetOnPart,
- Strings.ImportNotSetOnPart,
- this.Definition.GetPartType().FullName,
- definition.ToString());
- result = result.MergeError(error);
- continue;
- }
- else
- {
- value = import.CastExportsToImportType(new Export[0]);
- }
- }
-
- useImportValue(import, definition, value);
- }
-
- result.ThrowOnErrors();
- }
-
- private bool TryGetImportValue(ImportDefinition definition, out object value)
- {
- lock (this._lock)
- {
- if (this._importValues.TryGetValue(definition, out value))
- {
- this._importValues.Remove(definition);
- return true;
- }
- }
-
- value = null;
- return false;
- }
-
- [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
- private void NotifyImportSatisfied()
- {
- if (this._invokeImportsSatisfied && !this._invokingImportsSatisfied)
- {
- IPartImportsSatisfiedNotification notify = this.GetInstanceActivatingIfNeeded() as IPartImportsSatisfiedNotification;
- if (notify != null)
- {
- try
- {
- // Reentrancy on composition notifications is allowed, so set this first to avoid
- // an infinte loop of notifications.
- this._invokingImportsSatisfied = true;
-
- notify.OnImportsSatisfied();
- }
- catch (Exception exception)
- {
- throw new ComposablePartException(
- CompositionErrorId.ReflectionModel_PartOnImportsSatisfiedThrewException,
- String.Format(CultureInfo.CurrentCulture,
- Strings.ReflectionModel_PartOnImportsSatisfiedThrewException,
- Definition.GetPartType().FullName),
- Definition.ToElement(),
- exception);
- }
- finally
- {
- this._invokingImportsSatisfied = false;
- }
-
- this._invokeImportsSatisfied = false;
- }
- }
- }
-
- // this is always called under a lock
- private ExportingMember GetExportingMemberFromDefinition(ExportDefinition definition)
- {
- ExportingMember result;
- if (!_exportsCache.TryGetValue(definition, out result))
- {
- result = GetExportingMember(definition);
- if (result != null)
- {
- _exportsCache[definition] = result;
- }
- }
-
- return result;
- }
-
- private ImportingItem GetImportingItemFromDefinition(ImportDefinition definition)
- {
- ImportingItem result;
- if (!_importsCache.TryGetValue(definition, out result))
- {
- result = GetImportingItem(definition);
- if (result != null)
- {
- _importsCache[definition] = result;
- }
- }
-
- return result;
- }
-
- private static ImportingItem GetImportingItem(ImportDefinition definition)
- {
- ReflectionImportDefinition reflectionDefinition = definition as ReflectionImportDefinition;
- if (reflectionDefinition != null)
- {
- return reflectionDefinition.ToImportingItem();
- }
-
- // Don't recognize it
- return null;
- }
-
- private static ExportingMember GetExportingMember(ExportDefinition definition)
- {
- ReflectionMemberExportDefinition exportDefinition = definition as ReflectionMemberExportDefinition;
- if (exportDefinition != null)
- {
- return exportDefinition.ToExportingMember();
- }
-
- // Don't recognize it
- return null;
- }
-
- private string GetDisplayName()
- {
- return this.Definition.GetPartType().GetDisplayName();
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionComposablePartDefinition.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionComposablePartDefinition.cs deleted file mode 100644 index 347fa2ed8fb..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionComposablePartDefinition.cs +++ /dev/null @@ -1,151 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-using System.Diagnostics.CodeAnalysis;
-using System.Linq;
-using System.Reflection;
-using System.Threading;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- internal class ReflectionComposablePartDefinition : ComposablePartDefinition, ICompositionElement
- {
- private readonly IReflectionPartCreationInfo _creationInfo;
-
- private volatile IEnumerable<ImportDefinition> _imports;
- private volatile IEnumerable<ExportDefinition> _exports;
- private volatile IDictionary<string, object> _metadata;
- private volatile ConstructorInfo _constructor;
- private object _lock = new object();
-
- public ReflectionComposablePartDefinition(IReflectionPartCreationInfo creationInfo)
- {
- Assumes.NotNull(creationInfo);
- this._creationInfo = creationInfo;
- }
-
- public Type GetPartType()
- {
- return this._creationInfo.GetPartType();
- }
-
- public Lazy<Type> GetLazyPartType()
- {
- return this._creationInfo.GetLazyPartType();
- }
-
- public ConstructorInfo GetConstructor()
- {
- if (this._constructor == null)
- {
- ConstructorInfo constructor = this._creationInfo.GetConstructor();
- lock (this._lock)
- {
- if (this._constructor == null)
- {
- this._constructor = constructor;
- }
- }
- }
-
- return this._constructor;
- }
-
- public override IEnumerable<ExportDefinition> ExportDefinitions
- {
- get
- {
- if (this._exports == null)
- {
- ExportDefinition[] exports = this._creationInfo.GetExports().ToArray();
- lock (this._lock)
- {
- if (this._exports == null)
- {
- this._exports = exports;
- }
- }
- }
- return this._exports;
- }
- }
-
- public override IEnumerable<ImportDefinition> ImportDefinitions
- {
- get
- {
- if (this._imports == null)
- {
- ImportDefinition[] imports = this._creationInfo.GetImports().ToArray();
- lock (this._lock)
- {
- if (this._imports == null)
- {
- this._imports = imports;
- }
- }
- }
- return this._imports;
- }
- }
-
- public override IDictionary<string, object> Metadata
- {
- get
- {
- if (this._metadata == null)
- {
- IDictionary<string, object> metadata = this._creationInfo.GetMetadata().AsReadOnly();
- lock (this._lock)
- {
- if (this._metadata == null)
- {
- this._metadata = metadata;
- }
- }
- }
- return this._metadata;
- }
- }
-
- internal bool IsDisposalRequired
- {
- get
- {
- return this._creationInfo.IsDisposalRequired;
- }
- }
-
- [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
- public override ComposablePart CreatePart()
- {
- if (this.IsDisposalRequired)
- {
- return new DisposableReflectionComposablePart(this);
- }
- else
- {
- return new ReflectionComposablePart(this);
- }
- }
-
- string ICompositionElement.DisplayName
- {
- get { return this._creationInfo.DisplayName; }
- }
-
- ICompositionElement ICompositionElement.Origin
- {
- get { return this._creationInfo.Origin; }
- }
-
- public override string ToString()
- {
- return this._creationInfo.DisplayName;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionExtensions.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionExtensions.cs deleted file mode 100644 index 47a3b97dedb..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionExtensions.cs +++ /dev/null @@ -1,134 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Reflection;
-using Microsoft.Internal;
-using System.Threading;
-using System.Collections.Generic;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- internal static class ReflectionExtensions
- {
- public static ReflectionMember ToReflectionMember(this LazyMemberInfo lazyMember)
- {
- MemberInfo[] accessors = lazyMember.GetAccessors();
- MemberTypes memberType = lazyMember.MemberType;
-
- switch (memberType)
- {
- case MemberTypes.Field:
- Assumes.IsTrue(accessors.Length == 1);
- return ((FieldInfo)accessors[0]).ToReflectionField();
-
- case MemberTypes.Property:
- Assumes.IsTrue(accessors.Length == 2);
- return ReflectionExtensions.CreateReflectionProperty((MethodInfo)accessors[0], (MethodInfo)accessors[1]);
-
- case MemberTypes.NestedType:
- case MemberTypes.TypeInfo:
- return ((Type)accessors[0]).ToReflectionType();
-
- default:
- Assumes.IsTrue(memberType == MemberTypes.Method);
- return ((MethodInfo)accessors[0]).ToReflectionMethod();
- }
- }
-
- public static LazyMemberInfo ToLazyMember(this ReflectionMember reflectionMember)
- {
- Assumes.NotNull(reflectionMember);
-
- if (reflectionMember.ItemType == ReflectionItemType.Property)
- {
- ReflectionProperty reflectionProperty = reflectionMember as ReflectionProperty;
- Assumes.NotNull(reflectionProperty);
-
- MemberInfo[] accessors = new MemberInfo[] { reflectionProperty.UnderlyingGetMethod, reflectionProperty.UnderlyingSetMethod };
- return new LazyMemberInfo(MemberTypes.Property, accessors);
- }
- else
- {
- return new LazyMemberInfo(reflectionMember.UnderlyingMember.MemberType, reflectionMember.UnderlyingMember);
- }
- }
-
- public static LazyMemberInfo ToLazyMember(this MemberInfo member)
- {
- Assumes.NotNull(member);
-
- if (member.MemberType == MemberTypes.Property)
- {
- PropertyInfo property = member as PropertyInfo;
- Assumes.NotNull(property);
-
- MemberInfo[] accessors = new MemberInfo[] { property.GetGetMethod(true), property.GetSetMethod(true)};
- return new LazyMemberInfo(MemberTypes.Property, accessors);
- }
- else
- {
- return new LazyMemberInfo(member);
- }
- }
-
- public static ReflectionWritableMember ToReflectionWriteableMember(this LazyMemberInfo lazyMember)
- {
- Assumes.IsTrue((lazyMember.MemberType == MemberTypes.Field) || (lazyMember.MemberType == MemberTypes.Property));
-
- ReflectionWritableMember reflectionMember = lazyMember.ToReflectionMember() as ReflectionWritableMember;
- Assumes.NotNull(reflectionMember);
-
- return reflectionMember;
- }
-
-
- public static ReflectionProperty ToReflectionProperty(this PropertyInfo property)
- {
- Assumes.NotNull(property);
- return CreateReflectionProperty(property.GetGetMethod(true), property.GetSetMethod(true));
- }
-
- public static ReflectionProperty CreateReflectionProperty(MethodInfo getMethod, MethodInfo setMethod)
- {
- Assumes.IsTrue(getMethod != null || setMethod != null);
-
- return new ReflectionProperty(getMethod, setMethod);
- }
-
- public static ReflectionParameter ToReflectionParameter(this ParameterInfo parameter)
- {
- Assumes.NotNull(parameter);
- return new ReflectionParameter(parameter);
- }
-
- public static ReflectionMethod ToReflectionMethod(this MethodInfo method)
- {
- Assumes.NotNull(method);
- return new ReflectionMethod(method);
- }
-
- public static ReflectionField ToReflectionField(this FieldInfo field)
- {
- Assumes.NotNull(field);
- return new ReflectionField(field);
- }
-
- public static ReflectionType ToReflectionType(this Type type)
- {
- Assumes.NotNull(type);
- return new ReflectionType(type);
- }
-
- public static ReflectionWritableMember ToReflectionWritableMember(this MemberInfo member)
- {
- Assumes.NotNull(member);
- if (member.MemberType == MemberTypes.Property)
- {
- return ((PropertyInfo)member).ToReflectionProperty();
- }
-
- return ((FieldInfo)member).ToReflectionField();
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionField.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionField.cs deleted file mode 100644 index 38879361ce2..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionField.cs +++ /dev/null @@ -1,67 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Reflection;
-using Microsoft.Internal;
-using System.Threading;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- internal class ReflectionField : ReflectionWritableMember
- {
- private readonly FieldInfo _field;
-
- public ReflectionField(FieldInfo field)
- {
- Assumes.NotNull(field);
-
- this._field = field;
- }
-
- public FieldInfo UndelyingField
- {
- get { return this._field; }
- }
-
- public override MemberInfo UnderlyingMember
- {
- get { return this.UndelyingField; }
- }
-
- public override bool CanRead
- {
- get { return true; }
- }
-
- public override bool CanWrite
- {
- get { return !this.UndelyingField.IsInitOnly; }
- }
-
- public override bool RequiresInstance
- {
- get { return !this.UndelyingField.IsStatic; }
- }
-
- public override Type ReturnType
- {
- get { return this.UndelyingField.FieldType; }
- }
-
- public override ReflectionItemType ItemType
- {
- get { return ReflectionItemType.Field; }
- }
-
- public override object GetValue(object instance)
- {
- return this.UndelyingField.SafeGetValue(instance);
- }
-
- public override void SetValue(object instance, object value)
- {
- this.UndelyingField.SafeSetValue(instance, value);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionImportDefinition.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionImportDefinition.cs deleted file mode 100644 index 95f61bcecba..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionImportDefinition.cs +++ /dev/null @@ -1,52 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.ReflectionModel;
-using System.Globalization;
-using System.Reflection;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- internal abstract class ReflectionImportDefinition : ContractBasedImportDefinition, ICompositionElement
- {
- private readonly ICompositionElement _origin;
-
- public ReflectionImportDefinition(
- string contractName,
- string requiredTypeIdentity,
- IEnumerable<KeyValuePair<string, Type>> requiredMetadata,
- ImportCardinality cardinality,
- bool isRecomposable,
- bool isPrerequisite,
- CreationPolicy requiredCreationPolicy,
- ICompositionElement origin)
- : base(contractName, requiredTypeIdentity, requiredMetadata, cardinality, isRecomposable, isPrerequisite, requiredCreationPolicy)
- {
- this._origin = origin;
- }
-
- string ICompositionElement.DisplayName
- {
- get { return this.GetDisplayName(); }
- }
-
- ICompositionElement ICompositionElement.Origin
- {
- get { return this._origin; }
- }
-
- public override string ToString()
- {
- return this.GetDisplayName();
- }
-
- public abstract ImportingItem ToImportingItem();
-
- protected abstract string GetDisplayName();
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionItem.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionItem.cs deleted file mode 100644 index 97420f14bc6..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionItem.cs +++ /dev/null @@ -1,16 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Reflection;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- internal abstract class ReflectionItem
- {
- public abstract string Name { get; }
- public abstract string GetDisplayName();
- public abstract Type ReturnType { get; }
- public abstract ReflectionItemType ItemType { get; }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionItemType.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionItemType.cs deleted file mode 100644 index 2607fecaad8..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionItemType.cs +++ /dev/null @@ -1,16 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- internal enum ReflectionItemType : int
- {
- Parameter = 0,
- Field = 1,
- Property = 2,
- Method = 3,
- Type = 4,
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionMember.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionMember.cs deleted file mode 100644 index 9ccbc4d55e9..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionMember.cs +++ /dev/null @@ -1,42 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Reflection;
-using Microsoft.Internal;
-using System.Threading;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- internal abstract class ReflectionMember : ReflectionItem
- {
- public abstract bool CanRead
- {
- get;
- }
-
- public Type DeclaringType
- {
- get { return this.UnderlyingMember.DeclaringType; }
- }
-
- public override string Name
- {
- get { return this.UnderlyingMember.Name; }
- }
-
- public override string GetDisplayName()
- {
- return this.UnderlyingMember.GetDisplayName();
- }
-
- public abstract bool RequiresInstance
- {
- get;
- }
-
- public abstract MemberInfo UnderlyingMember { get; }
-
- public abstract object GetValue(object instance);
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionMemberExportDefinition.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionMemberExportDefinition.cs deleted file mode 100644 index ac81434fbb6..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionMemberExportDefinition.cs +++ /dev/null @@ -1,89 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.ComponentModel.Composition.ReflectionModel;
-using System.Globalization;
-using System.Reflection;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-using System.Threading;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- internal class ReflectionMemberExportDefinition : ExportDefinition, ICompositionElement
- {
- private readonly LazyMemberInfo _member;
- private readonly ExportDefinition _exportDefinition;
- private readonly ICompositionElement _origin;
- private IDictionary<string, object> _metadata;
-
- public ReflectionMemberExportDefinition(LazyMemberInfo member, ExportDefinition exportDefinition, ICompositionElement origin)
- {
- Assumes.NotNull(exportDefinition);
-
- this._member = member;
- this._exportDefinition = exportDefinition;
- this._origin = origin;
- }
-
- public override string ContractName
- {
- get { return this._exportDefinition.ContractName; }
- }
-
- public LazyMemberInfo ExportingLazyMember
- {
- get { return this._member; }
- }
-
- public override IDictionary<string, object> Metadata
- {
- get
- {
- if (this._metadata == null)
- {
- var metadata = this._exportDefinition.Metadata ?? MetadataServices.EmptyMetadata;
- this._metadata = metadata.AsReadOnly();
- }
- return this._metadata;
- }
- }
-
- string ICompositionElement.DisplayName
- {
- get { return this.GetDisplayName(); }
- }
-
- ICompositionElement ICompositionElement.Origin
- {
- get { return this._origin; }
- }
-
- public override string ToString()
- {
- return this.GetDisplayName();
- }
-
- public ExportingMember ToExportingMember()
- {
- return new ExportingMember(this, this.ToReflectionMember());
- }
-
- private ReflectionMember ToReflectionMember()
- {
- return this.ExportingLazyMember.ToReflectionMember();
- }
-
- private string GetDisplayName()
- {
- return string.Format(CultureInfo.CurrentCulture,
- "{0} (ContractName=\"{1}\")", // NOLOC
- this.ToReflectionMember().GetDisplayName(),
- this.ContractName);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionMemberImportDefinition.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionMemberImportDefinition.cs deleted file mode 100644 index af179fb86ef..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionMemberImportDefinition.cs +++ /dev/null @@ -1,56 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.ReflectionModel;
-using System.Globalization;
-using System.Reflection;
-using Microsoft.Internal;
-using Microsoft.Internal.Collections;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- internal class ReflectionMemberImportDefinition : ReflectionImportDefinition
- {
- private LazyMemberInfo _importingLazyMember;
-
- public ReflectionMemberImportDefinition(
- LazyMemberInfo importingLazyMember,
- string contractName,
- string requiredTypeIdentity,
- IEnumerable<KeyValuePair<string, Type>> requiredMetadata,
- ImportCardinality cardinality,
- bool isRecomposable,
- CreationPolicy requiredCreationPolicy,
- ICompositionElement origin)
- : base(contractName, requiredTypeIdentity, requiredMetadata, cardinality, isRecomposable, false, requiredCreationPolicy, origin)
- {
- Assumes.NotNull(contractName);
-
- this._importingLazyMember = importingLazyMember;
- }
-
- public override ImportingItem ToImportingItem()
- {
- ReflectionWritableMember member = this.ImportingLazyMember.ToReflectionWriteableMember();
- return new ImportingMember(this, member, new ImportType(member.ReturnType, this.Cardinality));
- }
-
- public LazyMemberInfo ImportingLazyMember
- {
- get { return this._importingLazyMember; }
- }
-
- protected override string GetDisplayName()
- {
- return string.Format(
- CultureInfo.CurrentCulture,
- "{0} (ContractName=\"{1}\")", // NOLOC
- this.ImportingLazyMember.ToReflectionMember().GetDisplayName(),
- this.ContractName);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionMethod.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionMethod.cs deleted file mode 100644 index 9dd963ddb09..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionMethod.cs +++ /dev/null @@ -1,70 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Hosting;
-using System.Reflection;
-using Microsoft.Internal;
-using System.Threading;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- internal partial class ReflectionMethod : ReflectionMember
- {
- private readonly MethodInfo _method;
-
- public ReflectionMethod(MethodInfo method)
- {
- Assumes.NotNull(method);
-
- this._method = method;
- }
-
- public MethodInfo UnderlyingMethod
- {
- get { return this._method; }
- }
-
- public override MemberInfo UnderlyingMember
- {
- get { return this.UnderlyingMethod; }
- }
-
- public override bool CanRead
- {
- get { return true; }
- }
-
- public override bool RequiresInstance
- {
- get { return !this.UnderlyingMethod.IsStatic; }
- }
-
- public override Type ReturnType
- {
- get { return this.UnderlyingMethod.ReturnType; }
- }
-
- public override ReflectionItemType ItemType
- {
- get { return ReflectionItemType.Method; }
- }
-
- public override object GetValue(object instance)
- {
- return SafeCreateExportedDelegate(instance, _method);
- }
-#if !SILVERLIGHT
- [System.Security.SecuritySafeCritical]
-#endif
- private static ExportedDelegate SafeCreateExportedDelegate(object instance, MethodInfo method)
- {
- // We demand member access in place of the [SecurityCritical]
- // attribute on ExportDelegate constructor
- ReflectionInvoke.DemandMemberAccessIfNeeded(method);
-
- return new ExportedDelegate(instance, method);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionModelServices.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionModelServices.cs deleted file mode 100644 index 72cd0f817f3..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionModelServices.cs +++ /dev/null @@ -1,444 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-using System.Diagnostics.CodeAnalysis;
-using System.Globalization;
-using System.Linq;
-using System.Reflection;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
-#if !SILVERLIGHT
- [System.Security.SecurityCritical]
-#endif
- public static class ReflectionModelServices
- {
- public static Lazy<Type> GetPartType(ComposablePartDefinition partDefinition)
- {
- Requires.NotNull(partDefinition, "partDefinition");
-
- ReflectionComposablePartDefinition reflectionPartDefinition = partDefinition as ReflectionComposablePartDefinition;
- if (reflectionPartDefinition == null)
- {
- throw new ArgumentException(
- string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidPartDefinition, partDefinition.GetType()),
- "partDefinition");
- }
-
- return reflectionPartDefinition.GetLazyPartType();
- }
-
- public static bool IsDisposalRequired(ComposablePartDefinition partDefinition)
- {
- Requires.NotNull(partDefinition, "partDefinition");
-
- ReflectionComposablePartDefinition reflectionPartDefinition = partDefinition as ReflectionComposablePartDefinition;
- if (reflectionPartDefinition == null)
- {
- throw new ArgumentException(
- string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidPartDefinition, partDefinition.GetType()),
- "partDefinition");
- }
-
- return reflectionPartDefinition.IsDisposalRequired;
- }
-
- public static LazyMemberInfo GetExportingMember(ExportDefinition exportDefinition)
- {
- Requires.NotNull(exportDefinition, "exportDefinition");
-
- ReflectionMemberExportDefinition reflectionExportDefinition = exportDefinition as ReflectionMemberExportDefinition;
- if (reflectionExportDefinition == null)
- {
- throw new ArgumentException(
- string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidExportDefinition, exportDefinition.GetType()),
- "exportDefinition");
- }
-
- return reflectionExportDefinition.ExportingLazyMember;
- }
-
- public static LazyMemberInfo GetImportingMember(ImportDefinition importDefinition)
- {
- Requires.NotNull(importDefinition, "importDefinition");
-
- ReflectionMemberImportDefinition reflectionMemberImportDefinition = importDefinition as ReflectionMemberImportDefinition;
- if (reflectionMemberImportDefinition == null)
- {
- throw new ArgumentException(
- string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidMemberImportDefinition, importDefinition.GetType()),
- "importDefinition");
- }
-
- return reflectionMemberImportDefinition.ImportingLazyMember;
- }
-
- public static Lazy<ParameterInfo> GetImportingParameter(ImportDefinition importDefinition)
- {
- Requires.NotNull(importDefinition, "importDefinition");
-
- ReflectionParameterImportDefinition reflectionParameterImportDefinition = importDefinition as ReflectionParameterImportDefinition;
- if (reflectionParameterImportDefinition == null)
- {
- throw new ArgumentException(
- string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidParameterImportDefinition, importDefinition.GetType()),
- "importDefinition");
- }
-
- return reflectionParameterImportDefinition.ImportingLazyParameter;
- }
-
- public static bool IsImportingParameter(ImportDefinition importDefinition)
- {
- Requires.NotNull(importDefinition, "importDefinition");
-
- ReflectionImportDefinition reflectionImportDefinition = importDefinition as ReflectionImportDefinition;
- if (reflectionImportDefinition == null)
- {
- throw new ArgumentException(
- string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidImportDefinition, importDefinition.GetType()),
- "importDefinition");
- }
-
- return (importDefinition is ReflectionParameterImportDefinition);
- }
-
- internal static bool IsExportFactoryImportDefinition(ImportDefinition importDefinition)
- {
- Requires.NotNull(importDefinition, "importDefinition");
-
- ReflectionImportDefinition reflectionImportDefinition = importDefinition as ReflectionImportDefinition;
- if (reflectionImportDefinition == null)
- {
- throw new ArgumentException(
- string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidImportDefinition, importDefinition.GetType()),
- "importDefinition");
- }
-
- return (importDefinition is IPartCreatorImportDefinition);
- }
-
- internal static ContractBasedImportDefinition GetPartCreatorProductImportDefinition(ImportDefinition importDefinition)
- {
- Requires.NotNull(importDefinition, "importDefinition");
-
- IPartCreatorImportDefinition partCreatorImportDefinition = importDefinition as IPartCreatorImportDefinition;
- if (partCreatorImportDefinition == null)
- {
- throw new ArgumentException(
- string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidImportDefinition, importDefinition.GetType()),
- "importDefinition");
- }
-
- return partCreatorImportDefinition.ProductImportDefinition;
- }
-
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
- public static ComposablePartDefinition CreatePartDefinition(
- Lazy<Type> partType,
- bool isDisposalRequired,
- Lazy<IEnumerable<ImportDefinition>> imports,
- Lazy<IEnumerable<ExportDefinition>> exports,
- Lazy<IDictionary<string, object>> metadata,
- ICompositionElement origin)
- {
- Requires.NotNull(partType, "partType");
-
- return new ReflectionComposablePartDefinition(
- new ReflectionPartCreationInfo(
- partType,
- isDisposalRequired,
- imports,
- exports,
- metadata,
- origin));
- }
-
- [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
- public static ExportDefinition CreateExportDefinition(
- LazyMemberInfo exportingMember,
- string contractName,
- Lazy<IDictionary<string, object>> metadata,
- ICompositionElement origin)
- {
- Requires.NotNullOrEmpty(contractName, "contractName");
- Requires.IsInMembertypeSet(exportingMember.MemberType, "exportingMember", MemberTypes.Field | MemberTypes.Property | MemberTypes.NestedType | MemberTypes.TypeInfo | MemberTypes.Method);
-
- return new ReflectionMemberExportDefinition(
- exportingMember,
- new LazyExportDefinition(contractName, metadata),
- origin);
- }
-
- [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
- public static ContractBasedImportDefinition CreateImportDefinition(
- LazyMemberInfo importingMember,
- string contractName,
- string requiredTypeIdentity,
- IEnumerable<KeyValuePair<string, Type>> requiredMetadata,
- ImportCardinality cardinality,
- bool isRecomposable,
- CreationPolicy requiredCreationPolicy,
- ICompositionElement origin)
- {
- return CreateImportDefinition(importingMember, contractName, requiredTypeIdentity, requiredMetadata, cardinality, isRecomposable, requiredCreationPolicy, false, origin);
- }
-
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
- internal static ContractBasedImportDefinition CreateImportDefinition(
- LazyMemberInfo importingMember,
- string contractName,
- string requiredTypeIdentity,
- IEnumerable<KeyValuePair<string, Type>> requiredMetadata,
- ImportCardinality cardinality,
- bool isRecomposable,
- CreationPolicy requiredCreationPolicy,
- bool isExportFactory,
- ICompositionElement origin)
- {
- Requires.NotNullOrEmpty(contractName, "contractName");
- Requires.IsInMembertypeSet(importingMember.MemberType, "importingMember", MemberTypes.Property | MemberTypes.Field);
-
- if (isExportFactory)
- {
- return new PartCreatorMemberImportDefinition(
- importingMember,
- origin,
- new ContractBasedImportDefinition(
- contractName,
- requiredTypeIdentity,
- requiredMetadata,
- cardinality,
- isRecomposable,
- false,
- CreationPolicy.NonShared));
- }
- else
- {
- return new ReflectionMemberImportDefinition(
- importingMember,
- contractName,
- requiredTypeIdentity,
- requiredMetadata,
- cardinality,
- isRecomposable,
- requiredCreationPolicy,
- origin);
- }
- }
-
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
- public static ContractBasedImportDefinition CreateImportDefinition(
- Lazy<ParameterInfo> parameter,
- string contractName,
- string requiredTypeIdentity,
- IEnumerable<KeyValuePair<string, Type>> requiredMetadata,
- ImportCardinality cardinality,
- CreationPolicy requiredCreationPolicy,
- ICompositionElement origin)
- {
- return CreateImportDefinition(parameter, contractName, requiredTypeIdentity, requiredMetadata, cardinality, requiredCreationPolicy, false, origin);
- }
-
- [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
- internal static ContractBasedImportDefinition CreateImportDefinition(
- Lazy<ParameterInfo> parameter,
- string contractName,
- string requiredTypeIdentity,
- IEnumerable<KeyValuePair<string, Type>> requiredMetadata,
- ImportCardinality cardinality,
- CreationPolicy requiredCreationPolicy,
- bool isExportFactory,
- ICompositionElement origin)
- {
- Requires.NotNull(parameter, "parameter");
- Requires.NotNullOrEmpty(contractName, "contractName");
-
- if (isExportFactory)
- {
- return new PartCreatorParameterImportDefinition(
- parameter,
- origin,
- new ContractBasedImportDefinition(
- contractName,
- requiredTypeIdentity,
- requiredMetadata,
- cardinality,
- false,
- true,
- CreationPolicy.NonShared));
- }
- else
- {
- return new ReflectionParameterImportDefinition(
- parameter,
- contractName,
- requiredTypeIdentity,
- requiredMetadata,
- cardinality,
- requiredCreationPolicy,
- origin);
- }
- }
- }
- internal class ReflectionPartCreationInfo : IReflectionPartCreationInfo
- {
- private readonly Lazy<Type> _partType;
- private readonly Lazy<IEnumerable<ImportDefinition>> _imports;
- private readonly Lazy<IEnumerable<ExportDefinition>> _exports;
- private readonly Lazy<IDictionary<string, object>> _metadata;
- private readonly ICompositionElement _origin;
- private ConstructorInfo _constructor;
- private bool _isDisposalRequired;
-
- public ReflectionPartCreationInfo(
- Lazy<Type> partType,
- bool isDisposalRequired,
- Lazy<IEnumerable<ImportDefinition>> imports,
- Lazy<IEnumerable<ExportDefinition>> exports,
- Lazy<IDictionary<string, object>> metadata,
- ICompositionElement origin)
- {
- Assumes.NotNull(partType);
-
- this._partType = partType;
- this._isDisposalRequired = isDisposalRequired;
- this._imports = imports;
- this._exports = exports;
- this._metadata = metadata;
- this._origin = origin;
- }
-
- public Type GetPartType()
- {
- return this._partType.GetNotNullValue("type");
- }
-
- public Lazy<Type> GetLazyPartType()
- {
- return this._partType;
- }
-
- public ConstructorInfo GetConstructor()
- {
- if (this._constructor == null)
- {
- ConstructorInfo[] constructors = null;
- constructors = this.GetImports()
- .OfType<ReflectionParameterImportDefinition>()
- .Select(parameterImport => parameterImport.ImportingLazyParameter.Value.Member)
- .OfType<ConstructorInfo>()
- .Distinct()
- .ToArray();
-
- if (constructors.Length == 1)
- {
- this._constructor = constructors[0];
- }
- else if (constructors.Length == 0)
- {
- this._constructor = this.GetPartType().GetConstructor(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, null, Type.EmptyTypes, null);
- }
- }
- return this._constructor;
- }
-
- public bool IsDisposalRequired
- {
- get
- {
- return this._isDisposalRequired;
- }
- }
-
- public IDictionary<string, object> GetMetadata()
- {
- return (this._metadata != null) ? this._metadata.Value : null;
- }
-
- public IEnumerable<ExportDefinition> GetExports()
- {
- if (this._exports == null)
- {
- yield break;
- }
-
- IEnumerable<ExportDefinition> exports = this._exports.Value;
-
- if (exports == null)
- {
- yield break;
- }
-
- foreach (ExportDefinition export in exports)
- {
- ReflectionMemberExportDefinition reflectionExport = export as ReflectionMemberExportDefinition;
- if (reflectionExport == null)
- {
- throw new InvalidOperationException(
- string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidExportDefinition, export.GetType()));
- }
- yield return reflectionExport;
- }
- }
-
- public IEnumerable<ImportDefinition> GetImports()
- {
- if (this._imports == null)
- {
- yield break;
- }
-
- IEnumerable<ImportDefinition> imports = this._imports.Value;
-
- if (imports == null)
- {
- yield break;
- }
-
- foreach (ImportDefinition import in imports)
- {
- ReflectionImportDefinition reflectionImport = import as ReflectionImportDefinition;
- if (reflectionImport == null)
- {
- throw new InvalidOperationException(
- string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidMemberImportDefinition, import.GetType()));
- }
- yield return reflectionImport;
- }
- }
-
- public string DisplayName
- {
- get { return this.GetPartType().GetDisplayName(); }
- }
-
- public ICompositionElement Origin
- {
- get { return this._origin; }
- }
- }
-
- internal class LazyExportDefinition : ExportDefinition
- {
- private readonly Lazy<IDictionary<string, object>> _metadata;
-
- public LazyExportDefinition(string contractName, Lazy<IDictionary<string, object>> metadata)
- : base(contractName, (IDictionary<string, object>)null)
- {
- this._metadata = metadata;
- }
-
- public override IDictionary<string, object> Metadata
- {
- get
- {
- return this._metadata.Value;
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionParameter.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionParameter.cs deleted file mode 100644 index 75312471560..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionParameter.cs +++ /dev/null @@ -1,52 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Globalization;
-using System.Reflection;
-using Microsoft.Internal;
-using System.Threading;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- internal class ReflectionParameter : ReflectionItem
- {
- private readonly ParameterInfo _parameter;
-
- public ReflectionParameter(ParameterInfo parameter)
- {
- Assumes.NotNull(parameter);
-
- this._parameter = parameter;
- }
-
- public ParameterInfo UnderlyingParameter
- {
- get { return this._parameter; }
- }
-
- public override string Name
- {
- get { return this.UnderlyingParameter.Name; }
- }
-
- public override string GetDisplayName()
- {
- return string.Format(
- CultureInfo.CurrentCulture,
- "{0} (Parameter=\"{1}\")", // NOLOC
- this.UnderlyingParameter.Member.GetDisplayName(),
- this.UnderlyingParameter.Name);
- }
-
- public override Type ReturnType
- {
- get { return this.UnderlyingParameter.ParameterType; }
- }
-
- public override ReflectionItemType ItemType
- {
- get { return ReflectionItemType.Parameter; }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionParameterImportDefinition.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionParameterImportDefinition.cs deleted file mode 100644 index 93e62387413..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionParameterImportDefinition.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Globalization;
-using System.Reflection;
-using Microsoft.Internal;
-using System.ComponentModel.Composition.ReflectionModel;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-using System.Threading;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- internal class ReflectionParameterImportDefinition : ReflectionImportDefinition
- {
- private Lazy<ParameterInfo> _importingLazyParameter;
-
- public ReflectionParameterImportDefinition(
- Lazy<ParameterInfo> importingLazyParameter,
- string contractName,
- string requiredTypeIdentity,
- IEnumerable<KeyValuePair<string,Type>> requiredMetadata,
- ImportCardinality cardinality,
- CreationPolicy requiredCreationPolicy,
- ICompositionElement origin)
- : base(contractName, requiredTypeIdentity, requiredMetadata, cardinality, false, true, requiredCreationPolicy, origin)
- {
- Assumes.NotNull(importingLazyParameter);
-
- this._importingLazyParameter = importingLazyParameter;
- }
-
- public override ImportingItem ToImportingItem()
- {
- return new ImportingParameter(this, new ImportType(this.ImportingLazyParameter.GetNotNullValue("parameter").ParameterType, this.Cardinality));
- }
-
- public Lazy<ParameterInfo> ImportingLazyParameter
- {
- get { return this._importingLazyParameter; }
- }
-
- protected override string GetDisplayName()
- {
- ParameterInfo parameter = this.ImportingLazyParameter.GetNotNullValue("parameter");
- return string.Format(
- CultureInfo.CurrentCulture,
- "{0} (Parameter=\"{1}\", ContractName=\"{2}\")", // NOLOC
- parameter.Member.GetDisplayName(),
- parameter.Name,
- this.ContractName);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionProperty.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionProperty.cs deleted file mode 100644 index af62622fa9e..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionProperty.cs +++ /dev/null @@ -1,124 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Reflection;
-using Microsoft.Internal;
-using System.Threading;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- // Instead of representing properties as an actual PropertyInfo, we need to
- // represent them as two MethodInfo objects one for each accessor. This is so
- // that cached attribute part can go from a metadata token -> XXXInfo without
- // needing to walk all members of a particular type. Unfortunately, (probably
- // because you never see one of them in an IL stream), Reflection does not allow
- // you to go from a metadata token -> PropertyInfo like it does with types,
- // fields, and methods.
-
- internal class ReflectionProperty : ReflectionWritableMember
- {
- private readonly MethodInfo _getMethod;
- private readonly MethodInfo _setMethod;
-
- public ReflectionProperty(MethodInfo getMethod, MethodInfo setMethod)
- {
- Assumes.IsTrue(getMethod != null || setMethod != null);
-
- this._getMethod = getMethod;
- this._setMethod = setMethod;
- }
-
- public override MemberInfo UnderlyingMember
- {
- get { return this.UnderlyingGetMethod ?? this.UnderlyingSetMethod; }
- }
-
- public override bool CanRead
- {
- get { return this.UnderlyingGetMethod != null; }
- }
-
- public override bool CanWrite
- {
- get { return this.UnderlyingSetMethod != null; }
- }
-
- public MethodInfo UnderlyingGetMethod
- {
- get { return this._getMethod; }
- }
-
- public MethodInfo UnderlyingSetMethod
- {
- get { return this._setMethod; }
- }
-
- public override string Name
- {
- get
- {
- MethodInfo method = this.UnderlyingGetMethod ?? this.UnderlyingSetMethod;
-
- string name = method.Name;
-
- Assumes.IsTrue(name.Length > 4);
-
- // Remove 'get_' or 'set_'
- return name.Substring(4);
- }
- }
-
- public override string GetDisplayName()
- {
- return ReflectionServices.GetDisplayName(this.DeclaringType, this.Name);
- }
-
- public override bool RequiresInstance
- {
- get
- {
- MethodInfo method = this.UnderlyingGetMethod ?? this.UnderlyingSetMethod;
-
- return !method.IsStatic;
- }
- }
-
- public override Type ReturnType
- {
- get
- {
- if (this.UnderlyingGetMethod != null)
- {
- return this.UnderlyingGetMethod.ReturnType;
- }
-
- ParameterInfo[] parameters = this.UnderlyingSetMethod.GetParameters();
-
- Assumes.IsTrue(parameters.Length > 0);
-
- return parameters[parameters.Length - 1].ParameterType;
- }
- }
-
- public override ReflectionItemType ItemType
- {
- get { return ReflectionItemType.Property; }
- }
-
- public override object GetValue(object instance)
- {
- Assumes.NotNull(this._getMethod);
-
- return this.UnderlyingGetMethod.SafeInvoke(instance);
- }
-
- public override void SetValue(object instance, object value)
- {
- Assumes.NotNull(this._setMethod);
-
- this.UnderlyingSetMethod.SafeInvoke(instance, value);
- }
-
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionType.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionType.cs deleted file mode 100644 index 6d754d516a0..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionType.cs +++ /dev/null @@ -1,58 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.AttributedModel;
-using System.Reflection;
-using Microsoft.Internal;
-using System.Threading;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- internal class ReflectionType : ReflectionMember
- {
- private Type _type;
-
- public ReflectionType(Type type)
- {
- Assumes.NotNull(type);
-
- this._type = type;
- }
-
- public override MemberInfo UnderlyingMember
- {
- get { return this._type; }
- }
-
- public Type UnderlyingType
- {
- get { return this._type; }
- }
-
- public override bool CanRead
- {
- get { return true; }
- }
-
- public override bool RequiresInstance
- {
- get { return true; }
- }
-
- public override Type ReturnType
- {
- get { return this._type; }
- }
-
- public override ReflectionItemType ItemType
- {
- get { return ReflectionItemType.Type; }
- }
-
- public override object GetValue(object instance)
- {
- return instance;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionWritableMember.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionWritableMember.cs deleted file mode 100644 index 7640b3b1749..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionWritableMember.cs +++ /dev/null @@ -1,19 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Reflection;
-using Microsoft.Internal;
-
-namespace System.ComponentModel.Composition.ReflectionModel
-{
- internal abstract class ReflectionWritableMember : ReflectionMember
- {
- public abstract bool CanWrite
- {
- get;
- }
-
- public abstract void SetValue(object instance, object value);
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/Lazy.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/Lazy.cs deleted file mode 100644 index 6d3b11acfb3..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/Lazy.cs +++ /dev/null @@ -1,80 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-#if !CLR40
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using Microsoft.Internal;
-
-namespace System
-{
- public class Lazy<T>
- {
- private T _value = default(T);
- private volatile bool _isValueCreated = false;
- private Func<T> _valueFactory = null;
- private object _lock;
-
- public Lazy()
- : this(() => Activator.CreateInstance<T>())
- {
- }
-
- public Lazy(bool isThreadSafe)
- : this(() => Activator.CreateInstance<T>(), isThreadSafe)
- {
- }
-
- public Lazy(Func<T> valueFactory):
- this(valueFactory, true)
- {
- }
-
- public Lazy(Func<T> valueFactory, bool isThreadSafe)
- {
- Requires.NotNull(valueFactory, "valueFactory");
- if(isThreadSafe)
- {
- this._lock = new object();
- }
-
- this._valueFactory = valueFactory;
- }
-
-
- public T Value
- {
- get
- {
- if (!this._isValueCreated)
- {
- if(this._lock != null)
- {
- Monitor.Enter(this._lock);
- }
-
- try
- {
- T value = this._valueFactory.Invoke();
- this._valueFactory = null;
- Thread.MemoryBarrier();
- this._value = value;
- this._isValueCreated = true;
- }
- finally
- {
- if(this._lock != null)
- {
- Monitor.Exit(this._lock);
- }
- }
- }
- return this._value;
- }
- }
- }
-}
-#endif
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/LazyOfTTMetadata.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/LazyOfTTMetadata.cs deleted file mode 100644 index 287babe3abd..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/LazyOfTTMetadata.cs +++ /dev/null @@ -1,51 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace System
-{
-#if CLR40 && !SILVERLIGHT
- [Serializable]
-#endif
- public class Lazy<T, TMetadata> : Lazy<T>
- {
- private TMetadata _metadata;
-
- public Lazy(Func<T> valueFactory, TMetadata metadata) :
- base(valueFactory)
- {
- this._metadata = metadata;
- }
-
- public Lazy(TMetadata metadata) :
- base()
- {
- this._metadata = metadata;
- }
-
-
- public Lazy(TMetadata metadata, bool isThreadSafe) :
- base(isThreadSafe)
- {
- this._metadata = metadata;
- }
-
- public Lazy(Func<T> valueFactory, TMetadata metadata, bool isThreadSafe) :
- base(valueFactory, isThreadSafe)
- {
- this._metadata = metadata;
- }
-
- public TMetadata Metadata
- {
- get
- {
- return this._metadata;
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/Tuple.cs b/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/Tuple.cs deleted file mode 100644 index 03a48286d3c..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/ComponentModel/System/Tuple.cs +++ /dev/null @@ -1,52 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-#if !CLR40
-using System;
-
-namespace System
-{
- // This is a very minimalistic implementation of Tuple'2 that allows us
- // to compile and work on versions of .Net eariler then 4.0.
- public struct Tuple<TItem1, TItem2>
- {
- public Tuple(TItem1 item1, TItem2 item2)
- {
- this = new Tuple<TItem1, TItem2>();
- this.Item1 = item1;
- this.Item2 = item2;
- }
-
- public TItem1 Item1 { get; private set; }
- public TItem2 Item2 { get; private set; }
-
- public override bool Equals(object obj)
- {
- if (obj is Tuple<TItem1, TItem2>)
- {
- Tuple<TItem1, TItem2> that = (Tuple<TItem1, TItem2>)obj;
- return object.Equals(this.Item1, that.Item1) && object.Equals(this.Item2, that.Item2);
- }
- else
- {
- return false;
- }
- }
-
- public override int GetHashCode()
- {
- return ((this.Item1 != null) ? this.Item1.GetHashCode() : 0) ^ ((this.Item2 != null) ? this.Item2.GetHashCode() : 0);
- }
-
- public static bool operator ==(Tuple<TItem1, TItem2> left, Tuple<TItem1, TItem2> right)
- {
- return left.Equals(right);
- }
-
- public static bool operator !=(Tuple<TItem1, TItem2> left, Tuple<TItem1, TItem2> right)
- {
- return !left.Equals(right);
- }
- }
-}
-#endif
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/.gitattributes b/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/.gitattributes deleted file mode 100644 index 76da6c303b5..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/.gitattributes +++ /dev/null @@ -1,4 +0,0 @@ -/AssemblyInfo.cs -crlf -/Strings.Designer.cs -crlf -/Strings.resx -crlf -/SuppressMessages.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/AssemblyInfo.cs b/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/AssemblyInfo.cs deleted file mode 100644 index 50e0aec6670..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/AssemblyInfo.cs +++ /dev/null @@ -1,7 +0,0 @@ -//------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//------------------------------------------------------------
-[assembly: System.CLSCompliant(true)]
-[assembly: System.Reflection.AssemblyTitle("System.ComponentModel.Composition.Initialization")]
-[assembly: System.Reflection.AssemblyCopyright("(c) Microsoft Corporation. All rights reserved.")]
-[assembly: System.Reflection.AssemblyVersion("2010.02.11")]
diff --git a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Composition.Initialization.csproj b/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Composition.Initialization.csproj deleted file mode 100644 index c9e17ab9b17..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Composition.Initialization.csproj +++ /dev/null @@ -1,101 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
- <CodeAnalysisRuleSet>Migrated rules for Composition.Initialization.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules />
- </PropertyGroup>
- <PropertyGroup>
- <OutputPath>..\..\bin</OutputPath>
- <DefineConstants>$(DefineConstants);TRACE</DefineConstants>
- <NoWarn>1570;1572;1573;1591;1699</NoWarn>
- </PropertyGroup>
- <PropertyGroup>
- <ProjectClrTypes>FULLCLR;SILVERLIGHT</ProjectClrTypes>
- <ProductVersion>10.0.20805</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <OutputType>Library</OutputType>
- <AssemblyName>System.ComponentModel.Composition.Initialization</AssemblyName>
- <RootNamespace>System.ComponentModel.Composition.Initialization</RootNamespace>
- <DocumentationFile>$(OutputPath)\System.ComponentModel.Composition.Initialization.xml</DocumentationFile>
- <ProjectGuid>{A497DC28-0A3B-4BAD-B964-B8B436686D98}</ProjectGuid>
- <PublishUrl>publish\</PublishUrl>
- <Install>true</Install>
- <InstallFrom>Disk</InstallFrom>
- <UpdateEnabled>false</UpdateEnabled>
- <UpdateMode>Foreground</UpdateMode>
- <UpdateInterval>7</UpdateInterval>
- <UpdateIntervalUnits>Days</UpdateIntervalUnits>
- <UpdatePeriodically>false</UpdatePeriodically>
- <UpdateRequired>false</UpdateRequired>
- <MapFileExtensions>true</MapFileExtensions>
- <ApplicationRevision>0</ApplicationRevision>
- <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
- <IsWebBootstrapper>false</IsWebBootstrapper>
- <UseApplicationTrust>false</UseApplicationTrust>
- <BootstrapperEnabled>true</BootstrapperEnabled>
- </PropertyGroup>
- <PropertyGroup>
- <SignAssembly>true</SignAssembly>
- <NoStdLib>true</NoStdLib>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="mscorlib" />
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Net" />
- <Reference Include="System.Xml" />
- <ProjectReference Include="..\ComponentModel\ComponentModel.csproj">
- <Project>{1BBA5101-D4F0-48B8-A5D6-7B23A099DCE3}</Project>
- <Name>ComponentModel</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup Condition="'$(IsSilverLight)' == 'true'">
- <Reference Include="System.Windows" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CompositionHost.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionInitializer.AssemblyList.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionInitializer.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\DeploymentCatalog.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\Package.cs" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="AssemblyInfo.cs" />
- <Compile Include="Microsoft\Internal\Lock.cs" />
- <Compile Include="Microsoft\Internal\Lock.Reader.cs" />
- <Compile Include="Microsoft\Internal\Lock.Writer.cs" />
- <Compile Include="Microsoft\Internal\Requires.cs" />
- <Compile Include="Strings.Designer.cs">
- <AutoGen>True</AutoGen>
- <DesignTime>True</DesignTime>
- <DependentUpon>Strings.resx</DependentUpon>
- </Compile>
- <Compile Include="SuppressMessages.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportFactoryOfT.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportFactoryOfTTMetadata.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportLifetimeContextOfT.cs" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Strings.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>Strings.Designer.cs</LastGenOutput>
- <SubType>Designer</SubType>
- </EmbeddedResource>
- </ItemGroup>
- <ItemGroup>
- <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
- <Install>false</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
- <Visible>False</Visible>
- <ProductName>Windows Installer 3.1</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
-</Project>
diff --git a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Composition.InitializationSL.csproj b/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Composition.InitializationSL.csproj deleted file mode 100644 index 27a77b8040d..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Composition.InitializationSL.csproj +++ /dev/null @@ -1,111 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
- <CodeAnalysisRuleSet>Migrated rules for Composition.Initialization.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules />
- </PropertyGroup>
- <PropertyGroup>
- <IsSilverlight>true</IsSilverlight>
- <DefineConstants>$(DefineConstants);SILVERLIGHT</DefineConstants>
- <ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
- <OutputPath>..\..\bin\SL</OutputPath>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
- <NoWarn>1570;1572;1573;1591;1699</NoWarn>
- </PropertyGroup>
- <PropertyGroup>
- <ProjectClrTypes>FULLCLR;SILVERLIGHT</ProjectClrTypes>
- <ProductVersion>9.0.30729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <OutputType>Library</OutputType>
- <AssemblyName>System.ComponentModel.Composition.Initialization</AssemblyName>
- <RootNamespace>System.ComponentModel.Composition.Initialization</RootNamespace>
- <DocumentationFile>$(OutputPath)\System.ComponentModel.Composition.Initialization.xml</DocumentationFile>
- <ProjectGuid>{A497DC28-0A3B-4BAD-B964-B8B436686D98}</ProjectGuid>
- <PublishUrl>publish\</PublishUrl>
- <Install>true</Install>
- <InstallFrom>Disk</InstallFrom>
- <UpdateEnabled>false</UpdateEnabled>
- <UpdateMode>Foreground</UpdateMode>
- <UpdateInterval>7</UpdateInterval>
- <UpdateIntervalUnits>Days</UpdateIntervalUnits>
- <UpdatePeriodically>false</UpdatePeriodically>
- <UpdateRequired>false</UpdateRequired>
- <MapFileExtensions>true</MapFileExtensions>
- <ApplicationRevision>0</ApplicationRevision>
- <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
- <IsWebBootstrapper>false</IsWebBootstrapper>
- <UseApplicationTrust>false</UseApplicationTrust>
- <BootstrapperEnabled>true</BootstrapperEnabled>
- </PropertyGroup>
- <PropertyGroup>
- <SignAssembly>true</SignAssembly>
- <NoStdLib>true</NoStdLib>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="mscorlib" />
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Net" />
- <Reference Include="System.Xml" />
- <ProjectReference Include="..\ComponentModel\ComponentModelSL.csproj">
- <Project>{1BBA5101-D4F0-48B8-A5D6-7B23A099DCE3}</Project>
- <Name>ComponentModelSL</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup Condition="'$(IsSilverLight)' == 'true'">
- <Reference Include="System.Windows" />
- <Compile Include="System\ComponentModel\Composition\Hosting\CompositionHost.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionInitializer.AssemblyList.cs" />
- <Compile Include="System\ComponentModel\Composition\CompositionInitializer.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\DeploymentCatalog.cs" />
- <Compile Include="System\ComponentModel\Composition\Hosting\Package.cs" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="AssemblyInfo.cs" />
- <Compile Include="Microsoft\Internal\Lock.cs" />
- <Compile Include="Microsoft\Internal\Lock.Reader.cs" />
- <Compile Include="Microsoft\Internal\Lock.Writer.cs" />
- <Compile Include="Microsoft\Internal\Requires.cs" />
- <Compile Include="Strings.Designer.cs">
- <AutoGen>True</AutoGen>
- <DesignTime>True</DesignTime>
- <DependentUpon>Strings.resx</DependentUpon>
- </Compile>
- <Compile Include="SuppressMessages.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportFactoryOfT.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportFactoryOfTTMetadata.cs" />
- <Compile Include="System\ComponentModel\Composition\ExportLifetimeContextOfT.cs" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Strings.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>Strings.Designer.cs</LastGenOutput>
- <SubType>Designer</SubType>
- </EmbeddedResource>
- </ItemGroup>
- <ItemGroup>
- <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
- <Install>false</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
- <Visible>False</Visible>
- <ProductName>Windows Installer 3.1</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- </ItemGroup>
- <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight\v3.0\Microsoft.Silverlight.CSharp.targets" />
- <ProjectExtensions>
- <VisualStudio>
- <FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
- <SilverlightProjectProperties />
- </FlavorProperties>
- </VisualStudio>
- </ProjectExtensions>
-</Project>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Microsoft/Internal/.gitattributes b/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Microsoft/Internal/.gitattributes deleted file mode 100644 index 3dc648d1be9..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Microsoft/Internal/.gitattributes +++ /dev/null @@ -1,4 +0,0 @@ -/Lock.Reader.cs -crlf -/Lock.Writer.cs -crlf -/Lock.cs -crlf -/Requires.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Microsoft/Internal/Lock.Reader.cs b/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Microsoft/Internal/Lock.Reader.cs deleted file mode 100644 index 3f81a68ade9..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Microsoft/Internal/Lock.Reader.cs +++ /dev/null @@ -1,32 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-
-namespace Microsoft.Internal
-{
- internal struct ReadLock : IDisposable
- {
- private readonly Lock _lock;
- private int _isDisposed;
-
- public ReadLock(Lock @lock)
- {
- this._isDisposed = 0;
- this._lock = @lock;
- this._lock.EnterReadLock();
- }
-
- public void Dispose()
- {
- if (Interlocked.CompareExchange(ref this._isDisposed, 1, 0) == 0)
- {
- this._lock.ExitReadLock();
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Microsoft/Internal/Lock.Writer.cs b/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Microsoft/Internal/Lock.Writer.cs deleted file mode 100644 index e9d7088020f..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Microsoft/Internal/Lock.Writer.cs +++ /dev/null @@ -1,32 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-
-namespace Microsoft.Internal
-{
- internal struct WriteLock : IDisposable
- {
- private readonly Lock _lock;
- private int _isDisposed;
-
- public WriteLock(Lock @lock)
- {
- this._isDisposed = 0;
- this._lock = @lock;
- this._lock.EnterWriteLock();
- }
-
- public void Dispose()
- {
- if (Interlocked.CompareExchange(ref this._isDisposed, 1, 0) == 0)
- {
- this._lock.ExitWriteLock();
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Microsoft/Internal/Lock.cs b/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Microsoft/Internal/Lock.cs deleted file mode 100644 index 7cd7ac2ee5e..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Microsoft/Internal/Lock.cs +++ /dev/null @@ -1,79 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-
-namespace Microsoft.Internal
-{
- internal sealed class Lock : IDisposable
- {
-#if (!SILVERLIGHT)
- private ReaderWriterLockSlim _thisLock = new ReaderWriterLockSlim(LockRecursionPolicy.NoRecursion);
- private int _isDisposed = 0;
- public void EnterReadLock()
- {
- this._thisLock.EnterReadLock();
- }
-
- public void EnterWriteLock()
- {
- this._thisLock.EnterWriteLock();
- }
-
- public void ExitReadLock()
- {
- this._thisLock.ExitReadLock();
- }
-
- public void ExitWriteLock()
- {
- this._thisLock.ExitWriteLock();
- }
-
- public void Dispose()
- {
- if (Interlocked.CompareExchange(ref this._isDisposed, 1, 0) == 0)
- {
- this._thisLock.Dispose();
- }
- }
-
-#else
- // ReaderWriterLockSlim is not yet implemented on SilverLight
- // Satisfies our requirements until it is implemented
- object _thisLock = new object();
-
- public Lock()
- {
- }
-
- public void EnterReadLock()
- {
- Monitor.Enter(this._thisLock);
- }
-
- public void EnterWriteLock()
- {
- Monitor.Enter(this._thisLock);
- }
-
- public void ExitReadLock()
- {
- Monitor.Exit(this._thisLock);
- }
-
- public void ExitWriteLock()
- {
- Monitor.Exit(this._thisLock);
- }
-
- public void Dispose()
- {
- }
-#endif
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Microsoft/Internal/Requires.cs b/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Microsoft/Internal/Requires.cs deleted file mode 100644 index c7c2d31c1e2..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Microsoft/Internal/Requires.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Globalization;
-using System.Reflection;
-using System.ComponentModel.Composition;
-using System.Text;
-
-namespace Microsoft.Internal
-{
- internal static class Requires
- {
- [DebuggerStepThrough]
- public static void NotNull<T>(T value, string parameterName)
- where T : class
- {
- if (value == null)
- {
- throw new ArgumentNullException(parameterName);
- }
- }
-
- [DebuggerStepThrough]
- public static void NotNullOrEmpty(string value, string parameterName)
- {
- NotNull(value, parameterName);
-
- if (value.Length == 0)
- {
- throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Strings.ArgumentException_EmptyString, parameterName), parameterName);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Strings.Designer.cs b/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Strings.Designer.cs deleted file mode 100644 index 9fe4543a0b1..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Strings.Designer.cs +++ /dev/null @@ -1,108 +0,0 @@ -//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.21114.1
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace System.ComponentModel.Composition {
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Strings {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Strings() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.ComponentModel.Composition.Initialization.Strings", typeof(Strings).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to '{0}' cannot be an empty string ("")..
- /// </summary>
- internal static string ArgumentException_EmptyString {
- get {
- return ResourceManager.GetString("ArgumentException_EmptyString", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Cannot call SatisfyImports on a object of type '{0}' because it is marked with one or more ExportAttributes..
- /// </summary>
- internal static string ArgumentException_TypeHasExports {
- get {
- return ResourceManager.GetString("ArgumentException_TypeHasExports", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Catalog is trying to transition to an invalid state. Occurs when you call DownloadAsync more than once or CancelAsync is called at an incorrect time..
- /// </summary>
- internal static string InvalidOperationException_DeploymentCatalogInvalidStateChange {
- get {
- return ResourceManager.GetString("InvalidOperationException_DeploymentCatalogInvalidStateChange", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The package downloaded successfully but an error occurred while reading the contents of the package. See the inner exception for more details..
- /// </summary>
- internal static string InvalidOperationException_ErrorReadingXap {
- get {
- return ResourceManager.GetString("InvalidOperationException_ErrorReadingXap", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The container has already been initialized either by another call to InitializeContainer or by someone causing the default container to be constructed. Ensure that InitializeContainer is one of the first things that happens in the application host to ensure that it is ready for the first composition..
- /// </summary>
- internal static string InvalidOperationException_GlobalContainerAlreadyInitialized {
- get {
- return ResourceManager.GetString("InvalidOperationException_GlobalContainerAlreadyInitialized", resourceCulture);
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Strings.resx b/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Strings.resx deleted file mode 100644 index b451d64391f..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/Strings.resx +++ /dev/null @@ -1,116 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 1.3
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">1.3</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1">this is my long string</data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- [base64 mime encoded serialized .NET Framework object]
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- [base64 mime encoded string representing a byte array form of the .NET Framework object]
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
-
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>1.3</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="ArgumentException_TypeHasExports" xml:space="preserve">
- <value>Cannot call SatisfyImports on a object of type '{0}' because it is marked with one or more ExportAttributes.</value>
- </data>
- <data name="InvalidOperationException_GlobalContainerAlreadyInitialized" xml:space="preserve">
- <value>The container has already been initialized either by another call to InitializeContainer or by someone causing the default container to be constructed. Ensure that InitializeContainer is one of the first things that happens in the application host to ensure that it is ready for the first composition.</value>
- </data>
- <data name="ArgumentException_EmptyString" xml:space="preserve">
- <value>'{0}' cannot be an empty string ("").</value>
- </data>
- <data name="InvalidOperationException_DeploymentCatalogInvalidStateChange" xml:space="preserve">
- <value>Catalog is trying to transition to an invalid state. Occurs when you call DownloadAsync more than once or CancelAsync is called at an incorrect time.</value>
- </data>
- <data name="InvalidOperationException_ErrorReadingXap" xml:space="preserve">
- <value>The package downloaded successfully but an error occurred while reading the contents of the package. See the inner exception for more details.</value>
- </data>
-</root>
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/SuppressMessages.cs b/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/SuppressMessages.cs deleted file mode 100644 index 76dc008cee5..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/SuppressMessages.cs +++ /dev/null @@ -1,8 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Diagnostics.CodeAnalysis;
-
-[module: SuppressMessage("Microsoft.MSInternal", "CA905:SystemNamespacesRequireApproval", Scope = "namespace", Target = "System.ComponentModel.Composition.Hosting")]
-[module: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System.ComponentModel.Composition.Hosting")]
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/.gitattributes b/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/.gitattributes deleted file mode 100644 index af342c37220..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/.gitattributes +++ /dev/null @@ -1,5 +0,0 @@ -/CompositionInitializer.AssemblyList.cs -crlf -/CompositionInitializer.cs -crlf -/ExportFactoryOfT.cs -crlf -/ExportFactoryOfTTMetadata.cs -crlf -/ExportLifetimeContextOfT.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/CompositionInitializer.AssemblyList.cs b/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/CompositionInitializer.AssemblyList.cs deleted file mode 100644 index 6e8347208b7..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/CompositionInitializer.AssemblyList.cs +++ /dev/null @@ -1,36 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Windows;
-using System.Windows.Resources;
-
-namespace System.ComponentModel.Composition
-{
- public static partial class CompositionInitializer
- {
- // This method is the only Silverlight specific code dependency in CompositionHost
- private static List<Assembly> GetAssemblyList()
- {
- var assemblies = new List<Assembly>();
-
- // While this may seem like somewhat of a hack, walking the AssemblyParts in the active
- // deployment object is the only way to get the list of assemblies loaded by the XAP.
- foreach (AssemblyPart ap in Deployment.Current.Parts)
- {
- StreamResourceInfo sri = Application.GetResourceStream(new Uri(ap.Source, UriKind.Relative));
- if (sri != null)
- {
- // Keep in mind that calling Load on an assembly that is already loaded will
- // be a no-op and simply return the already loaded assembly object.
- Assembly assembly = ap.Load(sri.Stream);
- assemblies.Add(assembly);
- }
- }
-
- return assemblies;
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/CompositionInitializer.cs b/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/CompositionInitializer.cs deleted file mode 100644 index 1416b6e82bb..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/CompositionInitializer.cs +++ /dev/null @@ -1,104 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Globalization;
-using System.Linq;
-using System.Reflection;
-
-namespace System.ComponentModel.Composition
-{
- public static partial class CompositionInitializer
- {
- /// <summary>
- /// Will satisfy the imports on a object instance based on a <see cref="CompositionContainer"/>
- /// registered with the <see cref="CompositionHost"/>. By default if no <see cref="CompositionContainer"/>
- /// is registered the first time this is called it will be initialized to a catalog
- /// that contains all the assemblies loaded by the initial application XAP.
- /// </summary>
- /// <param name="attributedPart">
- /// Object instance that contains <see cref="ImportAttribute"/>s that need to be satisfied.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="instance"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ArgumentException">
- /// <paramref name="instance"/> contains <see cref="ExportAttribute"/>s applied on its type.
- /// </exception>
- /// <exception cref="ChangeRejectedException">
- /// One or more of the imports on the object instance could not be satisfied.
- /// </exception>
- /// <exception cref="CompositionException">
- /// One or more of the imports on the object instance caused an error while composing.
- /// </exception>
- public static void SatisfyImports(object attributedPart)
- {
- if (attributedPart == null)
- {
- throw new ArgumentNullException("attributedPart");
- }
- ComposablePart part = AttributedModelServices.CreatePart(attributedPart);
- CompositionInitializer.SatisfyImports(part);
- }
-
-
- /// <summary>
- /// Will satisfy the imports on a part based on a <see cref="CompositionContainer"/>
- /// registered with the <see cref="CompositionHost"/>. By default if no <see cref="CompositionContainer"/>
- /// is registered the first time this is called it will be initialized to a catalog
- /// that contains all the assemblies loaded by the initial application XAP.
- /// </summary>
- /// <param name="part">
- /// Part with imports that need to be satisfied.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="instance"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ArgumentException">
- /// <paramref name="instance"/> contains <see cref="ExportAttribute"/>s applied on its type.
- /// </exception>
- /// <exception cref="ChangeRejectedException">
- /// One or more of the imports on the object instance could not be satisfied.
- /// </exception>
- /// <exception cref="CompositionException">
- /// One or more of the imports on the object instance caused an error while composing.
- /// </exception>
- public static void SatisfyImports(ComposablePart part)
- {
- if (part == null)
- {
- throw new ArgumentNullException("part");
- }
-
- var batch = new CompositionBatch();
-
- batch.AddPart(part);
-
- if (part.ExportDefinitions.Any())
- {
- throw new ArgumentException(string.Format(CultureInfo.CurrentCulture,
- Strings.ArgumentException_TypeHasExports, part.ToString()), "part");
- }
-
- CompositionContainer container = null;
-
- // Ignoring return value because we don't need to know if we created it or not
- CompositionHost.TryGetOrCreateContainer(_createContainer, out container);
-
- container.Compose(batch);
- }
-
- private static Func<CompositionContainer> _createContainer = CreateCompositionContainer;
- private static CompositionContainer CreateCompositionContainer()
- {
- var assemblyCatalogs = GetAssemblyList()
- .Select<Assembly, ComposablePartCatalog>(assembly => new AssemblyCatalog(assembly));
-
- var aggCatalog = new AggregateCatalog(assemblyCatalogs);
-
- return new CompositionContainer(aggCatalog);
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/ExportFactoryOfT.cs b/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/ExportFactoryOfT.cs deleted file mode 100644 index 1ee66281ff9..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/ExportFactoryOfT.cs +++ /dev/null @@ -1,30 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using Microsoft.Internal;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition
-{
- public class ExportFactory<T>
- {
- private Func<Tuple<T, Action>> _exportLifetimeContextCreator;
-
- public ExportFactory(Func<Tuple<T, Action>> exportLifetimeContextCreator)
- {
- if (exportLifetimeContextCreator == null)
- {
- throw new ArgumentNullException("exportLifetimeContextCreator");
- }
-
- this._exportLifetimeContextCreator = exportLifetimeContextCreator;
- }
-
- public ExportLifetimeContext<T> CreateExport()
- {
- Tuple<T, Action> untypedLifetimeContext = this._exportLifetimeContextCreator.Invoke();
- return new ExportLifetimeContext<T>(untypedLifetimeContext.Item1, untypedLifetimeContext.Item2);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/ExportFactoryOfTTMetadata.cs b/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/ExportFactoryOfTTMetadata.cs deleted file mode 100644 index feb4097a64a..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/ExportFactoryOfTTMetadata.cs +++ /dev/null @@ -1,25 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Primitives;
-
-namespace System.ComponentModel.Composition
-{
- public class ExportFactory<T, TMetadata> : ExportFactory<T>
- {
- private readonly TMetadata _metadata;
-
- public ExportFactory(Func<Tuple<T, Action>> exportLifetimeContextCreator, TMetadata metadata)
- : base(exportLifetimeContextCreator)
- {
- this._metadata = metadata;
- }
-
- public TMetadata Metadata
- {
- get { return this._metadata; }
- }
- }
-}
-
diff --git a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/ExportLifetimeContextOfT.cs b/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/ExportLifetimeContextOfT.cs deleted file mode 100644 index f1182da5fd3..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/ExportLifetimeContextOfT.cs +++ /dev/null @@ -1,38 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.ComponentModel.Composition.Primitives;
-using System.Linq;
-
-namespace System.ComponentModel.Composition
-{
- public sealed class ExportLifetimeContext<T> : IDisposable
- {
- private readonly T _value;
- private readonly Action _disposeAction;
-
- public ExportLifetimeContext(T value, Action disposeAction)
- {
- this._value = value;
- this._disposeAction = disposeAction;
- }
-
- public T Value
- {
- get
- {
- return this._value;
- }
- }
-
- public void Dispose()
- {
- if (this._disposeAction != null)
- {
- this._disposeAction.Invoke();
- }
- }
- }
-}
-
diff --git a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/Hosting/.gitattributes b/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/Hosting/.gitattributes deleted file mode 100644 index 2dacd9d3491..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/Hosting/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -/CompositionHost.cs -crlf -/DeploymentCatalog.cs -crlf -/Package.cs -crlf diff --git a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/Hosting/CompositionHost.cs b/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/Hosting/CompositionHost.cs deleted file mode 100644 index 33d65fd6499..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/Hosting/CompositionHost.cs +++ /dev/null @@ -1,113 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Globalization;
-using System.Threading;
-using System.ComponentModel.Composition.Primitives;
-namespace System.ComponentModel.Composition.Hosting
-{
- public static class CompositionHost
- {
- // Field is internal only to assist in testing
- internal static CompositionContainer _container = null;
- private static object _lockObject = new object();
-
- /// <summary>
- /// This method can be used to initialize the global container used by <see cref="CompositionInitializer.SatisfyImports(object)"/>
- /// in case where the default container doesn't provide enough flexibility.
- ///
- /// If this method is needed it should be called exactly once and as early as possible in the application host. It will need
- /// to be called before the first call to <see cref="CompositionInitializer.SatisfyImports(object)"/>
- /// </summary>
- /// <param name="container">
- /// <see cref="CompositionContainer"/> that should be used instead of the default global container.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="container"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="InvalidOperationException">
- /// Either <see cref="Initialize(CompositionContainer)" /> or <see cref="Initialize(ComposablePartCatalog[])" /> has already been called or someone has already made use of the global
- /// container via <see cref="CompositionInitializer.SatisfyImports(object)"/>. In either case you need to ensure that it
- /// is called only once and that it is called early in the application host startup code.
- /// </exception>
- public static void Initialize(CompositionContainer container)
- {
- if (container == null)
- {
- throw new ArgumentNullException("container");
- }
-
- CompositionContainer globalContainer = null;
- bool alreadyCreated = TryGetOrCreateContainer(() => container, out globalContainer);
-
- if (alreadyCreated)
- {
- throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture,
- Strings.InvalidOperationException_GlobalContainerAlreadyInitialized));
- }
- }
-
- /// <summary>
- /// This method can be used to initialize the global container used by <see cref="CompositionInitializer.SatisfyImports(object)"/>
- /// in case where the default container doesn't provide enough flexibility.
- ///
- /// If this method is needed it should be called exactly once and as early as possible in the application host. It will need
- /// to be called before the first call to <see cref="CompositionInitializer.SatisfyImports(object)"/>
- /// </summary>
- /// <param name="catalogs">
- /// An array of <see cref="ComposablePartCatalog"/> that should be used to initialize the <see cref="CompositionContainer"/> with.
- /// </param>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="catalogs"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="InvalidOperationException">
- /// Either <see cref="Initialize(CompositionContainer)" /> or <see cref="Initialize(ComposablePartCatalog[])" />has already been called or someone has already made use of the global
- /// container via <see cref="CompositionInitializer.SatisfyImports(object)"/>. In either case you need to ensure that it
- /// is called only once and that it is called early in the application host startup code.
- /// </exception>
- public static CompositionContainer Initialize(params ComposablePartCatalog[] catalogs)
- {
- AggregateCatalog aggregateCatalog = new AggregateCatalog(catalogs);
- CompositionContainer container = new CompositionContainer(aggregateCatalog);
- try
- {
- CompositionHost.Initialize(container);
- }
- catch
- {
- container.Dispose();
-
- // NOTE : this is important, as this prevents the disposal of the catalogs passed as input arguments
- aggregateCatalog.Catalogs.Clear();
- aggregateCatalog.Dispose();
-
- throw;
- }
-
- return container;
- }
-
-
-
- internal static bool TryGetOrCreateContainer(Func<CompositionContainer> createContainer, out CompositionContainer globalContainer)
- {
- bool alreadyCreated = true;
- if (_container == null)
- {
- var container = createContainer.Invoke();
- lock (_lockObject)
- {
- if (_container == null)
- {
- Thread.MemoryBarrier();
- _container = container;
- alreadyCreated = false;
- }
- }
- }
- globalContainer = _container;
- return alreadyCreated;
- }
- }
-}
\ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/Hosting/DeploymentCatalog.cs b/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/Hosting/DeploymentCatalog.cs deleted file mode 100644 index e6042b1caa1..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/Hosting/DeploymentCatalog.cs +++ /dev/null @@ -1,420 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition.Primitives;
-using System.Linq;
-using System.Net;
-using System.Reflection;
-using System.Threading;
-using Microsoft.Internal;
-
-#if (SILVERLIGHT)
-namespace System.ComponentModel.Composition.Hosting
-{
- /// <summary>
- /// Implements a MEF catalog that supports Asynchronous download of Silverlast Xap files.
- /// </summary>
- public class DeploymentCatalog : ComposablePartCatalog, INotifyComposablePartCatalogChanged
- {
- static class State
- {
- public const int Created = 0;
- public const int Initialized = 1000;
- public const int DownloadStarted = 2000;
- public const int DownloadCompleted = 3000;
- public const int DownloadCancelled = 4000;
- }
-
- private Lock _lock = new Lock();
- private volatile bool _isDisposed = false;
- private Uri _uri = null;
- private int _state = State.Created;
- private AggregateCatalog _catalogCollection = new AggregateCatalog();
- private WebClient _webClient = null;
-
- /// <summary>
- /// Construct a Deployment catalog with the parts from the main Xap.
- /// </summary>
- public DeploymentCatalog()
- {
- this.DiscoverParts(Package.CurrentAssemblies);
- this._state = State.Initialized;
- }
-
- /// <summary>
- /// Construct a Deployment catalog with a string form relative uri.
- /// </summary>
- /// <value>
- /// A relative Uri to the Download Xap file
- /// <see cref="DeploymentCatalog"/>.
- /// </value>
- /// <exception cref="ArgumentException">
- /// The argument is null or an empty string.
- /// </exception>
- public DeploymentCatalog(string uriRelative)
- {
- Requires.NotNullOrEmpty(uriRelative, "uriRelative");
- this._uri = new Uri(uriRelative, UriKind.Relative);
- }
-
- /// <summary>
- /// Construct a Deployment catalog with the parts from uri.
- /// </summary>
- /// <value>
- /// A Uri to the Download Xap file
- /// <see cref="System.Uri"/>.
- /// </value>
- /// <exception cref="ArgumentException">
- /// The argument is null.
- /// </exception>
- public DeploymentCatalog(Uri uri)
- {
- Requires.NotNull<Uri>(uri, "uri");
- this._uri = uri;
- }
-
- /// <summary>
- /// Notify when the contents of the Catalog has changed.
- /// </summary>
- public event EventHandler<ComposablePartCatalogChangeEventArgs> Changed;
-
- /// <summary>
- /// Notify when the contents of the Catalog is changing.
- /// </summary>
- public event EventHandler<ComposablePartCatalogChangeEventArgs> Changing;
-
- /// <summary>
- /// Notify when the download has been completed.
- /// </summary>
- public event EventHandler<AsyncCompletedEventArgs> DownloadCompleted;
-
- /// <summary>
- /// Notify when the contents of the Progress of the download has changed.
- /// </summary>
- public event EventHandler<DownloadProgressChangedEventArgs> DownloadProgressChanged;
-
- /// <summary>
- /// Retrieve or create the WebClient.
- /// </summary>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="DeploymentCatalog"/> has been disposed of.
- /// </exception>
- private WebClient WebClient
- {
- get
- {
- this.ThrowIfDisposed();
- if(this._webClient == null)
- {
- Interlocked.CompareExchange<WebClient>(ref this._webClient, new WebClient(), null);
- }
- return this._webClient;
- }
- }
-
- /// <summary>
- /// Gets the part definitions of the Deployment catalog.
- /// </summary>
- /// <value>
- /// A <see cref="IQueryable{T}"/> of <see cref="ComposablePartDefinition"/> objects of the
- /// <see cref="DeploymentCatalog"/>.
- /// </value>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="DeploymentCatalog"/> has been disposed of.
- /// </exception>
- public override IQueryable<ComposablePartDefinition> Parts
- {
- get
- {
- this.ThrowIfDisposed();
- return this._catalogCollection.Parts;
- }
- }
-
- /// <summary>
- /// Gets the Uri of this catalog
- /// </summary>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="DeploymentCatalog"/> has been disposed of.
- /// </exception>
- public Uri Uri
- {
- get
- {
- this.ThrowIfDisposed();
- return this._uri;
- }
- }
-
- /// <summary>
- /// </summary>
- /// <param name="assemblies">
- /// </param>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="DeploymentCatalog"/> has been disposed of.
- /// </exception>
- private void DiscoverParts(IEnumerable<Assembly> assemblies)
- {
- this.ThrowIfDisposed();
-
- var addedDefinitions = new List<ComposablePartDefinition>();
- var addedCatalogs = new Dictionary<string, ComposablePartCatalog>();
- using(new ReadLock(this._lock))
- {
- foreach (var assembly in assemblies)
- {
- if (addedCatalogs.ContainsKey(assembly.FullName))
- {
- // Nothing to do because the assembly has already been added.
- continue;
- }
-
- var catalog = new AssemblyCatalog(assembly);
- addedDefinitions.AddRange(catalog.Parts);
- addedCatalogs.Add(assembly.FullName, catalog);
- }
- }
-
- // Generate notifications
- using (var atomicComposition = new AtomicComposition())
- {
- var changingArgs = new ComposablePartCatalogChangeEventArgs(addedDefinitions, Enumerable.Empty<ComposablePartDefinition>(), atomicComposition);
- this.OnChanging(changingArgs);
-
- using (new WriteLock(this._lock))
- {
- foreach (var item in addedCatalogs)
- {
- this._catalogCollection.Catalogs.Add(item.Value);
- }
- }
- atomicComposition.Complete();
- }
-
- var changedArgs = new ComposablePartCatalogChangeEventArgs(addedDefinitions, Enumerable.Empty<ComposablePartDefinition>(), null);
- this.OnChanged(changedArgs);
- }
-
- /// <summary>
- /// Returns the export definitions that match the constraint defined by the specified definition.
- /// </summary>
- /// <param name="definition">
- /// The <see cref="ImportDefinition"/> that defines the conditions of the
- /// <see cref="ExportDefinition"/> objects to return.
- /// </param>
- /// <returns>
- /// An <see cref="IEnumerable{T}"/> of <see cref="Tuple{T1, T2}"/> containing the
- /// <see cref="ExportDefinition"/> objects and their associated
- /// <see cref="ComposablePartDefinition"/> for objects that match the constraint defined
- /// by <paramref name="definition"/>.
- /// </returns>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="definition"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// The <see cref="DeploymentCatalog"/> has been disposed of.
- /// </exception>
- public override IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>> GetExports(ImportDefinition definition)
- {
- this.ThrowIfDisposed();
- Requires.NotNull(definition, "definition");
-
- return this._catalogCollection.GetExports(definition);
- }
-
- /// <summary>
- /// Cancel the async operation.
- /// </summary>
- public void CancelAsync()
- {
- ThrowIfDisposed();
- MutateStateOrThrow(State.DownloadCancelled, State.DownloadStarted);
- this.WebClient.CancelAsync();
- }
-
- /// <summary>
- /// Begin the asynchronous download.
- /// </summary>
- public void DownloadAsync()
- {
- ThrowIfDisposed();
-
- if (Interlocked.CompareExchange(ref this._state, State.DownloadStarted, State.Created) == State.Created)
- {
- // Created with Downloadable content do download
- this.WebClient.OpenReadCompleted += new OpenReadCompletedEventHandler(HandleOpenReadCompleted);
- this.WebClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(HandleDownloadProgressChanged);
- this.WebClient.OpenReadAsync(Uri, this);
- }
- else
- {
- // Created with LocalAssemblies
- MutateStateOrThrow(State.DownloadCompleted, State.Initialized);
-
- this.OnDownloadCompleted(new AsyncCompletedEventArgs(null, false, this));
- }
- }
-
- void HandleDownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
- {
- EventHandler<DownloadProgressChangedEventArgs> downloadProgressChangedEvent = this.DownloadProgressChanged;
- if (downloadProgressChangedEvent != null)
- {
- downloadProgressChangedEvent(this, e);
- }
- }
-
- private void HandleOpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
- {
- Exception error = e.Error;
- bool cancelled = e.Cancelled;
-
- // Possible valid current states are DownloadStarted and DownloadCancelled.
- int currentState = Interlocked.CompareExchange(ref this._state, State.DownloadCompleted, State.DownloadStarted);
-
- if (currentState != State.DownloadStarted)
- {
- cancelled = true;
- }
-
- if (error == null && !cancelled)
- {
- try
- {
- var assemblies = Package.LoadPackagedAssemblies(e.Result);
- this.DiscoverParts(assemblies);
- }
- catch (Exception ex)
- {
- error = new InvalidOperationException(Strings.InvalidOperationException_ErrorReadingXap, ex);
- }
- }
-
- this.OnDownloadCompleted(new AsyncCompletedEventArgs(error, cancelled, this));
- }
-
- /// <summary>
- /// Raises the <see cref="INotifyComposablePartCatalogChanged.Changed"/> event.
- /// </summary>
- /// <param name="e">
- /// An <see cref="ComposablePartCatalogChangeEventArgs"/> containing the data for the event.
- /// </param>
- protected virtual void OnChanged(ComposablePartCatalogChangeEventArgs e)
- {
- EventHandler<ComposablePartCatalogChangeEventArgs> changedEvent = this.Changed;
- if (changedEvent != null)
- {
- changedEvent(this, e);
- }
- }
-
- /// <summary>
- /// Raises the <see cref="INotifyComposablePartCatalogChanged.Changing"/> event.
- /// </summary>
- /// <param name="e">
- /// An <see cref="ComposablePartCatalogChangeEventArgs"/> containing the data for the event.
- /// </param>
- protected virtual void OnChanging(ComposablePartCatalogChangeEventArgs e)
- {
- EventHandler<ComposablePartCatalogChangeEventArgs> changingEvent = this.Changing;
- if (changingEvent != null)
- {
- changingEvent(this, e);
- }
- }
-
- /// <summary>
- /// Raises the <see cref="DownloadCompleted"/> event.
- /// </summary>
- /// <param name="e">
- /// An <see cref="AsyncCompletedEventArgs"/> containing the data for the event.
- /// </param>
- protected virtual void OnDownloadCompleted(AsyncCompletedEventArgs e)
- {
- EventHandler<AsyncCompletedEventArgs> downloadCompletedEvent = this.DownloadCompleted;
- if (downloadCompletedEvent != null)
- {
- downloadCompletedEvent(this, e);
- }
- }
-
- /// <summary>
- /// Raises the <see cref="DownloadProgressChanged"/> event.
- /// </summary>
- /// <param name="e">
- /// An <see cref="ProgressChangedEventArgs"/> containing the data for the event.
- /// </param>
- protected virtual void OnDownloadProgressChanged(DownloadProgressChangedEventArgs e)
- {
- EventHandler<DownloadProgressChangedEventArgs> downloadProgressChangedEvent = this.DownloadProgressChanged;
- if (downloadProgressChangedEvent != null)
- {
- downloadProgressChangedEvent(this, e);
- }
- }
-
- protected override void Dispose(bool disposing)
- {
- try
- {
- if (disposing)
- {
- if (!this._isDisposed)
- {
- AggregateCatalog catalogs = null;
- bool disposeLock = false;
- try
- {
- using (new WriteLock(this._lock))
- {
- if (!this._isDisposed)
- {
- disposeLock = true;
- catalogs = this._catalogCollection;
- this._catalogCollection = null;
- this._isDisposed = true;
- }
- }
- }
- finally
- {
- if (catalogs != null)
- {
- catalogs.Dispose();
- }
-
- if (disposeLock)
- {
- this._lock.Dispose();
- }
- }
- }
- }
- }
- finally
- {
- base.Dispose(disposing);
- }
- }
-
- private void ThrowIfDisposed()
- {
- if (this._isDisposed)
- {
- throw new ObjectDisposedException(this.GetType().ToString());
- }
- }
-
- private void MutateStateOrThrow(int toState, int fromState)
- {
- int currentState = Interlocked.CompareExchange(ref this._state, toState, fromState);
- if(currentState != fromState)
- {
- throw new InvalidOperationException(Strings.InvalidOperationException_DeploymentCatalogInvalidStateChange);
- }
- }
- }
-}
-#endif
diff --git a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/Hosting/Package.cs b/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/Hosting/Package.cs deleted file mode 100644 index a91e5945f05..00000000000 --- a/mcs/class/System.ComponentModel.Composition/src/Composition.Initialization/System/ComponentModel/Composition/Hosting/Package.cs +++ /dev/null @@ -1,113 +0,0 @@ -// -----------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// -----------------------------------------------------------------------
-#if(SILVERLIGHT)
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Net;
-using System.Reflection;
-using System.Windows;
-using System.Windows.Resources;
-using System.Xml;
-using System.ComponentModel;
-
-namespace System.ComponentModel.Composition.Hosting
-{
- /// <summary>
- /// Helper functions for accessing the Silverlight manifest
- /// </summary>
- internal static class Package
- {
- /// <summary>
- /// Retrieves The current list of assemblies for the application XAP load. Depends on the Deployment.Current property being setup and
- /// so can only be accessed after the Application object has be completely constructed.
- /// No caching occurs at this level.
- /// </summary>
- public static IEnumerable<Assembly> CurrentAssemblies
- {
- get
- {
- var assemblies = new List<Assembly>();
-
- // While this may seem like somewhat of a hack, walking the AssemblyParts in the active
- // deployment object is the only way to get the list of assemblies loaded by the initial XAP.
- foreach (AssemblyPart ap in Deployment.Current.Parts)
- {
- StreamResourceInfo sri = Application.GetResourceStream(new Uri(ap.Source, UriKind.Relative));
- if (sri != null)
- {
- // Keep in mind that calling Load on an assembly that is already loaded will
- // be a no-op and simply return the already loaded assembly object.
- Assembly assembly = ap.Load(sri.Stream);
- assemblies.Add(assembly);
- }
- }
-
- return assemblies;
- }
- }
-
-
- public static IEnumerable<Assembly> LoadPackagedAssemblies(Stream packageStream)
- {
- List<Assembly> assemblies = new List<Assembly>();
- StreamResourceInfo packageStreamInfo = new StreamResourceInfo(packageStream, null);
-
- IEnumerable<AssemblyPart> parts = GetDeploymentParts(packageStreamInfo);
-
- foreach (AssemblyPart ap in parts)
- {
- StreamResourceInfo sri = Application.GetResourceStream(
- packageStreamInfo, new Uri(ap.Source, UriKind.Relative));
-
- assemblies.Add(ap.Load(sri.Stream));
- }
- packageStream.Close();
- return assemblies;
- }
-
- /// <summary>
- /// Only reads AssemblyParts and does not support external parts (aka Platform Extensions or TPEs).
- /// </summary>
- private static IEnumerable<AssemblyPart> GetDeploymentParts(StreamResourceInfo xapStreamInfo)
- {
- Uri manifestUri = new Uri("AppManifest.xaml", UriKind.Relative);
- StreamResourceInfo manifestStreamInfo = Application.GetResourceStream(xapStreamInfo, manifestUri);
- List<AssemblyPart> assemblyParts = new List<AssemblyPart>();
-
- // The code assumes the following format in AppManifest.xaml
- //<Deployment ... >
- // <Deployment.Parts>
- // <AssemblyPart x:Name="A" Source="A.dll" />
- // <AssemblyPart x:Name="B" Source="B.dll" />
- // ...
- // <AssemblyPart x:Name="Z" Source="Z.dll" />
- // </Deployment.Parts>
- //</Deployment>
- if (manifestStreamInfo != null)
- {
- Stream manifestStream = manifestStreamInfo.Stream;
- using (XmlReader reader = XmlReader.Create(manifestStream))
- {
- if (reader.ReadToFollowing("AssemblyPart"))
- {
- do
- {
- string source = reader.GetAttribute("Source");
-
- if (source != null)
- {
- assemblyParts.Add(new AssemblyPart() { Source = source });
- }
- }
- while (reader.ReadToNextSibling("AssemblyPart"));
- }
- }
- }
-
- return assemblyParts;
- }
- }
-}
-#endif
|