Comment by silon42
And they "forgot" to tell people that if doing this properly, they need to use a schema/DTD where Id is defined as ID and then guaranteed unique by XML parser.
I've seen invalid schemas/signatures where Id was just defined as string in the schema (fails when verifying using libxml/xmlsec for example)
GetElementId makes sure its a NCName and makes sure its unique regardless, you can view the source here: https://github.com/dotnet/runtime/blob/c4d7f7c6f2e2f34f07e64...