This documentation is archived and is not being maintained.

ResolveEventArgs.RequestingAssembly Property

Gets the assembly whose dependency is being resolved.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

public Assembly RequestingAssembly { get; }

Property Value

Type: System.Reflection.Assembly
The assembly that requested the item specified by the Name property.

The assembly that is returned by this property is an assembly that was unable to resolve the item specified by the Name property, because the item did not exist in that assembly, in any of its loaded dependencies, or in any dependencies the loader could find through probing.

For example, suppose the current assembly uses the Assembly.LoadFile method to load assembly A from a directory outside the probing path, in order to use class CA. Suppose further that class CA uses class CB, in assembly B, and that assembly A has a compile-time reference to assembly B, also located outside the probing path. When the current assembly attempts to instantiate CA, the loader attempts to resolve the reference to assembly B. However, because assembly A was loaded by using the Assembly.LoadFile method, the loader cannot resolve the dependency. If there is a handler for the AppDomain.AssemblyResolve event, the event is raised, and the RequestingAssembly property of the resulting ResolveEventArgs object contains assembly A, because assembly A is the assembly that is missing a dependency.

The semantics of the RequestingAssembly property vary, depending on how the requesting assembly was loaded:

  • Load context: The value of the property might be null. The load context is load-order independent, and the identity of the requesting assembly is not necessarily meaningful. A non-null example occurs when the Type.GetType method is called and the specified type is not known to the requesting assembly or any of its dependencies.

  • Load-from context: The property can be used as a probing hint, but the event handler should not get more than one request for a given assembly name.

  • No context (that is, the requesting assembly was loaded by using the Assembly.LoadFile method, or as a byte stream, or in mixed mode): The handler can use the RequestingAssembly property to load different implementations of the same assembly based on the identity of the requesting assembly.

.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.