If your application fails to to sign XML and the XmlDSigGen.LastErrorText contains the error “The location of where to insert the Signature was not found.”, it means the location your application specified to put the Signature does not exist in the XML that is to be signed.
For example, if you wish to sign this XML:
<abc> <xyz>test</xyz> </abc>
and then you set gen.SigLocation = “abc|def”, then you’ll get the same error — because <abc><def> does not exist in the XML.