GithubHelp home page GithubHelp logo

Comments (5)

JhontSouth avatar JhontSouth commented on May 20, 2024 1

Hi @rliberoff,
We were able to reproduce the issue by forcing an error in the OnMessageActivityAsync method and another one in the OnTurnError.
We'll analyze how the correct behavior should be.

from botbuilder-dotnet.

rliberoff avatar rliberoff commented on May 20, 2024

Maybe the question is – if there is no bug – how to correctly handle exceptions in the CloudAdapter when using the ShowTypingMiddleware.

Please advice.

Thank you.

from botbuilder-dotnet.

rliberoff avatar rliberoff commented on May 20, 2024

Menawhile we created a custom middleware. It is actually a copy of yours, but with a slightly different FinishTypingTaskAsync method, which is where we found the issue occurs.

    private async Task FinishTypingTaskAsync(ITurnContext turnContext)
    {
        if (string.IsNullOrEmpty(turnContext?.Activity?.Conversation?.Id) && !tasks.ContainsKey(turnContext.Activity.Conversation.Id))
        {
            return;
        }

        // Cancel the typing loop.
        tasks.TryGetValue(turnContext.Activity.Conversation.Id, out var item);
        var (typingTask, cts) = item;
        cts?.Cancel();
        cts?.Dispose();
        if (typingTask != null)
        {
            if (typingTask.Exception == null)
            {
                await typingTask.ConfigureAwait(false);
            }

            typingTask.Dispose();
        }

        tasks.TryRemove(turnContext.Activity.Conversation.Id, out _);
    }

Please notice the if (typingTask.Exception == null) which detects if there is an exception in the (previous) task.

Thank you.

from botbuilder-dotnet.

rliberoff avatar rliberoff commented on May 20, 2024

Hi @JhontSouth!

Thank you. If there’s anything more I can assist you with, please don’t hesitate to reach out.

from botbuilder-dotnet.

tracyboehrer avatar tracyboehrer commented on May 20, 2024

Merged in #6772. Available next release.

from botbuilder-dotnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.