c# - Howto avoid a "object reference not set to an instance of an object" exception in XAML code while design time? -


i have problem wpf usercontrol of own devising. problem object reference not set instance of object exception in xaml code while design time, when implement usercontrol in program.

how can fix or suppress exeption?

edit 1

the designer show me following information:

at microsoft.expression.platform.instancebuilders.instancebuilderoperations.instantiatetype(type type, boolean supportinternal) @ microsoft.expression.platform.instancebuilders.clrobjectinstancebuilder.instantiatetargettype(iinstancebuildercontext context, viewnode viewnode) @ microsoft.expression.platform.instancebuilders.clrobjectinstancebuilder.instantiate(iinstancebuildercontext context, viewnode viewnode) @ microsoft.expression.wpfplatform.instancebuilders.frameworkelementinstancebuilder.instantiate(iinstancebuildercontext context, viewnode viewnode) @ microsoft.expression.wpfplatform.instancebuilders.usercontrolinstancebuilder.instantiate(iinstancebuildercontext context, viewnode viewnode) @ microsoft.expression.platform.instancebuilders.viewnodemanager.createinstance(iinstancebuilder builder, viewnode viewnode)

i think not helpful...

whatever happening in constructor throwing exception during design time. had same problem - put try catch around problematic code - in case calling servicelocator.current using ioc container. there no container during design time. wrapped in try catch suppress error , worked. not best solution... solution.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -