Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.49k stars 4.81k forks source link

[Azure.AI.OpenAI] Add net8.0 target / remove RequiredTargetFrameworks workaround #46891

Open m-redding opened 3 weeks ago

m-redding commented 3 weeks ago

A net8.0 target is going to be added to RequiredTargetFrameworks in https://github.com/Azure/azure-sdk-for-net/pull/46637

A workaround was added to Azure.AI.OpenAI because there are a number of blocking issues preventing it from adding a net8.0 target:

The primary issue is that OpenAI has internals visible to Azure.AI.OpenAI. However, OpenAI only has a net6.0 target. There are a couple internal polyfill attributes that are not trimmed from the net6.0 dll, since these attributes are not available in net6.0. Since there is no net8.0 target, the net8.0 target in Azure OpenAI falls back on the net6.0 target.

The following attributes cause compiler failures because these attributes exist in both System.Runtime and OpenAI:

In order for Azure OpenAI to be able to have a net8.0 target, I believe the OpenAI library will need to release with a net8.0 target first. Alternatively, it should work to turn off internals visible to in the OpenAI library. Once that is done the workaround should be removed from Azure.AI.OpenAI.

m-redding commented 3 weeks ago

Created an issue in OpenAI as well for tracking: https://github.com/openai/openai-dotnet/issues/272