c# - Blend crash with ObservableAsPropertyHelper -
microsoft blend 2013 crashes when try load wpf solution developed in visual studio 2013. (abbreviated) error message receive is: system.exception: onerror occurred on object (usually observableaspropertyhelper) break binding or command. prevent this, subscribe thrownexceptions property of objects ---> system.invalidoperationexception: no connection string named 'recipemodelcontainer' found in application config file.
the application builds fine , executes when run it. before particular issue started, blend consistently showed missing connection string message; message originated when set datacontext in code-behind, , has persisted ever since transferred datacontext reference xaml. in case, connection string there.
i experimenting reactiveui develop user control, , using observableaspropertyhelper
property. here property:
private observableaspropertyhelper<ilist<string>> _matches; public ilist<string> matches { { return _matches.value; } }
... , here related content in viewmodel constructor:
var searchterms = this.observableforproperty(x => x.ingredientfilter) .value() .throttle(timespan.fromseconds(0.2)); var searchresults = searchterms.selectmany(st => searchingredients(st)); _matches = searchresults.toproperty(this, x => x.matches);
being relatively unfamiliar reactive extensions , confused why blend cares in app.config file, i'm @ loss how implement recommended error handling or otherwise manage problem. have tried cleaning solution deleting .suo files. suggestions?
i have identified 2 solutions problem. first implements thrownexception handling per blend error message recommendation:
_matches.thrownexceptions.subscribe(e => messagebox.show(e.message));
this launches 2 messagebox windows on blend startup read "no connection string named recipemodelcontainer found in application config file", @ least blend doesn't crash.
second, turns out issue resulted 0 delay in async searchingredients method, queries entity framework dbcontext object matches. had added await task.delay(0)
fake async method searchterms.selectmany (the application hangs if method not async). it's still not clear me has app.config file, issue disappears altogether when change non-zero delay.
Comments
Post a Comment