@@ -45,8 +45,9 @@ public RoleConfiguration(XElement data)
45
45
{
46
46
var certificate = new CertificateConfiguration
47
47
{
48
- Thumbprint = setting . Attribute ( "thumbprint" ) . Value ,
49
- ThumbprintAlgorithm = setting . Attribute ( "thumbprintAlgorithm" ) . Value
48
+ Thumbprint = setting . Attribute ( "thumbprint" ) == null ? null : setting . Attribute ( "thumbprint" ) . Value ,
49
+ ThumbprintAlgorithm = setting . Attribute ( "thumbprintAlgorithm" ) == null ? null : setting . Attribute ( "thumbprintAlgorithm" ) . Value ,
50
+ SourceLocation = setting . Attribute ( "sourceLocation" ) == null ? null : setting . Attribute ( "sourceLocation" ) . Value ,
50
51
} ;
51
52
52
53
this . Certificates . Add ( setting . Attribute ( "name" ) . Value , certificate ) ;
@@ -104,8 +105,18 @@ internal XElement Serialize()
104
105
{
105
106
XElement certificateElement = new XElement ( this . ns + "Certificate" ) ;
106
107
certificateElement . SetAttributeValue ( "name" , certificate . Key ) ;
107
- certificateElement . SetAttributeValue ( "thumbprint" , certificate . Value . Thumbprint ) ;
108
- certificateElement . SetAttributeValue ( "thumbprintAlgorithm" , certificate . Value . ThumbprintAlgorithm ) ;
108
+ if ( certificate . Value . Thumbprint != null )
109
+ {
110
+ certificateElement . SetAttributeValue ( "thumbprint" , certificate . Value . Thumbprint ) ;
111
+ }
112
+ if ( certificate . Value . ThumbprintAlgorithm != null )
113
+ {
114
+ certificateElement . SetAttributeValue ( "thumbprintAlgorithm" , certificate . Value . ThumbprintAlgorithm ) ;
115
+ }
116
+ if ( certificate . Value . SourceLocation != null )
117
+ {
118
+ certificateElement . SetAttributeValue ( "sourceLocation" , certificate . Value . SourceLocation ) ;
119
+ }
109
120
certificatesElement . Add ( certificateElement ) ;
110
121
}
111
122
0 commit comments