Unable to upload empty files of 0kb #1395

Closed
opened 2026-01-29 17:53:05 +00:00 by claunia · 0 comments
Owner

Originally created by @AbhijatSaxena on GitHub (Sep 19, 2024).

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://blazor.radzen.com/example-upload?theme=material3
  2. Select any uploader which would open the file selector
  3. Choose an empty file (a new txt file or any file of 0kb)
  4. You'll not see the file shown in the staging area
  5. Chrome console throws an exception
blazor.web.js:1 Uncaught (in promise) Error: System.NullReferenceException: Object reference not set to an instance of an object.
   at Radzen.FileInfo.get_Size(example-upload?theme=material3:1:1)
   at Radzen.Blazor.RadzenUpload.<>c.<OnChange>b__96_0(/PreviewFileInfo f)
   at System.Linq.Enumerable.SelectListIterator`2[[Radzen.PreviewFileInfo, Radzen.Blazor, Version=5.2.0.0, Culture=neutral, PublicKeyToken=null],[Radzen.FileInfo, Radzen.Blazor, Version=5.2.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext(example-upload?theme=material3:1:1)
   at System.Collections.Generic.List`1[[Radzen.FileInfo, Radzen.Blazor, Version=5.2.0.0, Culture=neutral, PublicKeyToken=null]]..ctor(/IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[FileInfo](/IEnumerable`1 source)
   at Radzen.Blazor.RadzenUpload.OnChange(/IEnumerable`1 files)
    at y.endInvokeDotNetFromJS (blazor.web.js:1:3502)
    at Object.ri [as endInvokeDotNetFromJS] (blazor.web.js:1:165319)
    at dotnet.runtime.8.0.8.9z6kkxsnez.js:3:178428
    at Ll (dotnet.runtime.8.0.8.9z6kkxsnez.js:3:179262)
    at 00b21c96:0x1f99d
    at 00b21c96:0x1be41
    at 00b21c96:0xf00e
    at 00b21c96:0x1e693
    at 00b21c96:0x1ee89
    at 00b21c96:0xce5e

Expected behavior
Blazor upload should either not support empty files or should allow it to be staged and uploaded without any exceptions

Originally created by @AbhijatSaxena on GitHub (Sep 19, 2024). **To Reproduce** Steps to reproduce the behavior: 1. Go to https://blazor.radzen.com/example-upload?theme=material3 2. Select any uploader which would open the file selector 3. Choose an empty file (a new txt file or any file of 0kb) 4. You'll not see the file shown in the staging area 5. Chrome console throws an exception ``` blazor.web.js:1 Uncaught (in promise) Error: System.NullReferenceException: Object reference not set to an instance of an object. at Radzen.FileInfo.get_Size(example-upload?theme=material3:1:1) at Radzen.Blazor.RadzenUpload.<>c.<OnChange>b__96_0(/PreviewFileInfo f) at System.Linq.Enumerable.SelectListIterator`2[[Radzen.PreviewFileInfo, Radzen.Blazor, Version=5.2.0.0, Culture=neutral, PublicKeyToken=null],[Radzen.FileInfo, Radzen.Blazor, Version=5.2.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext(example-upload?theme=material3:1:1) at System.Collections.Generic.List`1[[Radzen.FileInfo, Radzen.Blazor, Version=5.2.0.0, Culture=neutral, PublicKeyToken=null]]..ctor(/IEnumerable`1 collection) at System.Linq.Enumerable.ToList[FileInfo](/IEnumerable`1 source) at Radzen.Blazor.RadzenUpload.OnChange(/IEnumerable`1 files) at y.endInvokeDotNetFromJS (blazor.web.js:1:3502) at Object.ri [as endInvokeDotNetFromJS] (blazor.web.js:1:165319) at dotnet.runtime.8.0.8.9z6kkxsnez.js:3:178428 at Ll (dotnet.runtime.8.0.8.9z6kkxsnez.js:3:179262) at 00b21c96:0x1f99d at 00b21c96:0x1be41 at 00b21c96:0xf00e at 00b21c96:0x1e693 at 00b21c96:0x1ee89 at 00b21c96:0xce5e ``` **Expected behavior** Blazor upload should either not support empty files or should allow it to be staged and uploaded without any exceptions
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1395