You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I have some properties that will throw exception in get and set if some other dependent property is not properly set. For this reason, I have implemented custom LookUpContract and set SupportsNewObjectCreation to false, just to avoid creating objects, since they should only be created in backend and just filtered on the UI.
If you put the breakpoint on SupportsNewObjectCreation it will never be hit. At what point this property gets called ?
To Reproduce
1.Create object such as :
class Test
{
private int _num;
private string _text
public int Num {get; set;}
public string Text {get {if _num == 99 throw exception else return _text }; set {}
}
Create collection and pass it to the UI
Provide custom LookUpContract implementation setting public bool SupportsNewObjectCreation => false;
Put breakpoint on this property
Start the app, add one item, add another, then try to delete items
Reaches get of the Text property, resulting in crash
Expected behavior
Not to call getter of this property, and don't create a new instance
BlackPearl 1.0.2.1
.net core 3.1 WPF app
The text was updated successfully, but these errors were encountered:
I tried to reproduce scenario issue with steps you mentioned.
I figured there are two separate issue here-
1) Crash on clearing all items -
Are you getting serialization error in exception? If so, try making entity public. i.e. TestData
2) Property throwing exception -
This is highly not recommended doing so. Try creating new property which does not throw exception or wrapper object. However, if you don't control that entity (Third Party) or don't want to create wrapper one, handle property exception in Look-up contract. I was able to do so. Should work for you as well.
One suggestion, implement LookUpContract only if you need custom sorting or want to support new object creation on UI. Basic, filtering is by default provided by control on DisplayMemberPath.
No, sorry my bad, I forgot to include the public keyword at the beginning. Entity is public
I actually considered creating wrapper object, and I think it should be a way to go. Catching exception for each object will not be performant, since ItemSource will contain right from the start ~4500 items.
Yes, "starts with" query will not work for me. I need to match cases not just check if the string starts with given input. I need to check if substring is found in string. So for example:
user starts typing "lay"
it will find the nilay as search result instead of typing "ni...." to get the same result.
Describe the bug
I have some properties that will throw exception in get and set if some other dependent property is not properly set. For this reason, I have implemented custom LookUpContract and set SupportsNewObjectCreation to false, just to avoid creating objects, since they should only be created in backend and just filtered on the UI.
If you put the breakpoint on SupportsNewObjectCreation it will never be hit. At what point this property gets called ?
To Reproduce
1.Create object such as :
Expected behavior
Not to call getter of this property, and don't create a new instance
BlackPearl 1.0.2.1
.net core 3.1 WPF app
The text was updated successfully, but these errors were encountered: