diff --git a/snippets/fsharp/System/Exception/.ctor/fs.fsproj b/snippets/fsharp/System/Exception/.ctor/fs.fsproj
new file mode 100644
index 00000000000..c6155c6b0f2
--- /dev/null
+++ b/snippets/fsharp/System/Exception/.ctor/fs.fsproj
@@ -0,0 +1,17 @@
+
+
+ Exe
+ net48
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/snippets/fsharp/System/Exception/.ctor/getobjdata.fs b/snippets/fsharp/System/Exception/.ctor/getobjdata.fs
new file mode 100644
index 00000000000..39391993c25
--- /dev/null
+++ b/snippets/fsharp/System/Exception/.ctor/getobjdata.fs
@@ -0,0 +1,104 @@
+module NDP_UE_FS_3
+
+//
+open System
+open System.IO
+open System.Runtime.Serialization
+open System.Runtime.Serialization.Formatters.Soap
+open System.Security.Permissions
+
+ // Define a serializable derived exception class.
+ []
+ type SecondLevelException =
+ inherit Exception
+
+ interface ISerializable with
+ // GetObjectData performs a custom serialization.
+ []
+ member this.GetObjectData(info: SerializationInfo, context: StreamingContext) =
+ // Change the case of two properties, and then use the
+ // method of the base class.
+ this.HelpLink <- this.HelpLink.ToLower()
+ this.Source <- this.Source.ToUpperInvariant()
+
+ base.GetObjectData( info, context )
+ // This public constructor is used by class instantiators.
+ new (message: string, inner: Exception) as this =
+ { inherit Exception(message, inner) }
+ then
+ this.HelpLink <- "http://MSDN.Microsoft.com"
+ this.Source <- "Exception_Class_Samples"
+
+ // This protected constructor is used for deserialization.
+ new (info: SerializationInfo, context: StreamingContext) =
+ { inherit Exception(info, context) }
+
+printfn
+ """This example of the Exception constructor and Exception.GetObjectData
+with SerializationInfo and StreamingContext parameters generates
+the following output.
+"""
+
+try
+ // This code forces a division by 0 and catches the
+ // resulting exception.
+ try
+ let zero = 0
+ let ecks = 1 / zero
+ ()
+ with ex ->
+ // Create a new exception to throw again.
+ let newExcept = SecondLevelException("Forced a division by 0 and threw another exception.", ex)
+
+ printfn "Forced a division by 0, caught the resulting exception, \nand created a derived exception:\n"
+ printfn $"HelpLink: {newExcept.HelpLink}"
+ printfn $"Source: {newExcept.Source}"
+
+ // This FileStream is used for the serialization.
+ use stream = new FileStream("NewException.dat", FileMode.Create)
+
+ try
+ // Serialize the derived exception.
+ let formatter = SoapFormatter(null, StreamingContext StreamingContextStates.File)
+ formatter.Serialize(stream, newExcept)
+
+ // Rewind the stream and deserialize the
+ // exception.
+ stream.Position <- 0L
+ let deserExcept = formatter.Deserialize stream :?> SecondLevelException
+
+ printfn
+ """
+Serialized the exception, and then deserialized the resulting stream into a
+new exception. The deserialization changed the case of certain properties:
+"""
+
+ // Throw the deserialized exception again.
+ raise deserExcept
+ with :? SerializationException as se ->
+ printfn $"Failed to serialize: {se}"
+
+with ex ->
+ printfn $"HelpLink: {ex.HelpLink}"
+ printfn $"Source: {ex.Source}"
+ printfn $"\n{ex}"
+
+// This example displays the following output.
+// Forced a division by 0, caught the resulting exception,
+// and created a derived exception:
+//
+// HelpLink: http://MSDN.Microsoft.com
+// Source: Exception_Class_Samples
+//
+// Serialized the exception, and then deserialized the resulting stream into a
+// new exception. The deserialization changed the case of certain properties:
+//
+// HelpLink: http://msdn.microsoft.com
+// Source: EXCEPTION_CLASS_SAMPLES
+//
+// NDP_UE_FS_3+SecondLevelException: Forced a division by 0 and threw another except
+// ion. ---> System.DivideByZeroException: Attempted to divide by zero.
+// at .$NDP_UE_FS_3.main@()
+// --- End of inner exception stack trace ---
+// at .$NDP_UE_FS_3.main@()
+//
diff --git a/snippets/fsharp/System/Exception/.ctor/new.fs b/snippets/fsharp/System/Exception/.ctor/new.fs
new file mode 100644
index 00000000000..0622b2befb3
--- /dev/null
+++ b/snippets/fsharp/System/Exception/.ctor/new.fs
@@ -0,0 +1,68 @@
+module NDP_UE_FS
+
+//
+// Example for the Exception() constructor.
+open System
+
+// Derive an exception with a predefined message.
+type NotEvenException() =
+ inherit Exception "The argument to a function requiring even input is not divisible by 2."
+
+// half throws a base exception if the input is not even.
+let half input =
+ if input % 2 <> 0 then
+ raise (Exception())
+ else input / 2
+
+// half2 throws a derived exception if the input is not even.
+let half2 input =
+ if input % 2 <> 0 then
+ raise (NotEvenException())
+ else input / 2
+
+// calcHalf calls Half and catches any thrown exceptions.
+let calcHalf input =
+ try
+ let halfInput = half input
+ printfn $"Half of {input} is {halfInput}."
+ with ex ->
+ printfn $"{ex}"
+
+// calcHalf2 calls Half2 and catches any thrown exceptions.
+let calcHalf2 input =
+ try
+ let halfInput = half2 input
+ printfn $"Half of {input} is {halfInput}."
+ with ex ->
+ printfn $"{ex}"
+
+printfn "This example of the Exception() constructor generates the following output."
+printfn "\nHere, an exception is thrown using the \nparameterless constructor of the base class.\n"
+
+calcHalf 12
+calcHalf 15
+
+printfn "\nHere, an exception is thrown using the \nparameterless constructor of a derived class.\n"
+
+calcHalf2 24
+calcHalf2 27
+
+
+// This example of the Exception() constructor generates the following output.
+// Here, an exception is thrown using the
+// parameterless constructor of the base class.
+//
+// Half of 12 is 6.
+// System.Exception: Exception of type 'System.Exception' was thrown.
+// at NDP_UE_FS.half(Int32 input)
+// at at NDP_UE_FS.calcHalf(Int32 input)
+//
+// Here, an exception is thrown using the
+// parameterless constructor of a derived class.
+//
+// Half of 24 is 12.
+// NDP_UE_FS+NotEvenException: The argument to a function requiring even input is
+// not divisible by 2.
+// at NDP_UE_FS.half2(Int32 input)
+// at NDP_UE_FS.calcHalf2(Int32 input)
+//
\ No newline at end of file
diff --git a/snippets/fsharp/System/Exception/.ctor/news.fs b/snippets/fsharp/System/Exception/.ctor/news.fs
new file mode 100644
index 00000000000..4cfcc22a7b6
--- /dev/null
+++ b/snippets/fsharp/System/Exception/.ctor/news.fs
@@ -0,0 +1,74 @@
+module NDP_UE_FS_2
+
+//
+// Example for the Exception(string) constructor.
+open System
+
+let notEvenMessage = "The argument to a function requiring even input is not divisible by 2."
+
+// Derive an exception with a specifiable message.
+type NotEvenException =
+ inherit Exception
+ new () = { inherit Exception(notEvenMessage) }
+ new (auxMessage) = { inherit Exception($"{auxMessage} - {notEvenMessage}") }
+
+// half throws a base exception if the input is not even.
+let half input =
+ if input % 2 <> 0 then
+ raise (Exception $"The argument {input} is not divisible by 2.")
+ else input / 2
+
+// half2 throws a derived exception if the input is not even.
+let half2 input =
+ if input % 2 <> 0 then
+ raise (NotEvenException $"Invalid argument: {input}")
+ else input / 2
+
+// calcHalf calls Half and catches any thrown exceptions.
+let calcHalf input =
+ try
+ let halfInput = half input
+ printfn $"Half of {input} is {halfInput}."
+ with ex ->
+ printfn $"{ex}"
+
+// calcHalf2 calls Half2 and catches any thrown exceptions.
+let calcHalf2 input =
+ try
+ let halfInput = half2 input
+ printfn $"Half of {input} is {halfInput}."
+ with ex ->
+ printfn $"{ex}"
+
+printfn "This example of the Exception(string)\nconstructor generates the following output."
+printfn "\nHere, an exception is thrown using the \nconstructor of the base class.\n"
+
+calcHalf 18
+calcHalf 21
+
+printfn "\nHere, an exception is thrown using the \nconstructor of a derived class.\n"
+
+calcHalf2 30
+calcHalf2 33
+
+
+// This example of the Exception(string)
+// constructor generates the following output.
+//
+// Here, an exception is thrown using the
+// constructor of the base class.
+//
+// Half of 18 is 9.
+// System.Exception: The argument 21 is not divisible by 2.
+// at NDP_UE_FS_2.half(Int32 input)
+// at NDP_UE_FS_2.calcHalf(Int32 input)
+//
+// Here, an exception is thrown using the
+// constructor of a derived class.
+//
+// Half of 30 is 15.
+// NDP_UE_FS_2+NotEvenException: Invalid argument: 33 - The argument to a function r
+// equiring even input is not divisible by 2.
+// at NDP_UE_FS_2.half2(Int32 input)
+// at NDP_UE_FS_2.calcHalf2(Int32 input)
+//
\ No newline at end of file
diff --git a/snippets/fsharp/System/Exception/.ctor/newsi.fs b/snippets/fsharp/System/Exception/.ctor/newsi.fs
new file mode 100644
index 00000000000..efb438212a5
--- /dev/null
+++ b/snippets/fsharp/System/Exception/.ctor/newsi.fs
@@ -0,0 +1,60 @@
+module NDP_UE_FS_4
+
+//
+// Example for the Exception(string, Exception) constructor.
+open System
+
+let overflowMessage = "The log table has overflowed."
+
+// Derive an exception with a specifiable message and inner exception.
+type LogTableOverflowException =
+ inherit Exception
+
+ new () = { inherit Exception(overflowMessage) }
+
+ new (auxMessage: string) =
+ { inherit Exception($"{overflowMessage} - {auxMessage}") }
+
+ new (auxMessage: string, inner: Exception) =
+ { inherit Exception($"{overflowMessage} - {auxMessage}", inner ) }
+
+type LogTable(numElements: int) =
+ let mutable logArea = Array.zeroCreate numElements
+ let mutable elemInUse = 0
+
+ // The AddRecord method throws a derived exception
+ // if the array bounds exception is caught.
+ member _.AddRecord(newRecord: string): int =
+ try
+ logArea[elemInUse] <- newRecord
+ elemInUse <- elemInUse + 1
+ elemInUse - 1
+ with ex ->
+ raise (LogTableOverflowException($"Record \"{newRecord}\" was not logged.", ex ) )
+
+// Create a log table and force an overflow.
+let log = LogTable 4
+
+printfn "This example of the Exception(string, Exception)\nconstructor generates the following output."
+printfn "\nExample of a derived exception that references an inner exception:\n"
+try
+ for count = 1 to 1000 do
+ log.AddRecord $"Log record number {count}"
+ |> ignore
+with ex ->
+ printfn $"{ex}"
+
+
+// This example of the Exception(string, Exception)
+// constructor generates the following output.
+//
+// Example of a derived exception that references an inner exception:
+//
+// NDP_UE_FS_4+LogTableOverflowException: The log table has overflowed. - Record "Lo
+// g record number 5" was not logged. ---> System.IndexOutOfRangeException: Index
+// was outside the bounds of the array.
+// at NDP_UE_FS_4.LogTable.AddRecord(String newRecord)
+// --- End of inner exception stack trace ---
+// at NDP_UE_FS_4.LogTable.AddRecord(String newRecord)
+// at .$NDP_UE_FS_4.main@()
+//
\ No newline at end of file
diff --git a/snippets/fsharp/System/Exception/Data/data.fs b/snippets/fsharp/System/Exception/Data/data.fs
new file mode 100644
index 00000000000..0e271228bf6
--- /dev/null
+++ b/snippets/fsharp/System/Exception/Data/data.fs
@@ -0,0 +1,60 @@
+//
+// This example demonstrates the Exception.Data property.
+open System
+open System.Collections
+
+let nestedRoutine2 displayDetails =
+ let e = Exception "This statement is the original exception message."
+ if displayDetails then
+ let s = "Information from nestedRoutine2."
+ let i = -903
+ let dt = DateTime.Now
+ e.Data.Add("stringInfo", s)
+ e.Data["IntInfo"] <- i
+ e.Data["DateTimeInfo"] <- dt
+ raise e
+
+let nestedRoutine1 displayDetails =
+ try
+ nestedRoutine2 displayDetails
+ with e ->
+ e.Data["ExtraInfo"] <- "Information from nestedRoutine1."
+ e.Data.Add("MoreExtraInfo", "More information from nestedRoutine1.")
+ reraise ()
+
+let runTest displayDetails =
+ try
+ nestedRoutine1 displayDetails
+ with e ->
+ printfn "An exception was thrown."
+ printfn $"{e.Message}"
+ if e.Data.Count > 0 then
+ printfn " Extra details:"
+ for de in e.Data do
+ let de = de :?> DictionaryEntry
+ printfn $""" Key: {"'" + de.Key.ToString() + "'",-20} Value: {de.Value}"""
+
+printfn "\nException with some extra information..."
+runTest false
+printfn "\nException with all extra information..."
+runTest true
+
+
+// The example displays the following output:
+// Exception with some extra information...
+// An exception was thrown.
+// This statement is the original exception message.
+// Extra details:
+// Key: 'ExtraInfo' Value: Information from NestedRoutine1.
+// Key: 'MoreExtraInfo' Value: More information from NestedRoutine1.
+//
+// Exception with all extra information...
+// An exception was thrown.
+// This statement is the original exception message.
+// Extra details:
+// Key: 'stringInfo' Value: Information from NestedRoutine2.
+// Key: 'IntInfo' Value: -903
+// Key: 'DateTimeInfo' Value: 7/29/2013 10:50:13 AM
+// Key: 'ExtraInfo' Value: Information from NestedRoutine1.
+// Key: 'MoreExtraInfo' Value: More information from NestedRoutine1.
+//
\ No newline at end of file
diff --git a/snippets/fsharp/System/Exception/Data/fs.fsproj b/snippets/fsharp/System/Exception/Data/fs.fsproj
new file mode 100644
index 00000000000..af247236f2b
--- /dev/null
+++ b/snippets/fsharp/System/Exception/Data/fs.fsproj
@@ -0,0 +1,10 @@
+
+
+ Exe
+ net6.0
+
+
+
+
+
+
\ No newline at end of file
diff --git a/snippets/fsharp/System/Exception/GetBaseException/fs.fsproj b/snippets/fsharp/System/Exception/GetBaseException/fs.fsproj
new file mode 100644
index 00000000000..1f94bb641d1
--- /dev/null
+++ b/snippets/fsharp/System/Exception/GetBaseException/fs.fsproj
@@ -0,0 +1,10 @@
+
+
+ Exe
+ net6.0
+
+
+
+
+
+
\ No newline at end of file
diff --git a/snippets/fsharp/System/Exception/GetBaseException/getbaseexc.fs b/snippets/fsharp/System/Exception/GetBaseException/getbaseexc.fs
new file mode 100644
index 00000000000..980bc2247ca
--- /dev/null
+++ b/snippets/fsharp/System/Exception/GetBaseException/getbaseexc.fs
@@ -0,0 +1,91 @@
+module NDP_UE_FS
+
+//
+// Example for the Exception.GetBaseException method.
+open System
+
+// Define two derived exceptions to demonstrate nested exceptions.
+type SecondLevelException(message, inner: Exception) =
+ inherit Exception(message, inner)
+
+type ThirdLevelException(message, inner: Exception) =
+ inherit Exception(message, inner)
+
+printfn
+ """This example of Exception.GetBaseException generates the following output.
+
+The program forces a division by 0, then throws the exception
+twice more, using a different derived exception each time.
+"""
+
+
+// This function forces a division by 0 and throws a second exception.
+let divideBy0 () =
+ try
+ let zero = 0
+ let ecks = 1 / zero
+ ()
+ with ex ->
+ raise (SecondLevelException("Forced a division by 0 and threw a second exception.", ex) )
+
+// This function catches the exception from the called
+// function divideBy0() and throws another in response.
+let rethrow () =
+ try
+ divideBy0 ()
+ with ex ->
+ raise (ThirdLevelException("Caught the second exception and threw a third in response.", ex) )
+
+try
+ // This function calls another that forces a
+ // division by 0.
+ rethrow ()
+with ex ->
+ printfn "Unwind the nested exceptions using the InnerException property:\n"
+
+ // This code unwinds the nested exceptions using the
+ // InnerException property.
+ let mutable current = ex
+ while current <> null do
+ printfn $"{current}\n"
+ current <- current.InnerException
+
+ // Display the innermost exception.
+ printfn "Display the base exception using the GetBaseException method:\n"
+ printfn $"{ex.GetBaseException()}"
+
+
+// This example of Exception.GetBaseException generates the following output.
+//
+// The program forces a division by 0, then throws the exception
+// twice more, using a different derived exception each time.
+//
+// Unwind the nested exceptions using the InnerException property:
+//
+// NDP_UE_FS+ThirdLevelException: Caught the second exception and threw a third in
+// response. ---> NDP_UE_FS.SecondLevelException: Forced a division by 0 and thre
+// w a second exception. ---> System.DivideByZeroException: Attempted to divide by
+// zero.
+// at NDP_UE_FS.divideBy0()
+// --- End of inner exception stack trace ---
+// at NDP_UE_FS.divideBy0()
+// at NDP_UE_FS.rethrow()
+// --- End of inner exception stack trace ---
+// at NDP_UE_FS.rethrow()
+// at.$NDP_UE_FS.main@()
+//
+// NDP_UE_FS.SecondLevelException: Forced a division by 0 and threw a second excep
+// tion. ---> System.DivideByZeroException: Attempted to divide by zero.
+// at NDP_UE_FS.divideBy0()
+// --- End of inner exception stack trace ---
+// at NDP_UE_FS.divideBy0()
+// at NDP_UE_FS.rethrow()
+//
+// System.DivideByZeroException: Attempted to divide by zero.
+// at NDP_UE_FS.divideBy0()
+//
+// Display the base exception using the GetBaseException method:
+//
+// System.DivideByZeroException: Attempted to divide by zero.
+// at NDP_UE_FS.divideBy0()
+//
\ No newline at end of file
diff --git a/snippets/fsharp/System/Exception/HResult/fs.fsproj b/snippets/fsharp/System/Exception/HResult/fs.fsproj
new file mode 100644
index 00000000000..dfc1ea5b1cd
--- /dev/null
+++ b/snippets/fsharp/System/Exception/HResult/fs.fsproj
@@ -0,0 +1,10 @@
+
+
+ Exe
+ net6.0
+
+
+
+
+
+
\ No newline at end of file
diff --git a/snippets/fsharp/System/Exception/HResult/hresult.fs b/snippets/fsharp/System/Exception/HResult/hresult.fs
new file mode 100644
index 00000000000..7816e28057e
--- /dev/null
+++ b/snippets/fsharp/System/Exception/HResult/hresult.fs
@@ -0,0 +1,35 @@
+module NDP_UE_FS
+
+//
+// Example for the Exception.HResult property.
+open System
+
+let secondLevelHResult = 0x81234567
+
+// Create the derived exception class.
+// Set HResult for this exception, and include it in the exception message.
+type SecondLevelException(message, inner) as this =
+ inherit Exception($"(HRESULT:0x{secondLevelHResult:X8}) %s{message}", inner)
+ do
+ this.HResult <- secondLevelHResult
+
+// The following forces a division by 0 and throws a second exception.
+try
+ try
+ let zero = 0
+ let ecks = 1 / zero
+ ()
+ with ex ->
+ raise (SecondLevelException("Forced a division by 0 and threw a second exception.", ex) )
+with ex ->
+ printfn $"{ex}"
+
+// This example of Exception.HResult generates the following output.
+//
+// NDP_UE_FS+SecondLevelException: (HRESULT:0x81234567) Forced a division by 0 and
+// threw a second exception. ---> System.DivideByZeroException: Attempted to divi
+// de by zero.
+// at .$NDP_UE_FS.main@()
+// --- End of inner exception stack trace ---
+// at .$NDP_UE_FS.main@()
+//
\ No newline at end of file
diff --git a/snippets/fsharp/System/Exception/HelpLink/fs.fsproj b/snippets/fsharp/System/Exception/HelpLink/fs.fsproj
new file mode 100644
index 00000000000..b5a28ceade2
--- /dev/null
+++ b/snippets/fsharp/System/Exception/HelpLink/fs.fsproj
@@ -0,0 +1,10 @@
+
+
+ Exe
+ net6.0
+
+
+
+
+
+
\ No newline at end of file
diff --git a/snippets/fsharp/System/Exception/HelpLink/properties.fs b/snippets/fsharp/System/Exception/HelpLink/properties.fs
new file mode 100644
index 00000000000..62b2b9ec966
--- /dev/null
+++ b/snippets/fsharp/System/Exception/HelpLink/properties.fs
@@ -0,0 +1,79 @@
+module NDP_UE_FS
+
+//
+// Example for the Exception.HelpLink, Exception.Source,
+// Exception.StackTrace, and Exception.TargetSite properties.
+open System
+
+let overflowMessage = "The log table has overflowed."
+
+// Derive an exception; the constructor sets the HelpLink and
+// Source properties.
+type LogTableOverflowException(auxMessage, inner) as this =
+ inherit Exception($"%s{overflowMessage} - %s{auxMessage}", inner)
+
+ do
+ this.HelpLink <- "https://docs.microsoft.com"
+ this.Source <- "Exception_Class_Samples"
+
+type LogTable(numElements) =
+ let logArea = Array.zeroCreate numElements
+ let mutable elemInUse = 0
+
+ // The AddRecord method throws a derived exception if
+ // the array bounds exception is caught.
+ member this.AddRecord(newRecord) =
+ try
+ logArea[elemInUse] <- newRecord
+ elemInUse <- elemInUse + 1
+ elemInUse - 1
+ with e ->
+ raise (LogTableOverflowException($"Record \"{newRecord}\" was not logged.", e) )
+
+// Create a log table and force an overflow.
+let log = LogTable 4
+
+printfn
+ """This example of
+ Exception.Message,
+ Exception.HelpLink,
+ Exception.Source,
+ Exception.StackTrace, and
+ Exception.TargetSite
+ generates the following output."""
+
+try
+ for count = 1 to 1000000 do
+ log.AddRecord $"Log record number {count}"
+ |> ignore
+with ex ->
+ printfn $"\nMessage ---\n{ex.Message}"
+ printfn $"\nHelpLink ---\n{ex.HelpLink}"
+ printfn $"\nSource ---\n{ex.Source}"
+ printfn $"\nStackTrace ---\n{ex.StackTrace}"
+ printfn $"\nTargetSite ---\n{ex.TargetSite}"
+
+// This example of
+// Exception.Message,
+// Exception.HelpLink,
+// Exception.Source,
+// Exception.StackTrace, and
+// Exception.TargetSite
+// generates the following output.
+
+// Message ---
+// The log table has overflowed. - Record "Log record number 5" was not logged.
+
+// HelpLink ---
+// https://docs.microsoft.com
+
+// Source ---
+// Exception_Class_Samples
+
+// StackTrace ---
+// at NDP_UE_FS.LogTable.AddRecord(String newRecord)
+// at .$NDP_UE_FS.main@()
+
+// TargetSite ---
+// Int32 AddRecord(System.String)
+//
\ No newline at end of file
diff --git a/snippets/fsharp/System/Exception/InnerException/fs.fsproj b/snippets/fsharp/System/Exception/InnerException/fs.fsproj
new file mode 100644
index 00000000000..6824868e0c0
--- /dev/null
+++ b/snippets/fsharp/System/Exception/InnerException/fs.fsproj
@@ -0,0 +1,10 @@
+
+
+ Exe
+ net6.0
+
+
+
+
+
+
\ No newline at end of file
diff --git a/snippets/fsharp/System/Exception/InnerException/innerex.fs b/snippets/fsharp/System/Exception/InnerException/innerex.fs
new file mode 100644
index 00000000000..f034b170be4
--- /dev/null
+++ b/snippets/fsharp/System/Exception/InnerException/innerex.fs
@@ -0,0 +1,39 @@
+module Example
+
+//
+open System
+
+type AppException =
+ inherit Exception
+
+ new (message: string) = { inherit Exception(message) }
+
+ new (message: string, inner) = { inherit Exception(message, inner) }
+
+let throwInner () =
+ raise (AppException "Exception in throwInner function.")
+ ()
+
+let catchInner () =
+ try
+ throwInner ()
+ with :? AppException as e ->
+ raise (AppException("Error in catchInner caused by calling the throwInner function.", e) )
+
+[]
+let main _ =
+ try
+ catchInner ()
+ with :? AppException as e ->
+ printfn "In with block of main function."
+ printfn $"Caught: {e.Message}"
+ if e.InnerException <> null then
+ printfn $"Inner exception: {e.InnerException}"
+ 0
+// The example displays the following output:
+// In with block of main function.
+// Caught: Error in catchInner caused by calling the throwInner function.
+// Inner exception: Example+AppException: Exception in throwInner function.
+// at Example.throwInner()
+// at Example.catchInner()
+//
\ No newline at end of file
diff --git a/snippets/fsharp/System/Exception/Overview/catchexception.fs b/snippets/fsharp/System/Exception/Overview/catchexception.fs
new file mode 100644
index 00000000000..0c4ad82ea0c
--- /dev/null
+++ b/snippets/fsharp/System/Exception/Overview/catchexception.fs
@@ -0,0 +1,19 @@
+//
+module ExceptionTestModule
+
+open System
+
+let x = 0
+try
+ let y = 100 / x
+ ()
+with
+| :? ArithmeticException as e ->
+ printfn $"ArithmeticException Handler: {e}"
+| e ->
+ printfn $"Generic Exception Handler: {e}"
+
+// This code example produces the following results:
+// ArithmeticException Handler: System.DivideByZeroException: Attempted to divide by zero.
+// at .$ExceptionTestModule.main@()
+//
\ No newline at end of file
diff --git a/snippets/fsharp/System/Exception/Overview/example.fs b/snippets/fsharp/System/Exception/Overview/example.fs
new file mode 100644
index 00000000000..34091a6ed74
--- /dev/null
+++ b/snippets/fsharp/System/Exception/Overview/example.fs
@@ -0,0 +1,33 @@
+module example
+
+//
+open System
+open System.Reflection
+
+let limit = 10000000
+let primes = PrimeNumberGenerator limit
+let start = 1000001
+try
+ let values = primes.GetPrimesFrom start
+ printfn $"There are {values.Length} prime numbers from {start} to {limit}"
+with :? NotPrimeException as e ->
+ printfn $"{e.NonPrime} is not prime"
+ printfn $"{e}"
+ printfn "--------"
+
+let domain = AppDomain.CreateDomain "Domain2"
+let gen =
+ domain.CreateInstanceAndUnwrap(
+ typeof.Assembly.FullName,
+ "PrimeNumberGenerator", true,
+ BindingFlags.Default, null,
+ [| box 1000000 |], null, null)
+ :?> PrimeNumberGenerator
+try
+ let start = 100
+ printfn $"{gen.GetPrimesFrom start}"
+with :? NotPrimeException as e ->
+ printfn $"{e.NonPrime} is not prime"
+ printfn $"{e}"
+ printfn "--------"
+//
\ No newline at end of file
diff --git a/snippets/fsharp/System/Exception/Overview/fs.fsproj b/snippets/fsharp/System/Exception/Overview/fs.fsproj
new file mode 100644
index 00000000000..5e0f4d06a29
--- /dev/null
+++ b/snippets/fsharp/System/Exception/Overview/fs.fsproj
@@ -0,0 +1,17 @@
+
+
+ Exe
+ net6.0
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/snippets/fsharp/System/Exception/Overview/notprimeexception.fs b/snippets/fsharp/System/Exception/Overview/notprimeexception.fs
new file mode 100644
index 00000000000..2abd864b568
--- /dev/null
+++ b/snippets/fsharp/System/Exception/Overview/notprimeexception.fs
@@ -0,0 +1,31 @@
+//
+namespace global
+
+open System
+open System.Runtime.Serialization
+
+[]
+type NotPrimeException =
+ inherit Exception
+ val notAPrime: int
+
+ member this.NonPrime =
+ this.notAPrime
+
+ new (value) =
+ { inherit Exception($"%i{value} is not a prime number."); notAPrime = value }
+
+ new (value, message) =
+ { inherit Exception(message); notAPrime = value }
+
+ new (value, message, innerException: Exception) =
+ { inherit Exception(message, innerException); notAPrime = value }
+
+ // F# does not support protected members
+ new () =
+ { inherit Exception(); notAPrime = 0 }
+
+ new (info: SerializationInfo, context: StreamingContext) =
+ { inherit Exception(info, context); notAPrime = 0 }
+
+//
\ No newline at end of file
diff --git a/snippets/fsharp/System/Exception/Overview/primenumbergenerator.fs b/snippets/fsharp/System/Exception/Overview/primenumbergenerator.fs
new file mode 100644
index 00000000000..e984dca6069
--- /dev/null
+++ b/snippets/fsharp/System/Exception/Overview/primenumbergenerator.fs
@@ -0,0 +1,51 @@
+//
+namespace global
+
+open System
+
+[]
+type PrimeNumberGenerator(upperBound) =
+ let start = 2
+ let maxUpperBound = 10000000
+ let primes = ResizeArray()
+ let primeTable =
+ upperBound + 1
+ |> Array.zeroCreate
+
+ do
+ if upperBound > maxUpperBound then
+ let message = $"{upperBound} exceeds the maximum upper bound of {maxUpperBound}."
+ raise (ArgumentOutOfRangeException message)
+
+ // Create array and mark 0, 1 as not prime (True).
+ primeTable[0] <- true
+ primeTable[1] <- true
+
+ // Use Sieve of Eratosthenes to determine prime numbers.
+ for i = start to float upperBound |> sqrt |> ceil |> int do
+ if not primeTable[i] then
+ for multiplier = i to upperBound / i do
+ if i * multiplier <= upperBound then
+ primeTable[i * multiplier] <- true
+
+ // Populate array with prime number information.
+ let mutable index = start
+ while index <> -1 do
+ index <- Array.FindIndex(primeTable, index, fun flag -> not flag)
+ if index >= 1 then
+ primes.Add index
+ index <- index + 1
+
+ member _.GetAllPrimes() =
+ primes.ToArray()
+
+ member _.GetPrimesFrom(prime) =
+ let start =
+ Seq.findIndex ((=) prime) primes
+
+ if start < 0 then
+ raise (NotPrimeException(prime, $"{prime} is not a prime number.") )
+ else
+ Seq.filter ((>=) prime) primes
+ |> Seq.toArray
+//
\ No newline at end of file
diff --git a/snippets/fsharp/System/Exception/Overview/rethrow1.fs b/snippets/fsharp/System/Exception/Overview/rethrow1.fs
new file mode 100644
index 00000000000..df59a6f6e89
--- /dev/null
+++ b/snippets/fsharp/System/Exception/Overview/rethrow1.fs
@@ -0,0 +1,58 @@
+module rethrow1
+
+//
+open System
+
+module Library =
+ let findOccurrences (s: string) (f: string) =
+ let indexes = ResizeArray()
+ let mutable currentIndex = 0
+ try
+ while currentIndex >= 0 && currentIndex < s.Length do
+ currentIndex <- s.IndexOf(f, currentIndex)
+ if currentIndex >= 0 then
+ indexes.Add currentIndex
+ currentIndex <- currentIndex + 1
+ with :? ArgumentNullException ->
+ // Perform some action here, such as logging this exception.
+ reraise ()
+ indexes.ToArray()
+//
+
+//
+open Library
+
+let showOccurrences toFind (indexes: int[]) =
+ printf $"'{toFind}' occurs at the following character positions: "
+ for i = 0 to indexes.Length - 1 do
+ printf $"""{indexes[i]}{if i = indexes.Length - 1 then "" else ", "}"""
+ printfn ""
+
+let s = "It was a cold day when..."
+let indexes = findOccurrences s "a"
+showOccurrences "a" indexes
+printfn ""
+
+let toFind: string = null
+try
+ let indexes = findOccurrences s toFind
+ showOccurrences toFind indexes
+
+with :? ArgumentNullException as e ->
+ printfn $"An exception ({e.GetType().Name}) occurred."
+ printfn $"Message:\n {e.Message}\n"
+ printfn $"Stack Trace:\n {e.StackTrace}\n"
+
+// The example displays the following output:
+// 'a' occurs at the following character positions: 4, 7, 15
+//
+// An exception (ArgumentNullException) occurred.
+// Message:
+// Value cannot be null. (Parameter 'value')
+//
+// Stack Trace:
+// at System.String.IndexOf(String value, Int32 startIndex, Int32 count, Stri
+// ngComparison comparisonType)
+// at Library.findOccurrences(String s, String f)
+// at .main@()
+//
\ No newline at end of file
diff --git a/snippets/fsharp/System/Exception/Overview/rethrow3.fs b/snippets/fsharp/System/Exception/Overview/rethrow3.fs
new file mode 100644
index 00000000000..b0c505c0ba4
--- /dev/null
+++ b/snippets/fsharp/System/Exception/Overview/rethrow3.fs
@@ -0,0 +1,46 @@
+module rethrow3
+
+open System
+open rethrow1
+open rethrow1.Library
+
+let e = Exception()
+//
+raise (ArgumentNullException("You must supply a search string.", e) )
+//
+
+let s = "It was a cold day when..."
+//
+try
+ let indexes = findOccurrences s toFind
+ showOccurrences toFind indexes
+with :? ArgumentNullException as e ->
+ printfn $"An exception ({e.GetType().Name}) occurred."
+ printfn $" Message:\n{e.Message}"
+ printfn $" Stack Trace:\n {e.StackTrace}"
+ let ie = e.InnerException
+ if ie <> null then
+ printfn " The Inner Exception:"
+ printfn $" Exception Name: {ie.GetType().Name}"
+ printfn $" Message: {ie.Message}\n"
+ printfn $" Stack Trace:\n {ie.StackTrace}\n"
+// The example displays the following output:
+// 'a' occurs at the following character positions: 4, 7, 15
+//
+// An exception (ArgumentNullException) occurred.
+// Message: You must supply a search string.
+//
+// Stack Trace:
+// at Library.FindOccurrences(String s, String f)
+// at Example.Main()
+//
+// The Inner Exception:
+// Exception Name: ArgumentNullException
+// Message: Value cannot be null.
+// Parameter name: value
+//
+// Stack Trace:
+// at System.String.IndexOf(String value, Int32 startIndex, Int32 count, Stri
+// ngComparison comparisonType)
+// at Library.FindOccurrences(String s, String f)
+//
\ No newline at end of file
diff --git a/snippets/fsharp/System/Exception/Overview/usageerrors1.fs b/snippets/fsharp/System/Exception/Overview/usageerrors1.fs
new file mode 100644
index 00000000000..dbe43af3814
--- /dev/null
+++ b/snippets/fsharp/System/Exception/Overview/usageerrors1.fs
@@ -0,0 +1,25 @@
+module usageerrors1
+
+//
+// In F#, null is not a valid state for declared types
+// without 'AllowNullLiteralAttribute'
+[]
+type Person() =
+ member val Name = "" with get, set
+
+ override this.GetHashCode() =
+ this.Name.GetHashCode()
+
+ override this.Equals(obj) =
+ // This implementation contains an error in program logic:
+ // It assumes that the obj argument is not null.
+ let p = obj :?> Person
+ this.Name.Equals p.Name
+
+let p1 = Person()
+p1.Name <- "John"
+let p2: Person = null
+
+// The following throws a NullReferenceException.
+printfn $"p1 = p2: {p1.Equals p2}"
+//
\ No newline at end of file
diff --git a/snippets/fsharp/System/Exception/Overview/usageerrors2.fs b/snippets/fsharp/System/Exception/Overview/usageerrors2.fs
new file mode 100644
index 00000000000..967988cb35d
--- /dev/null
+++ b/snippets/fsharp/System/Exception/Overview/usageerrors2.fs
@@ -0,0 +1,28 @@
+module usageerrors2
+
+//
+// In F#, null is not a valid state for declared types
+// without 'AllowNullLiteralAttribute'
+[]
+type Person() =
+ member val Name = "" with get, set
+
+ override this.GetHashCode() =
+ this.Name.GetHashCode()
+
+ override this.Equals(obj) =
+ // This implementation handles a null obj argument.
+ match obj with
+ | :? Person as p ->
+ this.Name.Equals p.Name
+ | _ ->
+ false
+
+let p1 = Person()
+p1.Name <- "John"
+let p2: Person = null
+
+printfn $"p1 = p2: {p1.Equals p2}"
+// The example displays the following output:
+// p1 = p2: False
+//
\ No newline at end of file
diff --git a/snippets/fsharp/System/Exception/ToString/ToStringEx1.fs b/snippets/fsharp/System/Exception/ToString/ToStringEx1.fs
new file mode 100644
index 00000000000..2a50c3fb949
--- /dev/null
+++ b/snippets/fsharp/System/Exception/ToString/ToStringEx1.fs
@@ -0,0 +1,42 @@
+module Example
+
+//
+open System
+
+type TestClass() = class end
+
+let test = TestClass()
+let objectsToCompare: obj[] =
+ [| test; test.ToString(); 123
+ string 123; "some text"
+ "Some Text" |]
+
+let s = "some text"
+for objectToCompare in objectsToCompare do
+ try
+ let i = s.CompareTo objectToCompare
+ printfn $"Comparing '{s}' with '{objectToCompare}': {i}"
+ with :? ArgumentException as e ->
+ printfn $"Bad argument: {objectToCompare} (type {objectToCompare.GetType().Name})"
+ printfn $"Exception information: {e}"
+ printfn ""
+
+// The example displays the following output:
+// Bad argument: Example+TestClass (type TestClass)
+// Exception information: System.ArgumentException: Object must be of type String.
+// at System.String.CompareTo(Object value)
+// at .$Example.main@()
+//
+// Comparing 'some text' with 'Example+TestClass': -1
+//
+// Bad argument: 123 (type Int32)
+// Exception information: System.ArgumentException: Object must be of type String.
+// at System.String.CompareTo(Object value)
+// at .$Example.main@()
+//
+// Comparing 'some text' with '123': 1
+//
+// Comparing 'some text' with 'some text': 0
+//
+// Comparing 'some text' with 'Some Text': -1
+//
\ No newline at end of file
diff --git a/snippets/fsharp/System/Exception/ToString/fs.fsproj b/snippets/fsharp/System/Exception/ToString/fs.fsproj
new file mode 100644
index 00000000000..a8028e94d94
--- /dev/null
+++ b/snippets/fsharp/System/Exception/ToString/fs.fsproj
@@ -0,0 +1,10 @@
+
+
+ Exe
+ net6.0
+
+
+
+
+
+
\ No newline at end of file
diff --git a/xml/System/Exception.xml b/xml/System/Exception.xml
index c7205ec7c51..698243012f1 100644
--- a/xml/System/Exception.xml
+++ b/xml/System/Exception.xml
@@ -106,11 +106,13 @@
- **Usage errors.** A usage error represents an error in program logic that can result in an exception. However, the error should be addressed not through exception handling but by modifying the faulty code. For example, the override of the method in the following example assumes that the `obj` argument must always be non-null.
:::code language="csharp" source="~/snippets/csharp/System/Exception/Overview/usageerrors1.cs" id="Snippet4":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/Overview/usageerrors1.fs" id="Snippet4":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.exception.class/vb/usageerrors1.vb" id="Snippet4":::
The exception that results when `obj` is `null` can be eliminated by modifying the source code to explicitly test for null before calling the override and then re-compiling. The following example contains the corrected source code that handles a `null` argument.
:::code language="csharp" source="~/snippets/csharp/System/Exception/Overview/usageerrors2.cs" interactive="try-dotnet" id="Snippet5":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/Overview/usageerrors2.fs" id="Snippet5":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.exception.class/vb/usageerrors2.vb" id="Snippet5":::
Instead of using exception handling for usage errors, you can use the method to identify usage errors in debug builds, and the method to identify usage errors in both debug and release builds. For more information, see [Assertions in Managed Code](/visualstudio/debugger/assertions-in-managed-code).
@@ -133,6 +135,9 @@
If none of the `catch` blocks associated with the current `try` block handle the exception, and the current `try` block is nested within other `try` blocks in the current call, the `catch` blocks associated with the next enclosing `try` block are searched. If no `catch` block for the exception is found, the system searches previous nesting levels in the current call. If no `catch` block for the exception is found in the current call, the exception is passed up the call stack, and the previous stack frame is searched for a `catch` block that handles the exception. The search of the call stack continues until the exception is handled or until no more frames exist on the call stack. If the top of the call stack is reached without finding a `catch` block that handles the exception, the default exception handler handles it and the application terminates.
+### F# try..with Expression
+ F# does not use `catch` blocks. Instead, a raised exception is pattern matched using a single `with` block. As this is an expression, rather than a statement, all paths must return the same type. To learn more, see [The try...with Expression](/dotnet/fsharp/language-reference/exception-handling/the-try-with-expression).
+
## Exception type features
Exception types support the following features:
@@ -169,14 +174,16 @@
- An application or library that encounters a fatal exception. The exception handler can log the exception and then re-throw the exception.
- The recommended way to re-throw an exception is to simply use the [throw](/dotnet/csharp/language-reference/keywords/throw) statement in C# and the [Throw](/dotnet/visual-basic/language-reference/statements/throw-statement) statement in Visual Basic without including an expression. This ensures that all call stack information is preserved when the exception is propagated to the caller. The following example illustrates this. A string extension method, `FindOccurrences`, wraps one or more calls to without validating its arguments beforehand.
+ The recommended way to re-throw an exception is to simply use the [throw](/dotnet/csharp/language-reference/keywords/throw) statement in C#, the [reraise](/dotnet/fsharp/language-reference/exception-handling/the-raise-function#reraising-an-exception) function in F#, and the [Throw](/dotnet/visual-basic/language-reference/statements/throw-statement) statement in Visual Basic without including an expression. This ensures that all call stack information is preserved when the exception is propagated to the caller. The following example illustrates this. A string extension method, `FindOccurrences`, wraps one or more calls to without validating its arguments beforehand.
:::code language="csharp" source="~/snippets/csharp/System/Exception/Overview/rethrow1.cs" id="Snippet6":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/Overview/rethrow1.fs" id="Snippet6":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.exception.class/vb/rethrow1.vb" id="Snippet6":::
A caller then calls `FindOccurrences` twice. In the second call to `FindOccurrences`, the caller passes a `null` as the search string, which causes the method to throw an exception. This exception is handled by the `FindOccurrences` method and passed back to the caller. Because the throw statement is used with no expression, the output from the example shows that the call stack is preserved.
:::code language="csharp" source="~/snippets/csharp/System/Exception/Overview/rethrow1.cs" id="Snippet7":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/Overview/rethrow1.fs" id="Snippet7":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.exception.class/vb/rethrow1.vb" id="Snippet7":::
In contrast, if the exception is re-thrown by using the
@@ -187,7 +194,11 @@ throw e;
```vb
Throw e
-```
+```
+
+```fsharp
+raise e
+```
statement, the full call stack is not preserved, and the example would generate the following output:
@@ -209,11 +220,13 @@ Stack Trace:
A slightly more cumbersome alternative is to throw a new exception, and to preserve the original exception's call stack information in an inner exception. The caller can then use the new exception's property to retrieve stack frame and other information about the original exception. In this case, the throw statement is:
:::code language="csharp" source="~/snippets/csharp/System/Exception/Overview/rethrow3.cs" id="Snippet8":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/Overview/rethrow3.fs" id="Snippet8":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.exception.class/vb/rethrow3.vb" id="Snippet8":::
The user code that handles the exception has to know that the property contains information about the original exception, as the following exception handler illustrates.
:::code language="csharp" source="~/snippets/csharp/System/Exception/Overview/rethrow3.cs" id="Snippet9":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/Overview/rethrow3.fs" id="Snippet9":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.exception.class/vb/rethrow3.vb" id="Snippet9":::
@@ -280,16 +293,19 @@ Stack Trace:
The following example illustrates the use of a custom exception class. It defines a `NotPrimeException` exception that is thrown when a client tries to retrieve a sequence of prime numbers by specifying a starting number that is not prime. The exception defines a new property, `NonPrime`, that returns the non-prime number that caused the exception. Besides implementing a protected parameterless constructor and a constructor with and parameters for serialization, the `NotPrimeException` class defines three additional constructors to support the `NonPrime` property. Each constructor calls a base class constructor in addition to preserving the value of the non-prime number. The `NotPrimeException` class is also marked with the attribute.
:::code language="csharp" source="~/snippets/csharp/System/Exception/Overview/notprimeexception.cs" id="Snippet1":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/Overview/notprimeexception.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.exception.class/vb/notprimeexception.vb" id="Snippet1":::
The `PrimeNumberGenerator` class shown in the following example uses the Sieve of Eratosthenes to calculate the sequence of prime numbers from 2 to a limit specified by the client in the call to its class constructor. The `GetPrimesFrom` method returns all prime numbers that are greater than or equal to a specified lower limit, but throws a `NotPrimeException` if that lower limit is not a prime number.
:::code language="csharp" source="~/snippets/csharp/System/Exception/Overview/primenumbergenerator.cs" id="Snippet2":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/Overview/primenumbergenerator.fs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.exception.class/vb/primenumbergenerator.vb" id="Snippet2":::
The following example makes two calls to the `GetPrimesFrom` method with non-prime numbers, one of which crosses application domain boundaries. In both cases, the exception is thrown and successfully handled in client code.
:::code language="csharp" source="~/snippets/csharp/System/Exception/Overview/example.cs" id="Snippet3":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/Overview/example.fs" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.exception.class/vb/example.vb" id="Snippet3":::
## Windows Runtime and .NET Framework 4.5.1
@@ -298,10 +314,11 @@ Stack Trace:
## Examples
- The following example demonstrates a `catch` block that is defined to handle errors. This `catch` block also catches errors, because derives from and there is no `catch` block explicitly defined for errors.
+ The following example demonstrates a `catch` (`with` in F#) block that is defined to handle errors. This `catch` block also catches errors, because derives from and there is no `catch` block explicitly defined for errors.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/CatchException/CPP/catchexception.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/Exception/Overview/catchexception.cs" interactive="try-dotnet" id="Snippet1":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/Overview/catchexception.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/CatchException/VB/catchexception.vb" id="Snippet1":::
]]>
@@ -378,6 +395,7 @@ Stack Trace:
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/new.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/Exception/.ctor/new.cs" interactive="try-dotnet" id="Snippet1":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/.ctor/new.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Ctor/VB/new.vb" id="Snippet1":::
]]>
@@ -443,6 +461,7 @@ Stack Trace:
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/news.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System/Exception/.ctor/news.cs" interactive="try-dotnet" id="Snippet2":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/.ctor/news.fs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Ctor/VB/news.vb" id="Snippet2":::
]]>
@@ -504,6 +523,7 @@ Stack Trace:
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetObjectData/CPP/getobjdata.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/Exception/.ctor/getobjdata.cs" id="Snippet1":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/.ctor/getobjdata.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.GetObjectData/VB/getobjdata.vb" id="Snippet1":::
]]>
@@ -577,6 +597,7 @@ Stack Trace:
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/newsi.cpp" id="Snippet3":::
:::code language="csharp" source="~/snippets/csharp/System/Exception/.ctor/newsi.cs" interactive="try-dotnet" id="Snippet3":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/.ctor/newsi.fs" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Ctor/VB/newsi.vb" id="Snippet3":::
]]>
@@ -657,6 +678,7 @@ Stack Trace:
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/exception.data/CPP/data.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/Exception/Data/data.cs" interactive="try-dotnet" id="Snippet1":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/Data/data.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/exception.data/VB/data.vb" id="Snippet1":::
]]>
@@ -723,6 +745,7 @@ Stack Trace:
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetBaseException/CPP/getbaseexc.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/Exception/GetBaseException/getbaseexc.cs" interactive="try-dotnet" id="Snippet1":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/GetBaseException/getbaseexc.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.GetBaseException/VB/getbaseexc.vb" id="Snippet1":::
]]>
@@ -794,6 +817,7 @@ Stack Trace:
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetObjectData/CPP/getobjdata.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/Exception/.ctor/getobjdata.cs" id="Snippet1":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/.ctor/getobjdata.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.GetObjectData/VB/getobjdata.vb" id="Snippet1":::
]]>
@@ -911,6 +935,7 @@ Stack Trace:
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/Exception/HelpLink/properties.cs" interactive="try-dotnet" id="Snippet1":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/HelpLink/properties.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Properties/VB/properties.vb" id="Snippet1":::
]]>
@@ -975,6 +1000,7 @@ Stack Trace:
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Exception.HResult/CPP/hresult.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/Exception/HResult/hresult.cs" interactive="try-dotnet" id="Snippet1":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/HResult/hresult.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.HResult/VB/hresult.vb" id="Snippet1":::
]]>
@@ -1046,6 +1072,7 @@ Stack Trace:
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/InnerEx/CPP/innerex.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/Exception/InnerException/innerex.cs" interactive="try-dotnet" id="Snippet1":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/InnerException/innerex.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/InnerEx/VB/innerex.vb" id="Snippet1":::
]]>
@@ -1120,6 +1147,7 @@ Stack Trace:
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/Exception/HelpLink/properties.cs" interactive="try-dotnet" id="Snippet1":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/HelpLink/properties.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Properties/VB/properties.vb" id="Snippet1":::
]]>
@@ -1264,6 +1292,7 @@ Stack Trace:
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/Exception/HelpLink/properties.cs" interactive="try-dotnet" id="Snippet1":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/HelpLink/properties.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Properties/VB/properties.vb" id="Snippet1":::
]]>
@@ -1338,6 +1367,7 @@ Stack Trace:
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/Exception/HelpLink/properties.cs" interactive="try-dotnet" id="Snippet1":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/HelpLink/properties.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Properties/VB/properties.vb" id="Snippet1":::
]]>
@@ -1410,6 +1440,7 @@ Stack Trace:
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/Exception/HelpLink/properties.cs" interactive="try-dotnet" id="Snippet1":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/HelpLink/properties.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Properties/VB/properties.vb" id="Snippet1":::
]]>
@@ -1483,6 +1514,7 @@ Stack Trace:
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.exception.tostring/cpp/ToStringEx1.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/Exception/ToString/ToStringEx1.cs" id="Snippet1":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/Exception/ToString/ToStringEx1.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.exception.tostring/vb/ToStringEx1.vb" id="Snippet1":::
]]>