c# - Unhandled exception using FaultException<T> with WCF and WP7 App -
i consuming wcf service wp7 app. both in single vs solution. worked fine until tried pass faultexception.
when throwing faultexception wcf service, receive message "an unhandled exception of type 'system.servicemodel.faultexception`1' occurred in system.servicemodel.dll" on endinvoke in proxy. if hit continue, exception not bubble up. handler code never hit.
i believe have wired properly. i've seen plenty of examples, i've spent entire day scouring web issue. if stop throwing faultexception, application works fine.
in vs debug > exceptions dialog, have tried disabling faultexception , faultexception'1 under clr/system.servicemodel. have tried going tools > options, debuggung > general , turning off "enable exception assistant" , "enable code (managed only). none of these has enabled exception bubble calling method in app.
interface code --
[operationcontract] [faultcontract(typeof(notauthorizedexception))] list<myresult> getvalues(datetime begindate, datetime enddate);
exception type --
[datacontract] public class notauthorizedexception { [datamember] public string message { get; set; } }
server code throw exception --
throw new faultexception<notauthorizedexception>( new notauthorizedexception(), new faultreason("not authorized."), new faultcode("sender"));
client call wcf service --
try { myserviceclient myservice = new myserviceclient(); myservice.getvaluescompleted += new eventhandler<getvaluescompletedeventargs>(myservice_getvaluescompleted); myservice.getvaluesasync(datetime.now, datetime.now.addmonths(6)); } catch (faultexception<notauthorizedexception>) { //handle error here }
where breaks (in reference.cs) --
system.collections.objectmodel.observablecollection<namespace.myservice.myresult> _result = ((system.collections.objectmodel.observablecollection<namespace.myservice.myresult>)(base.endinvoke("getvalues", _args, result)));
the proxy code unaltered code generated "add service reference" menu item.
it has simple, i'm not seeing it!
i believe should catch faultexception<notauthorizedexception>
@ myservice_getvaluescompleted
instead of doing now
Comments
Post a Comment