c# - No matching constructor found on type. You can use the Arguments or FactoryMethod directives to construct the type -
i'm hoping can me odd issue. developing wpf .net framework 4.0 application, receiving message:
no matching constructor found on type. can use arguments or factorymethod directives construct type when attempting use following code.
usercontrol:
<grid> <groupbox header="diagram"> <scrollviewer horizontalscrollbarvisibility="auto" verticalscrollbarvisibility="auto"> <designer:designercanvas focusable="true" x:name="mydesigner" background="{staticresource windowbackgroundbrush}" margin="10" focusvisualstyle="{x:null}" contextmenu="{staticresource designercanvascontextmenu}" /> </scrollviewer> </groupbox> </grid>
class:
/// <summary> /// designer canvas. /// </summary> public partial class designercanvas : canvas { public designercanvas() { .... } }
as far can see there doesn't appear wrong code.
thanks, john
update:
turns out masking underlying exception. stripped out in constructor in designercanvas , worked. re-added setting command bindings in separate method , received:
system.missingmethodexception: method not found: void system.windows.input.commandbinding..ctor(system.windows.input.icommand, system.windows.input.executedroutedeventhandler)
the constructor included attempts setup command bindings. e.g.
public void setupcommanddefaults() { this.commandbindings.add(new commandbinding(applicationcommands.new, this.new_executed)); }
i'm uninstalling , reinstalling .net framework 4.0 in faint hope fix problem.
turns out after pain re-installing .net framework 4, applying various kb patches , including runtime 4.0.3. problem caused ilmerge msbuild step.
the build process included msbuild task after build merge main executable dll's.
i removed ilmerge step , error disappeared.
not sure why occured on environment , not on of our test machines working now.
Comments
Post a Comment