I get an amazing ambiguous error message when using one of my web methods in my WCF web service. Since this error message provides no explanation, let me post my theory.
I suppose this may have something to do with the type of return I'm using
I have a type DLL that is redefined in both the webservice and the client. This DLL uses the base class ExceptionMessages. There is a child of this DrawingExcepions class.
Here is the code:
public class ExceptionMessages
{
public object[] ReturnValue { get; set; }
}
public class DrawingExceptions : ExceptionMessages
{
private List<DrawingException> des = new List<DrawingException>();
}
public class DrawingException
{
public Exception ExceptionMsg { get; set; }
public List<object> Errors { get; set; }
}
Code Usage:
[OperationContract]
ExceptionMessages createNewBom(Bom bom, DrawingFiles dfs);
public ExceptionMessages createNewBOM(Bom bom, DrawingFiles dfs)
{
return insertAssembly(bom, dfs);
}
public DrawingExceptions insertAssembly(Bom bom, DrawingFiles dfs)
{
DrawingExceptions des = new DrawingExceptions();
foreach (DrawingFile d in dfs.drawingFiles)
{
DrawingException temp = insertNewDrawing(bom, d);
if (temp != null)
des.addDrawingException(temp);
if (d.Child != null)
des.addDrawingException(insertAssembly(bom, d.Child));
}
return des;
}
Return to:
ExceptionMessages ems = client.createNewBom(bom, currentDFS);
if (ems is DrawingExceptions) { }
Basically, the return type from the web method is ExceptionMessages, but usually I send a child class.
, , , , , . - - , ?
, :)
.