Partager via


DataProviderException Class

Represents the exception that occurs when there is an unexpected problem with a DDEX provider, such as missing or invalid registration or support entities.

Inheritance Hierarchy

System.Object
  System.Exception
    Microsoft.VisualStudio.Data.Core.DataProviderException

Namespace:  Microsoft.VisualStudio.Data.Core
Assembly:  Microsoft.VisualStudio.Data.Core (in Microsoft.VisualStudio.Data.Core.dll)

Syntax

'Déclaration
<SerializableAttribute> _
Public MustInherit Class DataProviderException _
    Inherits Exception
[SerializableAttribute]
public abstract class DataProviderException : Exception
[SerializableAttribute]
public ref class DataProviderException abstract : public Exception
[<AbstractClass>]
[<SerializableAttribute>]
type DataProviderException =  
    class
        inherit Exception
    end
public abstract class DataProviderException extends Exception

The DataProviderException type exposes the following members.

Constructors

  Name Description
Protected method DataProviderException() Initializes a new instance of the DataProviderException class.
Protected method DataProviderException(String) Initializes a new instance of the DataProviderException class, specifying an error message.
Protected method DataProviderException(SerializationInfo, StreamingContext) Initializes a new instance of the DataProviderException class with serialized data.
Protected method DataProviderException(String, Exception) Initializes a new instance of the DataProviderException class, specifying an error message and a reference to the inner exception that is the cause of this exception.

Top

Properties

  Name Description
Public property Data Gets a collection of key/value pairs that provide additional user-defined information about the exception. (Inherited from Exception.)
Public property HelpLink Gets or sets a link to the help file associated with this exception. (Inherited from Exception.)
Protected property HResult Gets or sets HRESULT, a coded numerical value that is assigned to a specific exception. (Inherited from Exception.)
Public property InnerException Gets the Exception instance that caused the current exception. (Inherited from Exception.)
Public property Message Gets a message that describes the current exception. (Inherited from Exception.)
Public property Source Gets or sets the name of the application or the object that causes the error. (Inherited from Exception.)
Public property StackTrace Gets a string representation of the immediate frames on the call stack. (Inherited from Exception.)
Public property TargetSite Gets the method that throws the current exception. (Inherited from Exception.)

Top

Methods

  Name Description
Public method Equals Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetBaseException When overridden in a derived class, returns the Exception that is the root cause of one or more subsequent exceptions. (Inherited from Exception.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetObjectData When overridden in a derived class, sets the SerializationInfo with information about the exception. (Inherited from Exception.)
Public method GetType Gets the runtime type of the current instance. (Inherited from Exception.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Creates and returns a string representation of the current exception. (Inherited from Exception.)

Top

Remarks

This exception is thrown when initial verification of DDEX provider registration by the DDEX provider manager service is successful, but on further interrogation it is discovered to be erroneous. It is also thrown when core support entities such as the IVsDataConnectionProperties interface, which are considered fundamental to a DDEX provider implementation, are not found or supported.

When this exception is thrown, a generic error message is shown to the user, indicating that there is a problem in the DDEX provider and that the provider writer should be contacted. The full error description is logged in the Windows event log.

It is not expected that clients or providers will catch and handle this exception, unless it is within a general catch block that eventually re-throws or displays the error message in a message box.

DataProviderException uses HRESULT E_UNEXPECTED, which has the value 0x8000FFFF.

Examples

The following code demonstrates the attempted creation of a DDEX support entity by using an IVsDataProvider object. If the support entity cannot be created, the code displays a message box containing an error.

using System;
using System.Windows.Forms;
using Microsoft.VisualStudio.Data.Core;
using Microsoft.VisualStudio.Data.Services.SupportEntities;

public class DdexExample
{
    public static IVsDataConnectionProperties CreateConnectionProperties(
        IVsDataProvider provider)
    {
        IVsDataConnectionProperties connProperties = null;
        try
        {
            connProperties = provider.CreateObject<IVsDataConnectionProperties>();
        }
        catch (DataProviderException e)
        {
            MessageBox.Show(e.Message);
        }
        return connProperties;
    }
}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.VisualStudio.Data.Core Namespace