azure-sdk-for-net icon indicating copy to clipboard operation
azure-sdk-for-net copied to clipboard

[BUG] Invalid format of value when trying to instantiate a generic implementation of Microsoft.Rest.ServiceClient

Open humbertosantiago opened this issue 3 years ago • 5 comments
trafficstars

I'm trying to instantiate an generic implementation of class which inherits from ServiceClient class.

Message:Test method Datora.Proxies.SAPServiceLayer.Client.Test.EntityUnit.Query threw exception: System.FormatException: The format of value 'Datora.Proxies.SAPServiceLayer.Client.SAPSLEntityProxy`1[[Datora.Proxies.SAPServiceLayer.Entities.BusinessPartner, Datora.Proxies.SAPServiceLayer.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0020583cc5375c52]]' is invalid.

Stack Trace:HeaderUtilities.CheckValidToken(String value, String parameterName) ProductHeaderValue.ctor(String name, String version) ServiceClient'1.InitializeHttpClient(HttpClientHandler httpClientHandler, DelegatingHandler[] handlers) ServiceClient'1.ctor(HttpClientHandler rootHandler, DelegatingHandler[] handlers) ServiceClient'1.ctor() ProxyBase.ctor() line 24 ProxyBase.ctor(IBasicClientConfigEntry _configuration) line 28 SAPSLProxyBase.ctor(SAPSLClientConfig _config) line 17 SAPSLEntityProxy'1.ctor(SAPSLClientConfig _config) line 15 SAPSLClient.GetEntityProxy[TEntity]() line 43 EntityUnit.Query() line 30 ThreadOperations.ExecuteWithAbortSafety(Action action)

I could see in ServiceClient source code that in InitializeHttpClient method the entry type name is used to fill ProductInfoHeaderValue instance which will be added as UserAgent client header.

What would be the issue here ? The length of full type name ? Is there a way to avoid this kind of issue without giving up a generic approach ?

humbertosantiago avatar Sep 19 '22 16:09 humbertosantiago

Label prediction was below confidence level 0.6 for Model:ServiceLabels: 'AutoRest Runtime:0.21352017,Storage:0.111607164,Azure.Core:0.102790676'

azure-sdk avatar Sep 19 '22 16:09 azure-sdk

Hi @humbertosantiago. Would you please be so kind as to provide the name and version of the Azure SDK package that you're using?

jsquire avatar Sep 19 '22 17:09 jsquire

Hi @jsquire , I'm using the package Microsoft.Rest.ClientRuntime 3.0.3.

humbertosantiago avatar Sep 19 '22 17:09 humbertosantiago

@xboxeer, @m-nash: The class in question appears to be related to the mgmtcommon area in the v3 codegen. Would you please be so kind as to take a look and offer your thoughts?

jsquire avatar Sep 19 '22 18:09 jsquire

Thank you, @humbertosantiago. I've looped in the team members best able to assist.

jsquire avatar Sep 19 '22 18:09 jsquire

Hi @humbertosantiago , this package will deprecate from this Sept, could you please try our latest Track2 SDK. You could get start with: https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md

HarveyLink avatar Jun 27 '23 02:06 HarveyLink

Hi @humbertosantiago. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

github-actions[bot] avatar Jun 27 '23 02:06 github-actions[bot]

Hi @humbertosantiago, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

github-actions[bot] avatar Jul 13 '23 21:07 github-actions[bot]