|
21 | 21 | </Base>
|
22 | 22 | <Interfaces />
|
23 | 23 | <Docs>
|
24 |
| - <summary>Represents the runtime's concept of a scope for binding. This class is abstract.</summary> |
| 24 | + <summary>Represents the runtime's concept of a scope for assembly loading.</summary> |
25 | 25 | <remarks>
|
26 | 26 | <format type="text/markdown"><![CDATA[
|
27 | 27 |
|
|
30 | 30 |
|
31 | 31 | <xref:System.Runtime.Loader.AssemblyLoadContext> is an abstract class. The <xref:System.Runtime.Loader.AssemblyLoadContext.Load(System.Reflection.AssemblyName)?displayProperty=nameWithType> needs to be implemented to create a concrete class.
|
32 | 32 |
|
33 |
| - The <xref:System.Runtime.Loader.AssemblyLoadContext> exists primarily to provide assembly binding isolation. It allows multiple versions of the same assembly to be loaded within a single process. It replaces the isolation mechanisms provided by multiple <xref:System.AppDomain> instances in the .NET Framework. |
| 33 | + The <xref:System.Runtime.Loader.AssemblyLoadContext> exists primarily to provide assembly loading isolation. It allows multiple versions of the same assembly to be loaded within a single process. It replaces the isolation mechanisms provided by multiple <xref:System.AppDomain> instances in the .NET Framework. |
34 | 34 |
|
35 | 35 | > [!NOTE]
|
36 | 36 | > <xref:System.Runtime.Loader.AssemblyLoadContext> does not provide any security features. All code has full permissions of the process.
|
37 | 37 |
|
38 | 38 | ### Usage in the runtime
|
39 | 39 | The runtime implements two assembly load contexts:
|
40 |
| - * <xref:System.Runtime.Loader.AssemblyLoadContext.Default?displayProperty=nameWithType> represents the runtime's default binding context which is used for the application main assembly and its static dependencies. |
| 40 | + * <xref:System.Runtime.Loader.AssemblyLoadContext.Default?displayProperty=nameWithType> represents the runtime's default context which is used for the application main assembly and its static dependencies. |
41 | 41 | * The <xref:System.Reflection.Assembly.LoadFile(System.String)?displayProperty=nameWithType> method isolates the assemblies it loads by instantiating the most basic <xref:System.Runtime.Loader.AssemblyLoadContext>. It has a simplistic isolation scheme which loads each assembly in its own <xref:System.Runtime.Loader.AssemblyLoadContext> with no dependency resolution.
|
42 | 42 |
|
43 | 43 | ### Application usage
|
44 |
| - An application can create its own <xref:System.Runtime.Loader.AssemblyLoadContext> to create a custom solution for advanced binding scenarios. The customization focuses on defining dependency resolution mechanisms. |
| 44 | + An application can create its own <xref:System.Runtime.Loader.AssemblyLoadContext> to create a custom solution for advanced scenarios. The customization focuses on defining dependency resolution mechanisms. |
45 | 45 |
|
46 | 46 | The <xref:System.Runtime.Loader.AssemblyLoadContext> provides two extension points to implement managed assembly resolution:
|
47 | 47 | 1. The <xref:System.Runtime.Loader.AssemblyLoadContext.Load(System.Reflection.AssemblyName)?displayProperty=nameWithType> provides the first chance for the <xref:System.Runtime.Loader.AssemblyLoadContext> to resolve the assembly, load it and return it. If the <xref:System.Runtime.Loader.AssemblyLoadContext.Load(System.Reflection.AssemblyName)?displayProperty=nameWithType> returns `null`, the loader will try to load the assembly into the <xref:System.Runtime.Loader.AssemblyLoadContext.Default?displayProperty=nameWithType>.
|
|
64 | 64 |
|
65 | 65 | * The implementation of <xref:System.Runtime.Loader.AssemblyLoadContext.Load(System.Reflection.AssemblyName)?displayProperty=nameWithType> can add new dependencies which may need to be isolated to allow different versions to exist. The most natural implementation would place these dependencies in the default context. Careful design can isolate the new dependencies.
|
66 | 66 |
|
67 |
| - * The binding isolation process creates multiple types with the same type name. |
68 |
| - * This can lead to confusing error messages, for example "type Foo.Foo cannot be cast to type Foo.Foo." |
| 67 | + * The same assembly is loaded multiple times into different contexts. |
| 68 | + * This can lead to confusing error messages, for example "Unable to cast object of type 'Sample.Plugin' to type 'Sample.Plugin'." |
69 | 69 | * Marshaling across isolation boundaries is non-trivial. A typical solution would be to use an interface defined in an assembly which is only loaded into the default load context.
|
70 | 70 |
|
71 | 71 | ]]></format>
|
|
0 commit comments