question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RecordMatcher fails with doubles on different runtime versions

See original GitHub issue

I have some doubles in both requests and reponses, and the RecordMatcher has a problem with doubles in requests on .NET 5.0 vs older versions. For example, here’s what I get in a test that was recorded with .NET 5.0 but used on older runtimes:

  Message: 
    Azure.Core.TestFramework.TestRecordingMismatchException : Unable to find a record for the request POST https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-05-01-preview
    Header differences:
        <Content-Length> values differ, request <360>, record <328>
    Body differences:
    Request and response bodies do not match at index 109:
         request: "shold":0.20000000000000001,"co"
         record:  "shold":0.2,"context":{"previou"

I can disable body comparisons, but I’m wondering if we could have the recording framework somehow inject a double converter to control precision.

For example, I believe Newtonsoft.Json uses double.ToString("R") so maybe we could as well, or even pass something like “f8” to always emit 8 decimal places (or whatever number) unconditionally.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:21 (21 by maintainers)

github_iconTop GitHub Comments

2reactions
christothescommented, Oct 4, 2022

I’m not sure this is worth fixing in lieu of simpler workarounds like only disabling body compare when not on framework like we are doing here:

https://github.com/Azure/azure-sdk-for-net/blob/bd5c715e0b25f80fee7e78f779c1cab9f6387f50/sdk/objectanchors/Azure.MixedReality.ObjectAnchors.Conversion/tests/ObjectAnchorsConversionClientLiveTests.cs#L38-L42

1reaction
heathscommented, Oct 17, 2022

Speaking of recording on Core, I opened #31768 that might help. Right now, if you just press the “Play” button in Test Explorer, net461 will run first and all tests get recorded there and used in subsequent (“Core”) runtimes. I want to default test runs to the latest and “filter” the test coverage reports similar. The order as it is was intentional, though someone effectively “broke” it when they added “net6.0” last.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Synthetics runtime versions - Amazon CloudWatch
Explains the versions of CloudWatch Synthetics runtimes, libraries, and configuration information.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found