Exception on FileManager Initialization and file selection

Hi Syncfusion Team !


I'm currently running an application using your FileManager Component. When the page which contains this component load and when I click on an element on detailed view,

I got this error :


Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: Value cannot be null. (Parameter 'source')
System.ArgumentNullException: Value cannot be null. (Parameter 'source')
   at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
   at System.Linq.Enumerable.ToList[String](IEnumerable`1 source)
   at Syncfusion.Blazor.Navigations.SfTreeView`1.<OnPropertyChangeHandler_ExpandedNodes>d__405[[Syncfusion.Blazor.FileManager.Internal.InternalData, Syncfusion.Blazor.FileManager, Version=19.3.0.57, Culture=neutral, PublicKeyToken=null]].MoveNext()
   at Syncfusion.Blazor.Navigations.SfTreeView`1.<OnPropertyChangeHandler>d__403[[Syncfusion.Blazor.FileManager.Internal.InternalData, Syncfusion.Blazor.FileManager, Version=19.3.0.57, Culture=neutral, PublicKeyToken=null]].MoveNext()
   at Syncfusion.Blazor.Navigations.SfTreeView`1.<OnParametersSetAsync>d__11[[Syncfusion.Blazor.FileManager.Internal.InternalData, Syncfusion.Blazor.FileManager, Version=19.3.0.57, Culture=neutral, PublicKeyToken=null]].MoveNext()
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)



Here is the implementation of FileManager and also the FileSelection method :


 <SfSplitter Height="100%">



        <SplitterPanes>
            <SplitterPane Size="45%">
                <ContentTemplate>
                    <div style="height: 100%;">
                        <SfFileManager @ref="_sfFileManager" TValue="FileManagerDirectoryContent" AllowDragAndDrop="true" ShowThumbnail="false" Height="100%" >
                            <FileManagerAjaxSettings Url="/filemanager/fileoperations"
                                                     UploadUrl="/filemanager/upload"
                                                     DownloadUrl="/filemanager/download"
                                                     GetImageUrl="/filemanager/getimage">
                            </FileManagerAjaxSettings>
                            <FileManagerContextMenuSettings File="@Items" Folder="@Items"></FileManagerContextMenuSettings>
                            <FileManagerToolbarSettings Items="@ToolbarItems"></FileManagerToolbarSettings>
                            @*<FileManagerEvents TValue="FileManagerDirectoryContent" FileSelected="FileSelected" OnMenuClick="menuClick"></FileManagerEvents>*@
                            <FileManagerEvents TValue="FileManagerDirectoryContent" FileSelection="FileSelection" OnMenuClick="MenuClick" ToolbarItemClicked="ToolbarClick"></FileManagerEvents>
                            <FileManagerDetailsViewSettings></FileManagerDetailsViewSettings>
                        </SfFileManager>
                    </div>
                </ContentTemplate>
            </SplitterPane>
            <SplitterPane Size="55%">
                <ContentTemplate>
                    <div style="height: 100%; overflow: hidden!important">
                        <MonacoEditor @ref="Editor" CssClass="monaco-editor" Id="sample-code-editor-456" ConstructionOptions="EditorConstructionOptions" OnDidInit="EditorOnDidInit"/>
                    </div>
                </ContentTemplate>
            </SplitterPane>
        </SplitterPanes>
    </SfSplitter>







public async void FileSelection(FileSelectionEventArgs<FileManagerDirectoryContent> args)



    {


        if (args.Action == "Select")


        {


            if (args.FileDetails.IsFile)


            {


                var root = await _fileManagerViewModel.GetRootPath();


                string fileName = args.FileDetails.Name;


                string subDir = args.FileDetails.FilterPath;


                var path = Path.Combine(root, subDir, fileName);


                var encryptPath = Base64tHelper.Encode(path);


                var file = await _fileManagerViewModel.GetFile(encryptPath);


                await Editor.SetValue(file);


            }


            else


            {


                await Editor.SetValue("");


            }


        }


    }


Thanks, Hugo


2 Replies

IL Indhumathy Loganathan Syncfusion Team December 30, 2021 01:01 PM UTC

Hi Hugo, 
 
Greetings from Syncfusion support. 
 
We have prepared a Blazor sample with the shared code snippets in latest package version(19.4.40). In the sample, we have comment out the customizations done with the MonacoEditor and rendered the File Manager inside Splitter. But unable to replicate the reported issue. You can find the sample from below link. 
 
 
We suspect the issue may cause due to the Editor customizations but unable to do those changes in the sample with provided details. So, we request you to either modify the above sample to replicate the issue at our end or share us the complete code file with those Editor configurations. Also confirm your Syncfusion package version. These details would help us assist you promptly. 
 
Regards, 
Indhumathy L 



DA David April 13, 2022 05:21 PM UTC

Did you find a solution for this Hugo?


Loader.
Up arrow icon