Skip to content

[BUG] Date-like metadata is being parsed and serialized #1126

Open

Description

Storing date-like metadata in DNS A record set (haven't tried other metadata cases), and reading this data out again, returns a different date-like representation of the date.

Repro code:

IAzure azure = ...;
string zoneId = ...;
var dnsZone = await azure.DnsZones.GetByIdAsync(zoneId);
var data = "2020-08-20T16:39:20";
var dnsRecordName = $"time-{DateTime.Now.ToFileTime()}";
await dnsZone
    .Update()
    .DefineARecordSet(dnsRecordName)
    .WithIPv4Address("192.168.1.1")
    .WithMetadata("test", data)
    .Attach()
    .ApplyAsync();

dnsZone = await azure.DnsZones.GetByIdAsync(zoneId);
var record = dnsZone.ListRecordSets().First(r => r.Name == dnsRecordName);
var rtData = record.Metadata["test"];
Console.WriteLine($"{data} {(data == rtData ? "==" : "!=")} {rtData}");

The above code will result in the following output:

2020-08-20T16:39:20 != 08/20/2020 16:39:20

Expected behavior:
Store "2020-08-20T16:39:20" as metadata value, then retrieve the exact same text.

Actual behavior:
Store "2020-08-20T16:39:20" as metadata value, retrieved metadata value is now "08/20/2020 16:39:20".
Azure Portal correctly shows 2020-08-20T16:39:20.

Azure Portal Screenshot, shows correct value in Portal:
dns-metadata-bug

Setup

  • OS: Windows 10
  • IDE : VSCode
  • Microsoft.Azure.Management.Fluent, Version=1.0.0.66

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    MgmtManagement plane SDK related issues.Network - DNS

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions