HostProtectionException Konstruktorer
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Initierar en ny instans av HostProtectionException klassen.
Överlagringar
| Name | Description |
|---|---|
| HostProtectionException() |
Initierar en ny instans av HostProtectionException klassen med standardvärden. |
| HostProtectionException(String) |
Initierar en ny instans av HostProtectionException klassen med ett angivet felmeddelande. |
| HostProtectionException(SerializationInfo, StreamingContext) |
Föråldrad.
Initierar en ny instans av HostProtectionException klassen med den angivna serialiseringsinformationen och strömningskontexten. |
| HostProtectionException(String, Exception) |
Initierar en ny instans av HostProtectionException klassen med ett angivet felmeddelande och en referens till det inre undantaget som är orsaken till det här undantaget. |
| HostProtectionException(String, HostProtectionResource, HostProtectionResource) |
Initierar en ny instans av HostProtectionException klassen med ett angivet felmeddelande, de skyddade värdresurserna och de värdresurser som gjorde att undantaget utlöstes. |
HostProtectionException()
Initierar en ny instans av HostProtectionException klassen med standardvärden.
public:
HostProtectionException();
public HostProtectionException();
Public Sub New ()
Kommentarer
I följande tabell visas de inledande egenskapsvärdena för en instans av HostProtectionException klassen.
| Fastighet | Value |
|---|---|
| ProtectedResources | HostProtectionResource.None |
| DemandedResources | HostProtectionResource.None |
Gäller för
HostProtectionException(String)
Initierar en ny instans av HostProtectionException klassen med ett angivet felmeddelande.
public:
HostProtectionException(System::String ^ message);
public HostProtectionException(string message);
new System.Security.HostProtectionException : string -> System.Security.HostProtectionException
Public Sub New (message As String)
Parametrar
- message
- String
Meddelandet som beskriver felet.
Kommentarer
Innehållet i parametern message bör vara begripligt för användaren. Anroparen för den här konstruktorn krävs för att säkerställa att den här strängen har lokaliserats för den aktuella systemkulturen.
Gäller för
HostProtectionException(SerializationInfo, StreamingContext)
Varning
This API supports obsolete formatter-based serialization. It should not be called or extended by application code.
Initierar en ny instans av HostProtectionException klassen med den angivna serialiseringsinformationen och strömningskontexten.
protected:
HostProtectionException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
[System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
protected HostProtectionException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
protected HostProtectionException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[<System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Security.HostProtectionException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Security.HostProtectionException
new System.Security.HostProtectionException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Security.HostProtectionException
Protected Sub New (info As SerializationInfo, context As StreamingContext)
Parametrar
- info
- SerializationInfo
Objektet som innehåller serialiserade objektdata.
- context
- StreamingContext
Sammanhangsberoende information om källan eller målet.
- Attribut
Undantag
info är null.
Kommentarer
Den här konstruktorn anropas under deserialiseringen för att rekonstruera undantagsobjektet som överförs via en ström.
Gäller för
HostProtectionException(String, Exception)
Initierar en ny instans av HostProtectionException klassen med ett angivet felmeddelande och en referens till det inre undantaget som är orsaken till det här undantaget.
public:
HostProtectionException(System::String ^ message, Exception ^ e);
public HostProtectionException(string message, Exception e);
new System.Security.HostProtectionException : string * Exception -> System.Security.HostProtectionException
Public Sub New (message As String, e As Exception)
Parametrar
- message
- String
Felmeddelandet som förklarar orsaken till undantaget.
Undantaget som är orsaken till det aktuella undantaget. Om parametern innerException inte nullär genereras det aktuella undantaget i ett catch block som hanterar det inre undantaget.
Kommentarer
Ett undantag som genereras som ett direkt resultat av ett tidigare undantag kan innehålla en referens till det tidigare undantaget i InnerException egenskapen. Egenskapen InnerException returnerar samma värde som skickas till konstruktorn, eller null om InnerException egenskapen inte anger det inre undantagsvärdet till konstruktorn.
Gäller för
HostProtectionException(String, HostProtectionResource, HostProtectionResource)
Initierar en ny instans av HostProtectionException klassen med ett angivet felmeddelande, de skyddade värdresurserna och de värdresurser som gjorde att undantaget utlöstes.
public:
HostProtectionException(System::String ^ message, System::Security::Permissions::HostProtectionResource protectedResources, System::Security::Permissions::HostProtectionResource demandedResources);
public HostProtectionException(string message, System.Security.Permissions.HostProtectionResource protectedResources, System.Security.Permissions.HostProtectionResource demandedResources);
new System.Security.HostProtectionException : string * System.Security.Permissions.HostProtectionResource * System.Security.Permissions.HostProtectionResource -> System.Security.HostProtectionException
Public Sub New (message As String, protectedResources As HostProtectionResource, demandedResources As HostProtectionResource)
Parametrar
- message
- String
Felmeddelandet som förklarar orsaken till undantaget.
- protectedResources
- HostProtectionResource
En bitvis kombination av uppräkningsvärdena som anger de värdresurser som inte är tillgängliga för delvis betrodd kod.
- demandedResources
- HostProtectionResource
En bitvis kombination av uppräkningsvärdena som anger de begärda värdresurserna.
Kommentarer
Parametern demandedResources anger de värdskyddskategorier som gjorde att undantaget utlöstes. Anta till exempel att en metod har ett HostProtectionAttribute attribut som anger att metoden exponerar delat tillstånd. När metoden anropas HostProtectionAttribute utför den ett länkbehov för delat tillstånd. Om värden har angett delat tillstånd som en förbjuden kategori genereras en HostProtectionException med egenskapsvärdet demandedResourcesHostProtectionResource.SharedState.