@@ -33,12 +33,7 @@ public QueryProductDetailsResult() { }
3333
3434 public BillingResult Result { get ; set ; }
3535
36- [ Obsolete ( $ "Use { nameof ( ProductDetailsList ) } instead") ]
37- public IList < ProductDetails > ProductDetails
38- {
39- get => ProductDetailsList ;
40- set { /* Obsolete property setter does nothing */ }
41- }
36+ public IList < ProductDetails > ProductDetails { get ; set ; }
4237 }
4338
4439 public class QueryPurchasesResult
@@ -129,9 +124,14 @@ public Task<QueryProductDetailsResult> QueryProductDetailsAsync(QueryProductDeta
129124 {
130125 var tcs = new TaskCompletionSource < QueryProductDetailsResult > ( ) ;
131126
127+ // NOTE: this creates a new QueryProductDetailsResult to avoid ObjectDisposedException
132128 var listener = new InternalProductDetailsResponseListener
133129 {
134- ProductDetailsResponseHandler = ( r , queryResult ) => tcs . TrySetResult ( queryResult )
130+ ProductDetailsResponseHandler = ( r , s ) => tcs . TrySetResult ( new QueryProductDetailsResult
131+ {
132+ Result = r ,
133+ ProductDetails = s
134+ } )
135135 } ;
136136
137137 QueryProductDetails ( productDetailsParams , listener ) ;
@@ -252,13 +252,11 @@ public void OnSkuDetailsResponse(BillingResult result, IList<SkuDetails> skuDeta
252252
253253 internal class InternalProductDetailsResponseListener : Java . Lang . Object , IProductDetailsResponseListener
254254 {
255- public Action < BillingResult , QueryProductDetailsResult > ProductDetailsResponseHandler { get ; set ; }
255+ public Action < BillingResult , IList < ProductDetails > > ProductDetailsResponseHandler { get ; set ; }
256256
257257 public void OnProductDetailsResponse ( BillingResult result , QueryProductDetailsResult queryResult )
258258 {
259- queryResult ??= new ( ) ;
260- queryResult . Result = result ;
261- ProductDetailsResponseHandler ? . Invoke ( result , queryResult ) ;
259+ ProductDetailsResponseHandler ? . Invoke ( result , queryResult ? . ProductDetailsList ) ;
262260 }
263261 }
264262
0 commit comments