FormatError in update message with TSig

May 23, 2016 at 8:31 AM
I'm trying to create an update message with a TSig record, but I keep getting a FormatError return code.

The code I'm using is the following:
using ARSoft.Tools.Net;
using ARSoft.Tools.Net.Dns;
using ARSoft.Tools.Net.Dns.DynamicUpdate;
using System;
using System.Net;

class Program {

    static void TestUpdateAdd(IPAddress dnsServerIP,
                              DomainName updateZoneName,
                              DomainName newRecordName,
                              IPAddress newRecordIPAddress,
                              DomainName tsigName,
                              byte[] tsigKey) {

        var client = new DnsClient(dnsServerIP, 150000);
        client.IsUdpEnabled = false;

        var msg = new DnsUpdateMessage { ZoneName = updateZoneName };

            new AddRecordUpdate(
                new ARecord(newRecordName, 86400, newRecordIPAddress)));

        msg.TSigOptions = new TSigRecord(tsigName, TSigAlgorithm.Md5, DateTime.Now, new TimeSpan(0, 0, 5),
            msg.TransactionID, ReturnCode.NoError, null, tsigKey);

        DnsUpdateMessage dnsResult = client.SendUpdate(msg);
        if (dnsResult == null) {
            Console.WriteLine("Failed sending message");
        } else {
            Console.WriteLine(dnsResult.ReturnCode); // FormatError
I checked with WireShark, and I've seen that the TSIG record looks strange (data length: 0):
Additional records
itis-internal: type TSIG, class ANY
     Name: itis-internal
     Type: TSIG (Transaction Signature) (250)
     Class: ANY (0x00ff)
     Time to live: 0
     Data length: 0
Am I missing something? I took the update code from the documentation here on CodePlex, I couldn't find other examples.

Jun 9, 2016 at 8:28 AM
Please try version 2.2.5.
Jun 9, 2016 at 12:26 PM
It's working with the new version, thanks!