[ 
https://issues.apache.org/jira/browse/IGNITE-20523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17771888#comment-17771888
 ] 

Igor Sapego commented on IGNITE-20523:
--------------------------------------

Looks good to me.

> .NET: Thin 3.0: ArgumentNullException.ThrowIfNull allocates on value types
> --------------------------------------------------------------------------
>
>                 Key: IGNITE-20523
>                 URL: https://issues.apache.org/jira/browse/IGNITE-20523
>             Project: Ignite
>          Issue Type: Improvement
>          Components: platforms, thin client
>    Affects Versions: 3.0.0-beta1
>            Reporter: Pavel Tupitsyn
>            Assignee: Pavel Tupitsyn
>            Priority: Minor
>              Labels: .NET, ignite-3
>             Fix For: 3.0.0-beta2
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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:
> {code}
>     private static KvPair<TK, TV> ToKv(KeyValuePair<TK, TV> x)
>     {
>         ArgumentNullException.ThrowIfNull(x);
>         ArgumentNullException.ThrowIfNull(x);
>         return new(x.Key, x.Value);
>     }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to