RegistrationException Classe
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
A exceção que é lançada quando é detetado um erro de registo.
public ref class RegistrationException sealed : SystemException
[System.Serializable]
public sealed class RegistrationException : SystemException
[<System.Serializable>]
type RegistrationException = class
inherit SystemException
Public NotInheritable Class RegistrationException
Inherits SystemException
- Herança
- Atributos
Exemplos
O seguinte exemplo de código contém um bloco de captura que mostra como lidar com uma exceção de registo.
try
{
String^ applicationName = "Queued Component";
String^ typeLibraryName = nullptr;
RegistrationHelper^ helper = gcnew RegistrationHelper;
// Call the InstallAssembly method passing it the name of the assembly to
// install as a COM+ application, the COM+ application name, and
// the name of the type library file.
// Setting the application name and the type library to NULL (nothing in Visual Basic .NET
// allows you to use the COM+ application name that is given in the assembly and
// the default type library name. The application name in the assembly metadata
// takes precedence over the application name you provide to InstallAssembly.
helper->InstallAssembly( "C:..\\..\\QueuedComponent.dll", applicationName, typeLibraryName, InstallationFlags::CreateTargetApplication );
Console::WriteLine( "Registration succeeded: Type library {0} created.", typeLibraryName );
Console::Read();
// Create a RegistrationConfig object and set its attributes
// Create a RegistrationHelper object, and call the InstallAssemblyFromConfig
// method by passing the RegistrationConfiguration object to it as a
// reference object
RegistrationConfig^ registrationConfiguration = gcnew RegistrationConfig;
registrationConfiguration->AssemblyFile = "C:..\\..\\QueuedComponent.dll";
registrationConfiguration->Application = "MyApp";
registrationConfiguration->InstallationFlags = InstallationFlags::CreateTargetApplication;
RegistrationHelper^ helperFromConfig = gcnew RegistrationHelper;
helperFromConfig->InstallAssemblyFromConfig( registrationConfiguration );
}
catch ( RegistrationException^ e )
{
Console::WriteLine( e->Message );
// Check whether the ErrorInfo property of the RegistrationException object is null.
// If there is no extended error information about
// methods related to multiple COM+ objects ErrorInfo will be null.
if ( e->ErrorInfo != nullptr )
{
// Gets an array of RegistrationErrorInfo objects describing registration errors
array<RegistrationErrorInfo^>^ registrationErrorInfos = e->ErrorInfo;
// Iterate through the array of RegistrationErrorInfo objects and disply the
// ErrorString for each object.
System::Collections::IEnumerator^ myEnum = registrationErrorInfos->GetEnumerator();
while ( myEnum->MoveNext() )
{
RegistrationErrorInfo^ registrationErrorInfo = (RegistrationErrorInfo^)( myEnum->Current );
Console::WriteLine( registrationErrorInfo->ErrorString );
}
}
Console::Read();
}
try
{
string applicationName = "Queued Component";
string typeLibraryName = null;
RegistrationHelper helper = new RegistrationHelper();
// Call the InstallAssembly method passing it the name of the assembly to
// install as a COM+ application, the COM+ application name, and
// the name of the type library file.
// Setting the application name and the type library to NULL (nothing in Visual Basic .NET
// allows you to use the COM+ application name that is given in the assembly and
// the default type library name. The application name in the assembly metadata
// takes precedence over the application name you provide to InstallAssembly.
helper.InstallAssembly(@"C:..\..\QueuedComponent.dll", ref applicationName, ref typeLibraryName, InstallationFlags.CreateTargetApplication);
Console.WriteLine("Registration succeeded: Type library {0} created.", typeLibraryName);
Console.Read();
// Create a RegistrationConfig object and set its attributes
// Create a RegistrationHelper object, and call the InstallAssemblyFromConfig
// method by passing the RegistrationConfiguration object to it as a
// reference object
RegistrationConfig registrationConfiguration = new RegistrationConfig();
registrationConfiguration.AssemblyFile=@"C:..\..\QueuedComponent.dll";
registrationConfiguration.Application = "MyApp";
registrationConfiguration.InstallationFlags = InstallationFlags.CreateTargetApplication;
RegistrationHelper helperFromConfig = new RegistrationHelper();
helperFromConfig.InstallAssemblyFromConfig(ref registrationConfiguration);
}
catch(RegistrationException e)
{
Console.WriteLine(e.Message);
// Check whether the ErrorInfo property of the RegistrationException object is null.
// If there is no extended error information about
// methods related to multiple COM+ objects ErrorInfo will be null.
if(e.ErrorInfo != null)
{
// Gets an array of RegistrationErrorInfo objects describing registration errors
RegistrationErrorInfo[] registrationErrorInfos = e.ErrorInfo;
// Iterate through the array of RegistrationErrorInfo objects and disply the
// ErrorString for each object.
foreach (RegistrationErrorInfo registrationErrorInfo in registrationErrorInfos)
{
Console.WriteLine(registrationErrorInfo.ErrorString);
}
}
Console.Read();
}
Try
Dim applicationName As String = "Queued Component"
Dim typeLibraryName As String = Nothing
Dim helper As New RegistrationHelper
' Call the InstallAssembly method passing it the name of the assembly to
' install as a COM+ application, the COM+ application name, and
' the name of the type library file.
' Setting the application name and the type library to NULL (nothing in Visual Basic .NET
' allows you to use the COM+ application name that is given in the assembly and
' the default type library name. The application name in the assembly metadata
' takes precedence over the application name you provide to InstallAssembly.
helper.InstallAssembly("C:..\..\QueuedComponent.dll", applicationName, typeLibraryName, InstallationFlags.CreateTargetApplication)
MsgBox("Registration succeeded: Type library " & typeLibraryName & " created.")
Console.Read()
' Create a RegistrationConfig object and set its attributes
' Create a RegistrationHelper object, and call the InstallAssemblyFromConfig
' method by passing the RegistrationConfiguration object to it as a
' reference object
Dim registrationConfiguration As New RegistrationConfig()
registrationConfiguration.AssemblyFile = "C:..\..\QueuedComponent.dll"
registrationConfiguration.Application = "MyApp"
registrationConfiguration.InstallationFlags = InstallationFlags.CreateTargetApplication
Dim helperFromConfig As New RegistrationHelper()
helperFromConfig.InstallAssemblyFromConfig(registrationConfiguration)
Catch e As RegistrationException
MsgBox(e.Message)
' Check whether the ErrorInfo property of the RegistrationException object is null.
' If there is no extended error information about
' methods related to multiple COM+ objects ErrorInfo will be null.
If Not (e.ErrorInfo Is Nothing) Then
' Gets an array of RegistrationErrorInfo objects describing registration errors
Dim registrationErrorInfos As RegistrationErrorInfo() = e.ErrorInfo
' Iterate through the array of RegistrationErrorInfo objects and disply the
' ErrorString for each object.
Dim registrationErrorInfo As RegistrationErrorInfo
For Each registrationErrorInfo In registrationErrorInfos
MsgBox(registrationErrorInfo.ErrorString)
Next registrationErrorInfo
End If
Console.Read()
End Try
Construtores
| Name | Description |
|---|---|
| RegistrationException() |
Inicializa uma nova instância da RegistrationException classe. |
| RegistrationException(String, Exception) |
Inicializa uma nova instância da RegistrationException classe com uma mensagem de erro especificada e uma exceção aninhada. |
| RegistrationException(String) |
Inicializa uma nova instância da RegistrationException classe com uma mensagem de erro especificada. |
Propriedades
| Name | Description |
|---|---|
| Data |
Obtém uma coleção de pares chave/valor que fornecem informação adicional definida pelo utilizador sobre a exceção. (Herdado de Exception) |
| ErrorInfo |
Recebe um array de RegistrationErrorInfo objetos que descrevem erros de registo. |
| HelpLink |
Obtém ou define um link para o ficheiro de ajuda associado a esta exceção. (Herdado de Exception) |
| HResult |
Recebe ou define HRESULT, um valor numérico codificado atribuído a uma exceção específica. (Herdado de Exception) |
| InnerException |
Obtém a Exception instância que causou a exceção atual. (Herdado de Exception) |
| Message |
Recebe uma mensagem que descreve a exceção atual. (Herdado de Exception) |
| Source |
Obtém ou define o nome do aplicativo ou o objeto que causa o erro. (Herdado de Exception) |
| StackTrace |
Obtém uma representação string dos frames imediatos na stack de chamadas. (Herdado de Exception) |
| TargetSite |
Obtém o método que lança a exceção atual. (Herdado de Exception) |
Métodos
| Name | Description |
|---|---|
| Equals(Object) |
Determina se o objeto especificado é igual ao objeto atual. (Herdado de Object) |
| GetBaseException() |
Quando sobrescrito numa classe derivada, devolve o Exception que é a causa raiz de uma ou mais exceções subsequentes. (Herdado de Exception) |
| GetHashCode() |
Serve como função de hash predefinida. (Herdado de Object) |
| GetObjectData(SerializationInfo, StreamingContext) |
Define o SerializationInfo objeto com a informação de erro em RegistrationErrorInfo. |
| GetType() |
Obtém o tipo de execução da instância atual. (Herdado de Exception) |
| MemberwiseClone() |
Cria uma cópia superficial do atual Object. (Herdado de Object) |
| ToString() |
Cria e devolve uma representação string da exceção atual. (Herdado de Exception) |
evento
| Name | Description |
|---|---|
| SerializeObjectState |
Ocorre quando uma exceção é serializada para criar um objeto de estado de exceção que contém dados serializados sobre a exceção. (Herdado de Exception) |