microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
732 stars 243 forks source link

Microsoft.Dynamics.Nav.Runtime.NavHttpContent Variable not initialized #7588

Closed UnitechITSolutions closed 9 months ago

UnitechITSolutions commented 10 months ago

My extension is working fine on 22.5 while it is not working on 23

Extension is working from last 1 year, now I updated one of my sandbox to 23 extension is working fine on 1 sandbox (22.5) and not working on another sandbox (23)

I am calling external API

Please advise

UnitechITSolutions commented 10 months ago

It is GB version, I have tested with different Tenants issue is same

UnitechITSolutions commented 10 months ago

image

UnitechITSolutions commented 10 months ago

I just updated with 23.1, issue is still same

DanielHeima commented 9 months ago

Hey, this has already been addressed in #7574.

There @BazookaMusic attributes this to a regression in the way HttpContent is cleared, introduced in version 23, with a fix already pending release.

UnitechITSolutions commented 9 months ago

Thank you, just saw the 7574, glad it has been addressed. Just wondering, until it release, we cannot use API integrations bug fixing should get high priority

Anyway thank you for this

DanielHeima commented 9 months ago

If you can't wait, in the meantime you might be able to bypass the error by either:

  1. Avoiding the HttpContent.Clear() call before you call HttpContent.GetHeaders
  2. If the call is absolutely necessary in your logic you could call HttpContent.WriteFrom('') inbetween the Clear and the GetHeaders.

That is,

HttpContent.Clear();
HttpContent.GetHeaders(HttpHeaders);

gives you the error in the GetHeaders call but

HttpContent.Clear();
HttpContent.WriteFrom('');
HttpContent.GetHeaders(HttpHeaders);

would not.

BazookaMusic commented 9 months ago

The issue is fixed in the latest release, but we were unable to release the fix due to a deployment freeze because of the time period. The workaround suggested should also fine and the fix will now be released.

Thus, I will close the issue.