question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Upgrade to 4.0 Issues and Questions

See original GitHub issue

I set up a new branch from master on my app that was using the previous version of this framework then to upgrade to 4.0. Previous version worked fine. I upgraded, your “breaking changes” notes were quite small, thus felt like easy upgrade.

Note: The v4 I can see is faster to load…sweet!

Here are my issues: Note: I have tried various things because I am a good programmer and I see the source, but I just get errors, and just do not understand the issue from working in v 3 and fail in v 4.

<div data-is-scrollable="true" style="height:400px;overflow-y:auto;">
        <BFUDetailsList ItemsSource="UserRoleListItems" TItem="RoleBasedAccessModel"
                        IsHeaderVisible="true"
                        Columns="Columns"
                        GetKey=@(x=>x.Id)
                        LayoutMode="DetailsListLayoutMode.Justified"
                        SelectionMode=@SelectionMode.Single
                        Selection="selectedItem" 
                        SelectionChanged="SetSelectedUser" /> <-- this worked before now gone (SelectionChanged)
    </div>

BFUDetailsList SelectionChange is gone <- how do I set my selected item in the list event. I tried all kinds of crazy events, funcs, lambdas I just could not figure this out. But why change?


I changed to BFUDetailsListAuto which does have the SelectionChanged and I get error
<div data-is-scrollable="true" style="height:400px;overflow-y:auto;">
        <BFUDetailsListAuto  ItemsSource="UserRoleListItems" TItem="RoleBasedAccessModel"
                        IsHeaderVisible="true"
                        Columns="Columns"
                        GetKey=@(x=>x.Id)
                        LayoutMode="DetailsListLayoutMode.Justified"
                        SelectionMode=@SelectionMode.Single
                        Selection="selectedItem"
                        SelectionChanged="SetSelectedUser"/>
    </div>

crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: Value cannot be null. (Parameter ‘second’) System.ArgumentNullException: Value cannot be null. (Parameter ‘second’) at System.Reactive.Linq.Observable.Merge[PropertyChangedEventArgs](IObservable1 first, IObservable1 second) in //Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.cs:line 572 at BlazorFluentUI.BFUDetailsListAuto1.<>c[[UnifiedIntakeTool.Shared.Models.RoleBasedAccessModel, UnifiedIntakeTool.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<CreateSourceCache>b__134_17(IObservable1 x, BFUDetailsRowColumn1 y) at System.Linq.Enumerable.Aggregate[BFUDetailsRowColumn1,IObservable1](IEnumerable1 source, IObservable1 seed, Func3 func) at BlazorFluentUI.BFUDetailsListAuto1[[UnifiedIntakeTool.Shared.Models.RoleBasedAccessModel, UnifiedIntakeTool.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<CreateSourceCache>b__134_4(PropertyChangedEventArgs prop) at System.Reactive.Linq.ObservableImpl.SelectMany2.ObservableSelector.[[System.ComponentModel.PropertyChangedEventArgs, System.ObjectModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a],[System.ComponentModel.PropertyChangedEventArgs, System.ObjectModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].OnNext(PropertyChangedEventArgs value) in /_/Rx.NET/Source/src/System.Reactive/Linq/Observable/SelectMany.cs:line 869

then in the same page, I get a new error with the checkbox: <- working in v 3 image

This is my code from v 3 working fine within a EditForm to manage user RBAC in an admin page.

<EditForm id="addUserForm" Model="@userData" OnSubmit="@AdduserDataAsync">
        <div>
            <BFUTextField Label="User Fullname:"
                          Disabled="@(userData.Id != Guid.Empty)"
                          Required="true"
                          @bind-Value="@userData.UserFullName" @bind-Value:event="OnInput" />
        </div>
        <div>
            <BFUTextField Label="User Email:"
                          Disabled="@(userData.Id != Guid.Empty)"
                          Required="true"
                          @bind-Value="@userData.UserEmail" @bind-Value:event="OnInput" />
        </div>
        <div className="ow-role-inputs">
            <BFUCheckbox Label="Owner"
                         Checked="@userData.Roles.Where(x => x.RoleName.Equals("Owner")).Any()"
                         CheckedChanged="@(eventArgs => { RoleChange("Owner", eventArgs); })" />

            <BFUCheckbox Label="Administrator"
                         Checked="@userData.Roles.Where(x => x.RoleName.Equals("Administrator")).Any()"
                         CheckedChanged="@(eventArgs => { RoleChange("Administrator", eventArgs); })" />

            <BFUCheckbox Label="User"
                         Checked="@userData.Roles.Where(x => x.RoleName.Equals("User")).Any()"
                         CheckedChanged="@(eventArgs => { RoleChange("User", eventArgs); })" />

            <BFUCheckbox Label="ReadOnly"
                         Checked="@userData.Roles.Where(x => x.RoleName.Equals("ReadOnly")).Any()"
                         CheckedChanged="@(eventArgs => { RoleChange("ReadOnly", eventArgs); })" />
        </div>
    </EditForm>

your framework code:

protected override Task OnParametersSetAsync()
       {
           if (CascadedEditContext != null)
           {
               if (CheckedExpression == null)
               {
                   **throw new InvalidOperationException($"{GetType()} requires a value for the 'CheckedExpression' " +
                       $"parameter. Normally this is provided automatically when using 'bind-Checked'.");**
               }
               FieldIdentifier = FieldIdentifier.Create<bool>(CheckedExpression);

               CascadedEditContext?.NotifyFieldChanged(FieldIdentifier);

               CascadedEditContext.OnValidationStateChanged += CascadedEditContext_OnValidationStateChanged;
           }

I am not good at looking and GIT diffs, but what changed here? how do I fix this? I moved the checkbox out of the EditForm elements to fix issue. <- why?

Finally, This one is really stumping me… v3 DataList render fine v 4, I get some extra “}” that throws my styling off. Same code as v3, but v4 get extra “}” in my list <- again, possibly something on my end, but very strange image

So, I am questioning why the v3 working fine, I just upgrade Nuget to v4 and my app fails with DataList issues and Checkbox as a child of an EditForm issue, and some rando ‘}’ in my DataLists.

Finally, I would like to help out on this repo once I get caught up and understand a bit more.

Cheers!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

3reactions
limefrogyankcommented, Nov 11, 2020

OK! I just merged a bunch of PRs (thanks Nino) and added some fixes of my own and setup a new nuget package build. Since this is badly breaking change, I’m just going to put it out there and hope there are no further big bugs.

In addition to the two methods for setting selected items above, I’ve added a new method that should be easier:

The Selection.SelectedItems property is what you want to use to set which items are selected programmatically. You can still use the methods if you have keys or index numbers, but the actual items work, too. You still need to set the GetKey callback first, because it needs that to find the key for each item you’re adding.

@bind-Selection no longer works on ANY list. It was a leftover from v3 I forgot to remove. I also removed it from the demo since it would break things.

0reactions
MicahN-ISScommented, Nov 11, 2020

@NPadrutt @limefrogyank

OK. with regards to the “}” we can close this issue thread as the bug was fixed with a PR.

I have solved for everything else this morning.

  1. I just wanted to select an item in the DataList and update my UI with that data I selected on a Single select Selection mode. Solved: Yes, thanx to the comments seeing the Selection object is the way to go. I wired up the event -> SelectedItem.OnSelectionChanged += new EventHandler(SetSelectedUser);

  2. The other wonky error Value cannot be null. (Parameter ‘second’) System.ArgumentNullException: Value cannot be null. (Parameter ‘second’) Was due to when I switched to BFUDetailsListAuto the BFUDetailsRowColumn needed the fieldSelector type set (at least this solved the error)

Thanx

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues after Softaculous Moodle 4.0 Upgrade from 3.11.6
Maybe you are mis-communicating again with this question. There isn't a single 'plugins' directory for all plugins. If user installed a non-core theme,...
Read more >
NET Framework 4 migration issues
This article describes migration issues between .NET Framework version 3.5 Service Pack 1 and .NET Framework version 4, including fixes, changes ...
Read more >
Web application upgrade to 4.0 .Net Framework issue
The code has not changed with the upgrade. The same code works fine with 2.0 framework. What stumps me is why it won't...
Read more >
Upgrade a Replica Set to 4.0
To upgrade an existing MongoDB deployment to 4.0, you must be running a 3.6-series release. To upgrade from a version earlier than the...
Read more >
Upgrade a Standalone to 4.0
To upgrade an existing MongoDB deployment to 4.0, you must be running a 3.6-series release. To upgrade from a version earlier than the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found