RadzenUpload does not always hit Complete event

Tested below code in a vanilla Blazor Server app (Radzen 4.11.1/2) and found Complete is not always invoked. OnComplete hits when Canceled is true and uploaded file is large enough.

@page "/"

<RadzenUpload Multiple="false" Accept="application/pdf" Url="upload/single" Icon="upload" Progress=@OnProgress Complete=@OnComplete Error=@OnError Change=@OnChange />
<RadzenButton Text="Cancel" Click=@OnCancelUpload class="d-block mt-4" Visible=@_showProgress />
<RadzenProgressBar Value=@_progress class="mt-4" Visible=@_showProgress Max="100" />
<RadzenLabel Visible=@_showComplete class="mt-4" Text=@_message />

@code {
    int _progress = 0;
    bool _showProgress = false;
    bool _showComplete = false;
    bool _cancelUpload = false;
    string _message = string.Empty;

    void OnProgress(UploadProgressArgs args)
    {
        _showProgress = true;
        _showComplete = false;
        _progress = args.Progress;
        //_message = args.Files.First().Name;

        // cancel upload
        args.Cancel = _cancelUpload;

        // reset cancel flag
        _cancelUpload = false;
    }

    void OnComplete(UploadCompleteEventArgs args)
    {
        if (args.Cancelled)
            _message = "Cancelled";
        else
            _message = "Uploaded";

        _showProgress = false;
        _showComplete = true;

        // TODO: parse uploaded file
    }

    void OnCancelUpload()
    {
        _cancelUpload = true;
    }

    void OnChange()
    {
        _message = "Changed";
    }

    void OnError()
    {
        _message = "Error";
    }
}

I was not able to reproduce a case where Complete event is not raised - I've tried your code in our demos using Chrome. If you feel there is a bug somewhere and you have a fix you can submit pull request.

Could you please share yours? I tried in the other computer and still have the same issue.

  1. Create a Blazor Server project
  2. Add Radzen.Blazor from NuGet
  3. Add using Radzen and using Radzen.Blazor in Imports.razor
  4. Add css between head tag in _Host.cshtml
  5. Add js between body tag in _Host.cshtml
  6. Replace Index.razor with the content above.
  7. Put a breakpoint within OnComplete function and Debug
  8. Upload a pdf file
  9. Never hit the breakpoint

I’m running our demos locally.

Yeah, the demo worked for me in my local machine but I have an error using the package.
Having 400 on the xhr.status. Do you have any idea?
image

In this case Error event will be raised.

Yes the Error event is thrown without any message since xhr.reponseText is null.

Now I got it ... it needs an aid of UploadController in RadzenBlazorDemos.Host.