Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-20523

.NET: Thin 3.0: ArgumentNullException.ThrowIfNull allocates on value types

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.0.0-beta1
    • 3.0
    • platforms, thin client

    Description

      IGNITE-20479 replaced custom null checks with standard ArgumentNullException.ThrowIfNull. However, ThrowIfNull takes object, which involves boxing for value types. Therefore we do heap allocations just to validate arguments in some cases, such as generic record/key/value validation in KeyValueView and RecordView. Bring back the custom generic validation method to fix this.

      Also, ToKv method validates the wrong thing twice:

          private static KvPair<TK, TV> ToKv(KeyValuePair<TK, TV> x)
          {
              ArgumentNullException.ThrowIfNull(x);
              ArgumentNullException.ThrowIfNull(x);
      
              return new(x.Key, x.Value);
          }
      

      Attachments

        Issue Links

          Activity

            People

              ptupitsyn Pavel Tupitsyn
              ptupitsyn Pavel Tupitsyn
              Igor Sapego Igor Sapego
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m