How to implement Azure CLU in a .NET Framework 4.6.2 C# project

Mohamed Modeen 0 Reputation points
2025-04-17T08:37:06.8+00:00

Hi, we have a .NET framework 4.6.2 class library which is being used a chatbot (built with Botframework). Currently, it works fine with LUIS natural language processor. However, we received a notice from Microsoft that LUIS will no longer be supported by October 2025 and we need to migrate to CLU.

Following which, we have made the necessary changes and created the required azure resources and CLU resources together with the training model, etc.

However, when calling the AnalyzeConversationAsync method (using Azure.AI.Language.Conversation nuget package), we get no response nor any errors or timeouts.
We upgraded the dependent packages such as System.Text.Json, etc. but that did not solve the issue.

We would like to know if this issue is simply due to the version/framework that we are currently using?
Any suggestions, ideas or tips that we can try? Really appreciate it!

Thanks.

See full code of the method below:
public async Task<RawLanguageResultWithEntities> InterpretForCurrentAppAsync(string requestId, string appId, string appSecret, string userQuery)

{
var data = GetDataObjectFromText(userQuery)

try

{

var response = await _client.AnalyzeConversationAsync(RequestContent.Create(data));

}

catch (RequestFailedException exc)

{

Console.WriteLine(exc.Message);

}

catch (Exception ex)

{

Console.WriteLine($"Failed to analyze {ex.Message}");

}

return new RawLanguageResultWithEntities();

}

Azure AI Language
Azure AI Language
An Azure service that provides natural language capabilities including sentiment analysis, entity extraction, and automated question answering.
487 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Manas Mohanty 3,210 Reputation points Microsoft External Staff
    2025-04-21T09:59:56.29+00:00

    Hi Mohamed Modeen

    I am able to run the sample documentation mentioned above with dot 8 or 9 version and Documentation recommends only Dot net 8 most of the tutorial

    but you can check 2.2.0-beta.2 documentation for 4.6.2 dot net framework

    dotnet add package Azure.AI.Language.Conversations --version 2.0.0-beta.2
    
    

    Sample usage

    string projectName = "Menu";
    string deploymentName = "production";
    
    AnalyzeConversationInput data = new ConversationLanguageUnderstandingInput(
        new ConversationAnalysisInput(
            new TextConversationItem(
                id: "1",
                participantId: "participant1",
                text: "Send an email to Carol about tomorrow's demo")),
        new ConversationLanguageUnderstandingActionContent(projectName, deploymentName)
        {
            // Use Utf16CodeUnit for strings in .NET.
            StringIndexType = StringIndexType.Utf16CodeUnit,
        });
    
    Response<AnalyzeConversationActionResult> response = client.AnalyzeConversation(data);
    ConversationActionResult conversationActionResult = response.Value as ConversationActionResult;
    ConversationPrediction conversationPrediction = conversationActionResult.Result.Prediction as ConversationPrediction;
    
    Console.WriteLine($"Top intent: {conversationPrediction.TopIntent}");
    
    Console.WriteLine("Intents:");
    foreach (ConversationIntent intent in conversationPrediction.Intents)
    {
        Console.WriteLine($"Category: {intent.Category}");
        Console.WriteLine($"Confidence: {intent.Confidence}");
        Console.WriteLine();
    }
    
    Console.WriteLine("Entities:");
    foreach (ConversationEntity entity in conversationPrediction.Entities)
    {
        Console.WriteLine($"Category: {entity.Category}");
        Console.WriteLine($"Text: {entity.Text}");
        Console.WriteLine($"Offset: {entity.Offset}");
        Console.WriteLine($"Length: {entity.Length}");
        Console.WriteLine($"Confidence: {entity.Confidence}");
        Console.WriteLine();
    
        if (entity.Resolutions != null && entity.Resolutions.Any())
        {
            foreach (ResolutionBase resolution in entity.Resolutions)
            {
                if (resolution is DateTimeResolution dateTimeResolution)
                {
                    Console.WriteLine($"Datetime Sub Kind: {dateTimeResolution.DateTimeSubKind}");
                    Console.WriteLine($"Timex: {dateTimeResolution.Timex}");
                    Console.WriteLine($"Value: {dateTimeResolution.Value}");
                    Console.WriteLine();
                }
            }
        }
    }
    
    

    Please let us know if it helps.

    Thank you

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.