c# - Windows Store App Unit test fails when using custom control -


i have windows store app (c# + xaml) , wanted create unit tests it. created unit test project within solution , default test method works fine. added project reference unit test project , tests stopped working:

------ discover test started ------ ========== discover test finished: 1 found (0:00:00,8748072) ========== ------ run test started ------ updating layout...  copying files: total 2 mb layout...  registering application run layout...  deployment complete. full package name: "58d19822-a649-46ba-b3fd-36c60b2709d7_1.0.0.0_neutral__t4zwj4xd20b1w"  failed activate windows store app unit test executor. error: remote procedure call failed. ========== run test finished: 0 run (0:00:05,0596667) ========== 

i googled lot , found thread explained error within app.xaml , indeed track down textblock:

<textblock grid.columnspan="2" controls:highlightstring.fulltext="{binding path=fullname}" controls:highlightstring.selectedtext="{binding datacontext.querytext, elementname=resultspanel}" controls:highlightstring.fgcolor="{staticresource saphighlightcolor}"  style="{staticresource tiletitletextstyle}" margin="20,0,0,0" texttrimming="wordellipsis"/> 

if change to:

<textblock grid.columnspan="2" text="{binding path=fullname}" style="{staticresource tiletitletextstyle}" margin="20,0,0,0" texttrimming="wordellipsis"/> 

the tests run fine no longer have search highlight on text block.

how can have both - search highlights , running unit tests within solution?

this might related https://connect.microsoft.com/visualstudio/feedback/details/790477/winrt-mstest-runner-fails-when-using-ilist-t-properties-of-custom-types-from-xaml

as far can tell, use of custom types in xaml incompatible winrt unit test runner, because not provide proper ixamltype interface implementations in cases.

so it's possible there's these attachable properties you're using causes test runner provider incorrect metadata them. (without being able see highlightstring class it's hard sure. can verify whether case turning on mixed mode debugging unit test project, , debugging tests. configure visual studio break on clr exceptions when thrown (and not when unhandled), , if hit notimplementedexception (possibly after few other exceptions) in type called runtimexamlsystembasetype problem you're running into.)

i've worked around in past avoiding putting relevant types in app.xaml. run problem if attempt load relevant xaml. (not if need these things @ global scope of course.)


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -