Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
following exception occur
C++
An exception of type 'System.Reflection.TargetInvocationExcep… occurred in System.ni.dll but was not handled in user code

client side
C#
private void TrackLocation_Click(object sender, RoutedEventArgs e)
{
ServiceReference1.GetPositionClient client = new ServiceReference1.GetPositionClient();

client.getData1Completed += new EventHandler<servicereference1.getdata1c…>
client.getData1Async(11.1,11.1);

}

void client_getData1Completed(object sender, ServiceReference1.getData1CompletedEvent… e)
{
LongitudeTextBlock.Text = e.Result;
}

server side
C#
public class GetPosition : IGetPosition
{
public string getData1(double lat,double lon)
{ return "updated sucessfully"; }
}
Posted
Updated 8-Sep-13 0:53am
v2
Comments
Sergey Alexandrovich Kryukov 8-Sep-13 11:42am    
This is by far not a comprehensive exception information. It also has message, stack trace, inner exception, parameters, and sometimes exception-type specific information. Did you find out in what line? Used the debugger?
—SA
zohaib khan niazi 8-Sep-13 18:32pm    
thnx for quick rply
call trace:
> PhoneApp11.DLL!PhoneApp11.ServiceReference1.GetPositionClient.GetPositionClientChannel.EndgetData1(System.IAsyncResult result) Line 253 C#

public string EndgetData1(System.IAsyncResult result) {
object[] _args = new object[0];
string _result = ((string)(base.EndInvoke("getData1", _args, result)));//exception occur in this line
return _result;
}




Sergey Alexandrovich Kryukov 9-Sep-13 0:54am    
Thank you for additional information, but...

What is "call trace"? I mention exception stack trace, which is a path of the propagation of the exception on the stack, which is itself a stack of points in the call stack, with lines of the source code indicating lines where the exception propagates. Please see Exception.StackTrace property, which is just a string. Exception message and other properties are also important...

—SA

1 solution

It seems that the exception is in the wiring of the service reference. If the service side throws any error and its not getting passed to thec client, you need to put
C#
includeExceptionDetailsInFaults = true
for the serviceDebug attribute in server side configuration.

I believe that the service atleast gets hit by the client. However, to debug this scenario, try to load your service through browser and manually hit the method. If it returns fine, then the issue is in client side configuration. By including this attribute, you can be more clear about what's happening.

Also update your service reference once so that you are sure that you have a latest copy of wsdl just in case you updated the service after creating the service reference.

Once you get the actual stack trace, identify the points where it shows about the application (ignore the framework lines) and the post those.
 
Share this answer
 
Comments
zohaib khan niazi 9-Sep-13 16:37pm    
how to find the inner exception and call trace . when i run the application the exception occur and option come that break,continue or cancel
actually my server is on wcf visual studio 2012 and client side appliction is on sdk 8.0
when i try the same code when i have server and client both on vs2012 it work perfectly??
i dont know how to fix it
Nitin Singh India 9-Sep-13 22:56pm    
What you mean by sdk 8.0 ?

Since this is a .net exception, simply place try-catch on both client/server and catch FaultException and Exception both.
Being able to run both in VS2012 means your server side is fine. There seems some issue in client side configuration.

1. Post description of any fault Exception. If not able to, place breakpoints and identify where the error starts.
2. Post config for the client side

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900