Skip to content

Commit 22cd717

Browse files
committed
add missing code snippets
1 parent 17a1a93 commit 22cd717

File tree

2 files changed

+55
-52
lines changed

2 files changed

+55
-52
lines changed

snippets/csharp/VS_Snippets_CFX/s_ueexceptionhandler/cs/program.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Snippet for S_UE System.ServiceModel.Dispatcher.ExceptionHandler.HandleException
22
// 06192006 Created by A.Hu
33

4-
// <snippet0>
4+
// <Snippet0>
55
using System;
66
using System.ServiceModel.Dispatcher;
77

@@ -26,12 +26,12 @@ public bool ShouldTerminateProcess (Exception ex)
2626
}
2727
}
2828

29-
// </snippet0>
29+
// </Snippet0>
3030
class Program
3131
{
32-
// <snippet1>
3332
static void Main(string[] args)
3433
{
34+
// <Snippet1>
3535
// Create an instance of the MyExceptionHandler class.
3636
MyExceptionHandler thisExceptionHandler =
3737
new MyExceptionHandler();
@@ -43,8 +43,9 @@ static void Main(string[] args)
4343
thisExceptionHandler;
4444

4545
// After the handler is set, write your call to
46-
// System.ServiceModel.ICommunication.Open here
46+
// System.ServiceModel.ICommunication.Open here.
47+
48+
// </Snippet1>
4749
}
4850
}
49-
// </snippet1>
5051
}

xml/System.ServiceModel.Dispatcher/ExceptionHandler.xml

Lines changed: 49 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,24 @@
1717
<Docs>
1818
<summary>Extend the <see cref="T:System.ServiceModel.Dispatcher.ExceptionHandler" /> class to create an exception handler for unhandled exceptions that occur within the Windows Communication Foundation (WCF) runtime.</summary>
1919
<remarks>
20-
<format type="text/markdown"><![CDATA[
21-
22-
## Remarks
23-
Extend the <xref:System.ServiceModel.Dispatcher.ExceptionHandler> class and override the <xref:System.ServiceModel.Dispatcher.ExceptionHandler.HandleException%2A> method to determine whether an exception should terminate the application. Then create a new instance of your custom <xref:System.ServiceModel.Dispatcher.ExceptionHandler> class and assign it to the static <xref:System.ServiceModel.Dispatcher.ExceptionHandler.AsynchronousThreadExceptionHandler%2A> or <xref:System.ServiceModel.Dispatcher.ExceptionHandler.TransportExceptionHandler%2A> property prior to creating WCF clients or services.
24-
25-
26-
27-
## Examples
28-
The following code example shows an implementation of the <xref:System.ServiceModel.Dispatcher.ExceptionHandler> abstract class that overrides the <xref:System.ServiceModel.Dispatcher.ExceptionHandler.HandleException%2A> method.
29-
20+
<format type="text/markdown"><![CDATA[
21+
22+
## Remarks
23+
24+
Extend the <xref:System.ServiceModel.Dispatcher.ExceptionHandler> class and override the <xref:System.ServiceModel.Dispatcher.ExceptionHandler.HandleException%2A> method to determine whether an exception should terminate the application. Then create a new instance of your custom <xref:System.ServiceModel.Dispatcher.ExceptionHandler> class and assign it to the static <xref:System.ServiceModel.Dispatcher.ExceptionHandler.AsynchronousThreadExceptionHandler%2A> or <xref:System.ServiceModel.Dispatcher.ExceptionHandler.TransportExceptionHandler%2A> property prior to creating WCF clients or services.
25+
26+
## Examples
27+
28+
The following code example shows an implementation of the <xref:System.ServiceModel.Dispatcher.ExceptionHandler> abstract class that overrides the <xref:System.ServiceModel.Dispatcher.ExceptionHandler.HandleException%2A> method.
29+
3030
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_CFX/s_ueexceptionhandler/cs/program.cs" id="Snippet0":::
31-
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CFX/s_ueexceptionhandler/vb/module1.vb" id="Snippet0":::
32-
33-
The following code example shows how to enable the custom `MyExceptionHandler` for unhandled exceptions that occur within the WCF runtime.
34-
31+
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CFX/s_ueexceptionhandler/vb/module1.vb" id="Snippet0":::
32+
33+
The following code example shows how to enable the custom `MyExceptionHandler` for unhandled exceptions that occur within the WCF runtime.
34+
3535
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_CFX/s_ueexceptionhandler/cs/program.cs" id="Snippet1":::
36-
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CFX/s_ueexceptionhandler/vb/module1.vb" id="Snippet1":::
37-
36+
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CFX/s_ueexceptionhandler/vb/module1.vb" id="Snippet1":::
37+
3838
]]></format>
3939
</remarks>
4040
</Docs>
@@ -137,13 +137,13 @@
137137
<summary>Gets or sets the current <see cref="T:System.ServiceModel.Dispatcher.ExceptionHandler" /> implementation for the application domain.</summary>
138138
<value>Assign a custom <see cref="T:System.ServiceModel.Dispatcher.ExceptionHandler" /> object that receives unhandled exceptions that occur on asynchronous Windows Communication Foundation (WCF) threads.</value>
139139
<remarks>
140-
<format type="text/markdown"><![CDATA[
141-
142-
## Remarks
143-
By default, the <xref:System.ServiceModel.Dispatcher.ExceptionHandler.AsynchronousThreadExceptionHandler%2A> property is `null`, and unhandled exceptions on asynchronous WCF threads terminate the application. Set this property to an <xref:System.ServiceModel.Dispatcher.ExceptionHandler> object to receive and react to these exceptions.
144-
145-
If an unhandled exception occurs on an asynchronous WCF thread and reaches this handler, the state of the application domain may be compromised. <xref:System.ServiceModel.Dispatcher.ExceptionHandler.HandleException%2A> should not return `true` for these exceptions.
146-
140+
<format type="text/markdown"><![CDATA[
141+
142+
## Remarks
143+
By default, the <xref:System.ServiceModel.Dispatcher.ExceptionHandler.AsynchronousThreadExceptionHandler%2A> property is `null`, and unhandled exceptions on asynchronous WCF threads terminate the application. Set this property to an <xref:System.ServiceModel.Dispatcher.ExceptionHandler> object to receive and react to these exceptions.
144+
145+
If an unhandled exception occurs on an asynchronous WCF thread and reaches this handler, the state of the application domain may be compromised. <xref:System.ServiceModel.Dispatcher.ExceptionHandler.HandleException%2A> should not return `true` for these exceptions.
146+
147147
]]></format>
148148
</remarks>
149149
</Docs>
@@ -168,27 +168,28 @@
168168
<Parameter Name="exception" Type="System.Exception" />
169169
</Parameters>
170170
<Docs>
171-
<param name="exception">The exception the occurred within the Windows Communication Foundation (WCF) runtime and which may terminate the application.</param>
171+
<param name="exception">The exception that occurred within the Windows Communication Foundation (WCF) runtime and which might terminate the application.</param>
172172
<summary>When overridden in a derived class, returns <see langword="true" /> if the exception has been handled, or <see langword="false" /> if the exception should be rethrown and the application terminated.</summary>
173173
<returns>
174174
<see langword="true" /> if the exception has been handled; otherwise, <see langword="false" />.</returns>
175175
<remarks>
176-
<format type="text/markdown"><![CDATA[
177-
178-
## Remarks
179-
The <xref:System.ServiceModel.Dispatcher.ExceptionHandler.HandleException%2A> property returns `true` if the exception has been handled. If it returns `false` or throws a different exception, the original exception is rethrown.
180-
181-
182-
183-
## Examples
184-
The following code example shows an implementation of the <xref:System.ServiceModel.Dispatcher.ExceptionHandler> abstract class that overrides the <xref:System.ServiceModel.Dispatcher.ExceptionHandler.HandleException%2A> method.
185-
186-
187-
188-
The following code example shows how to enable the custom `MyExceptionHandler` for unhandled exceptions that occur within the WCF runtime.
189-
190-
191-
176+
<format type="text/markdown"><![CDATA[
177+
178+
## Remarks
179+
The <xref:System.ServiceModel.Dispatcher.ExceptionHandler.HandleException%2A> property returns `true` if the exception has been handled. If it returns `false` or throws a different exception, the original exception is rethrown.
180+
181+
## Examples
182+
183+
The following code example shows an implementation of the <xref:System.ServiceModel.Dispatcher.ExceptionHandler> abstract class that overrides the <xref:System.ServiceModel.Dispatcher.ExceptionHandler.HandleException%2A> method.
184+
185+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_CFX/s_ueexceptionhandler/cs/program.cs" id="Snippet0":::
186+
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CFX/s_ueexceptionhandler/vb/module1.vb" id="Snippet0":::
187+
188+
The following code example shows how to enable the custom `MyExceptionHandler` for unhandled exceptions that occur within the WCF runtime.
189+
190+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_CFX/s_ueexceptionhandler/cs/program.cs" id="Snippet1":::
191+
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CFX/s_ueexceptionhandler/vb/module1.vb" id="Snippet1":::
192+
192193
]]></format>
193194
</remarks>
194195
</Docs>
@@ -223,13 +224,14 @@
223224
<summary>Gets or sets the current transport <see cref="T:System.ServiceModel.Dispatcher.ExceptionHandler" /> implementation for the application domain.</summary>
224225
<value>A custom <see cref="T:System.ServiceModel.Dispatcher.ExceptionHandler" /> object that receives unhandled exceptions that occur within the global Windows Communication Foundation (WCF) transports.</value>
225226
<remarks>
226-
<format type="text/markdown"><![CDATA[
227-
228-
## Remarks
229-
By default, the <xref:System.ServiceModel.Dispatcher.ExceptionHandler.TransportExceptionHandler%2A> property is set to the value of <xref:System.ServiceModel.Dispatcher.ExceptionHandler.AlwaysHandle%2A>, causing unhandled exceptions within WCF transports to be ignored. Set this property to an instance of <xref:System.ServiceModel.Dispatcher.ExceptionHandler> to receive and react to these exceptions.
230-
231-
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. <xref:System.ServiceModel.Dispatcher.ExceptionHandler.HandleException%2A> can return `false` for these exceptions to cause the application to be terminated.
232-
227+
<format type="text/markdown"><![CDATA[
228+
229+
## Remarks
230+
231+
By default, the <xref:System.ServiceModel.Dispatcher.ExceptionHandler.TransportExceptionHandler%2A> property is set to the value of <xref:System.ServiceModel.Dispatcher.ExceptionHandler.AlwaysHandle%2A>, causing unhandled exceptions within WCF transports to be ignored. Set this property to an instance of <xref:System.ServiceModel.Dispatcher.ExceptionHandler> to receive and react to these exceptions.
232+
233+
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. <xref:System.ServiceModel.Dispatcher.ExceptionHandler.HandleException%2A> can return `false` for these exceptions to cause the application to be terminated.
234+
233235
]]></format>
234236
</remarks>
235237
</Docs>

0 commit comments

Comments
 (0)