Skip to content

Commit e9cced2

Browse files
authored
Address broken VB build issue (dotnet#30693)
1 parent 64b6678 commit e9cced2

File tree

1 file changed

+10
-7
lines changed
  • samples/snippets/visualbasic/VS_Snippets_CLR/HowToSignXMLDocumentRSA/vb

1 file changed

+10
-7
lines changed

samples/snippets/visualbasic/VS_Snippets_CLR/HowToSignXMLDocumentRSA/vb/sample.vb

+10-7
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,20 @@ Module SignXML
99
' Create a new CspParameters object to specify
1010
' a key container.
1111
' <snippet2>
12-
Dim cspParams As New CspParameters()
13-
cspParams.KeyContainerName = "XML_DSIG_RSA_KEY"
12+
Dim cspParams As New CspParameters With {
13+
.KeyContainerName = "XML_DSIG_RSA_KEY"
14+
}
1415
' </snippet2>
1516
' Create a new RSA signing key and save it in the container.
1617
' <snippet3>
1718
Dim rsaKey As New RSACryptoServiceProvider(cspParams)
1819
' </snippet3>
1920
' Create a new XML document.
2021
' <snippet4>
21-
Dim xmlDoc As New XmlDocument()
22-
2322
' Load an XML file into the XmlDocument object.
24-
xmlDoc.PreserveWhitespace = True
23+
Dim xmlDoc As New XmlDocument With {
24+
.PreserveWhitespace = True
25+
}
2526
xmlDoc.Load("test.xml")
2627
' </snippet4>
2728
' Sign the XML document.
@@ -44,10 +45,12 @@ Module SignXML
4445
Sub SignXml(ByVal xmlDoc As XmlDocument, ByVal rsaKey As RSA)
4546
' Check arguments.
4647
If xmlDoc Is Nothing Then
47-
Throw New ArgumentException(NameOf(xmlDoc))
48+
Throw New ArgumentException(
49+
"The XML doc cannot be nothing.", NameOf(xmlDoc))
4850
End If
4951
If rsaKey Is Nothing Then
50-
Throw New ArgumentException(NameOf(rsaKey))
52+
Throw New ArgumentException(
53+
"The RSA key cannot be nothing.", NameOf(rsaKey))
5154
End If
5255
' Create a SignedXml object.
5356
' <snippet5>

0 commit comments

Comments
 (0)