From 22cd71760e72fe9384ed64d11124f60f3eee7fda Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Tue, 11 Mar 2025 19:27:34 -0700 Subject: [PATCH 1/2] add missing code snippets --- .../s_ueexceptionhandler/cs/program.cs | 11 ++- .../ExceptionHandler.xml | 96 ++++++++++--------- 2 files changed, 55 insertions(+), 52 deletions(-) diff --git a/snippets/csharp/VS_Snippets_CFX/s_ueexceptionhandler/cs/program.cs b/snippets/csharp/VS_Snippets_CFX/s_ueexceptionhandler/cs/program.cs index 0bf7f464111..3e761a9de64 100644 --- a/snippets/csharp/VS_Snippets_CFX/s_ueexceptionhandler/cs/program.cs +++ b/snippets/csharp/VS_Snippets_CFX/s_ueexceptionhandler/cs/program.cs @@ -1,7 +1,7 @@ // Snippet for S_UE System.ServiceModel.Dispatcher.ExceptionHandler.HandleException // 06192006 Created by A.Hu -// +// using System; using System.ServiceModel.Dispatcher; @@ -26,12 +26,12 @@ public bool ShouldTerminateProcess (Exception ex) } } -// +// class Program { -// static void Main(string[] args) { + // // Create an instance of the MyExceptionHandler class. MyExceptionHandler thisExceptionHandler = new MyExceptionHandler(); @@ -43,8 +43,9 @@ static void Main(string[] args) thisExceptionHandler; // After the handler is set, write your call to - // System.ServiceModel.ICommunication.Open here + // System.ServiceModel.ICommunication.Open here. + + // } } -// } diff --git a/xml/System.ServiceModel.Dispatcher/ExceptionHandler.xml b/xml/System.ServiceModel.Dispatcher/ExceptionHandler.xml index 62c6f26fbd4..30f34876e2d 100644 --- a/xml/System.ServiceModel.Dispatcher/ExceptionHandler.xml +++ b/xml/System.ServiceModel.Dispatcher/ExceptionHandler.xml @@ -17,24 +17,24 @@ Extend the class to create an exception handler for unhandled exceptions that occur within the Windows Communication Foundation (WCF) runtime. - class and override the method to determine whether an exception should terminate the application. Then create a new instance of your custom class and assign it to the static or property prior to creating WCF clients or services. - - - -## Examples - The following code example shows an implementation of the abstract class that overrides the method. - + class and override the method to determine whether an exception should terminate the application. Then create a new instance of your custom class and assign it to the static or property prior to creating WCF clients or services. + +## Examples + + The following code example shows an implementation of the abstract class that overrides the method. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_CFX/s_ueexceptionhandler/cs/program.cs" id="Snippet0"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CFX/s_ueexceptionhandler/vb/module1.vb" id="Snippet0"::: - - The following code example shows how to enable the custom `MyExceptionHandler` for unhandled exceptions that occur within the WCF runtime. - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CFX/s_ueexceptionhandler/vb/module1.vb" id="Snippet0"::: + + The following code example shows how to enable the custom `MyExceptionHandler` for unhandled exceptions that occur within the WCF runtime. + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_CFX/s_ueexceptionhandler/cs/program.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CFX/s_ueexceptionhandler/vb/module1.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CFX/s_ueexceptionhandler/vb/module1.vb" id="Snippet1"::: + ]]> @@ -137,13 +137,13 @@ Gets or sets the current implementation for the application domain. Assign a custom object that receives unhandled exceptions that occur on asynchronous Windows Communication Foundation (WCF) threads. - property is `null`, and unhandled exceptions on asynchronous WCF threads terminate the application. Set this property to an object to receive and react to these exceptions. - - If an unhandled exception occurs on an asynchronous WCF thread and reaches this handler, the state of the application domain may be compromised. should not return `true` for these exceptions. - + property is `null`, and unhandled exceptions on asynchronous WCF threads terminate the application. Set this property to an object to receive and react to these exceptions. + + If an unhandled exception occurs on an asynchronous WCF thread and reaches this handler, the state of the application domain may be compromised. should not return `true` for these exceptions. + ]]> @@ -168,27 +168,28 @@ - The exception the occurred within the Windows Communication Foundation (WCF) runtime and which may terminate the application. + The exception that occurred within the Windows Communication Foundation (WCF) runtime and which might terminate the application. When overridden in a derived class, returns if the exception has been handled, or if the exception should be rethrown and the application terminated. if the exception has been handled; otherwise, . - property returns `true` if the exception has been handled. If it returns `false` or throws a different exception, the original exception is rethrown. - - - -## Examples - The following code example shows an implementation of the abstract class that overrides the method. - - - - The following code example shows how to enable the custom `MyExceptionHandler` for unhandled exceptions that occur within the WCF runtime. - - - + property returns `true` if the exception has been handled. If it returns `false` or throws a different exception, the original exception is rethrown. + +## Examples + + The following code example shows an implementation of the abstract class that overrides the method. + + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_CFX/s_ueexceptionhandler/cs/program.cs" id="Snippet0"::: + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CFX/s_ueexceptionhandler/vb/module1.vb" id="Snippet0"::: + + The following code example shows how to enable the custom `MyExceptionHandler` for unhandled exceptions that occur within the WCF runtime. + + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_CFX/s_ueexceptionhandler/cs/program.cs" id="Snippet1"::: + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CFX/s_ueexceptionhandler/vb/module1.vb" id="Snippet1"::: + ]]> @@ -223,13 +224,14 @@ Gets or sets the current transport implementation for the application domain. A custom object that receives unhandled exceptions that occur within the global Windows Communication Foundation (WCF) transports. - property is set to the value of , causing unhandled exceptions within WCF transports to be ignored. Set this property to an instance of to receive and react to these exceptions. - - If an unhandled exception occurs within a global WCF transport and reaches this handler, there is a possibility that the state of the application domain is compromised. can return `false` for these exceptions to cause the application to be terminated. - + property is set to the value of , causing unhandled exceptions within WCF transports to be ignored. Set this property to an instance of to receive and react to these exceptions. + + If an unhandled exception occurs within a global WCF transport and reaches this handler, there is a possibility that the state of the application domain is compromised. can return `false` for these exceptions to cause the application to be terminated. + ]]> From 61aebb311def3de0d367c33adb970eec11a481c9 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Tue, 11 Mar 2025 19:38:28 -0700 Subject: [PATCH 2/2] fix snippets 5000 error --- .../s_ueexceptionhandler/cs/app.config | 3 ++ .../s_ueexceptionhandler/cs/cs.csproj | 9 ++++- .../s_ueexceptionhandler/cs/makefile | 3 -- .../s_ueexceptionhandler/cs/program.cs | 34 +++++++++---------- 4 files changed, 28 insertions(+), 21 deletions(-) create mode 100644 snippets/csharp/VS_Snippets_CFX/s_ueexceptionhandler/cs/app.config delete mode 100644 snippets/csharp/VS_Snippets_CFX/s_ueexceptionhandler/cs/makefile diff --git a/snippets/csharp/VS_Snippets_CFX/s_ueexceptionhandler/cs/app.config b/snippets/csharp/VS_Snippets_CFX/s_ueexceptionhandler/cs/app.config new file mode 100644 index 00000000000..eca069e41db --- /dev/null +++ b/snippets/csharp/VS_Snippets_CFX/s_ueexceptionhandler/cs/app.config @@ -0,0 +1,3 @@ + + + diff --git a/snippets/csharp/VS_Snippets_CFX/s_ueexceptionhandler/cs/cs.csproj b/snippets/csharp/VS_Snippets_CFX/s_ueexceptionhandler/cs/cs.csproj index 54009ceaac6..435c22a8538 100644 --- a/snippets/csharp/VS_Snippets_CFX/s_ueexceptionhandler/cs/cs.csproj +++ b/snippets/csharp/VS_Snippets_CFX/s_ueexceptionhandler/cs/cs.csproj @@ -1,4 +1,4 @@ - + Debug AnyCPU @@ -9,6 +9,8 @@ Properties CS CS + v4.8.1 + true @@ -18,6 +20,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -26,6 +29,7 @@ TRACE prompt 4 + false @@ -41,6 +45,9 @@ + + +