Type mismatch. The return type 'Void' of best-match method on type is not compatible with the 'Result' argument supplied to InvokeMethod - wcf

Getting Error while Invoking Workflow Activity in WCF Services
Type mismatch. The return type 'Void' of best-match method 'Mailsend' on type 'BusinessClass' is not compatible with the 'Result' argument supplied to InvokeMethod 'JobNotification', which expects return values of type 'String'.

It solved while defining Activity inArugment type of all the associated parameters.

Related

Embed an type of other pkg into mine, and init it by literal

I read how to init embed type, and a related Q&A.
What my problem is when compile this code, I got :
[Error] unknown field 'feature.DefaultSshHelper' in struct literal of type dala02
type FDH feature.DefaultSshHelper
type dala02 struct {
Md5_v string
feature.DefaultSshHelper
//FDH
}
var x_01_h1_p = &dala02{
Md5_v: "",
feature.DefaultSshHelper: feature.DefaultSshHelper{
//FDH: FDH{
// blabla
},
}
// use it by a interface []feature.CmdFioHelper{x_00_h1_p}
At first time, I thought it was an Exported problem, so I added this line 'type FDH feature.DefaultSshHelper'. Now, we have this error :
[Error] cannot use x_01_h1_p (type *dala02) as type feature.CmdFioHelper in array or slice literal:
*dala02 does not implement feature.CmdFioHelper (missing Getnextchecker method)
But a pointer of feature.DefaultSshHelper does implement feature.CmdFioHelper ( a interface ). So pointer of dala02 should also implement that, right? (reference form effective go)
There's an important way in which embedding differs from subclassing. When we embed a type, the methods of that type become methods of the outer type, but when they are invoked the receiver of the method is the inner type, not the outer one.
Question is how to fix this compile error, which line is wrong? I'm not a expert for golang, thanks for your advice :). BTW I do find some workaround.
When you refer to embedded fields, you have to leave out the package name of the embedded type, as the unqualified type name acts as the field name.
Spec: Struct types:
A field declared with a type but no explicit field name is an anonymous field, also called an embedded field or an embedding of the type in the struct. An embedded type must be specified as a type name T or as a pointer to a non-interface type name *T, and T itself may not be a pointer type. The unqualified type name acts as the field name.
So simply write:
var x_01_h1_p = &dala02{
Md5_v: "",
DefaultSshHelper: feature.DefaultSshHelper{
// blabla
},
}
Your other attempt type FDH feature.DefaultSshHelper falls short as this type declaration creates a new type with zero methods: the type FDH does not "inherit" the methods of feature.DefaultSshHelper. And thus any type that embeds FDH will also lack methods of feature.DefaultSshHelper.

Properties on anonymous types in TypeScript

I am trying to check a property on an anonymous type in a Lambda expression in TypeScript.
This won't compile:
Build: Property 'infomodel' does not exist on type '{}'.
The sn.app.map.Markers array is of type any

NetDataContractSerialization throwing deserialization error

I have methods which return interface and some methods which accepts interface as parameters. I am trying to use Net DataContractSerializer but I am getting following error...
The formatter threw an exception while
trying to deserialize the message:
There was an error while trying to
deserialize parameter
http://tempuri.org/:id. The
InnerException message was 'Error in
line 1 position 120. XML 'Element'
'http://tempuri.org/:id' does not
contain expected attribute
'http://schemas.microsoft.com/2003/10/Serialization/:Type'.
The deserializer has no knowledge of
which type to deserialize. Check that
the type being serialized has the same
contract as the type being
deserialized.'. Please see
InnerException for more details.
Please help me how to resolve this error....
If I use Netdatacontract attribute on Operation Contract, can i use DataContract and Datamember attribute on serializable class???
Thanks in advance...
Just guessing - the error seems to indicate the NetDataContractSerializer can't properly determine what type to deserialize your content into.
Could it be that you're not specifying the http://tempuri.org XML namespace to the deserializer??
Also, can you show the content of the InnerException, please?
Or second option: using the NetDataContractSerializer, you need to also share the data contracts between server and client, so that the client can deserialize to the exact same type as was defined on the server side. Are you missing this requirement, maybe??

Problem returning field in ms sql 2005 - System.InvalidCastException:

Using the code below, I am returning an nvarchar field from MS SQL 2005 and keep getting a System.InvalidCastException.
vo.PlacementID = dr.IsDBNull(0) ? null : dr.GetString(0);
The vo.PlacementID variable is of type String so there shouldn't be a problem.
The values I am trying to return are like this (number, number, letter): 00F, 02A, 01F, etc
System.InvalidCastException: Unable to cast object of type 'System.Int32' to
type 'System.String'.
at System.Data.SqlClient.SqlBuffer.get_String()
at System.Data.SqlClient.SqlDataReader.GetString(Int32 i)
Any help much appreciated.
If you read the exception again it gives you a clue as to the problem:
System.InvalidCastException:
Unable to cast object of type 'System.Int32' to type
'System.String'. at
System.Data.SqlClient.SqlBuffer.get_String()
at
System.Data.SqlClient.SqlDataReader.GetString(Int32
i)
Basically the underlying data type being returned in column 0 of your SqlDataReader isn't a string compatible type, hence the cast exception.
I'd suggest setting a breakpoint on the offending line and then execute the following line in the immediate window:
? dr.GetValue(0).GetType()
This will tell what type being returned.
the cast exception is not raised in the assignment, but in the datareader's GetString().
try dr.GetValue(0).ToString()
The InvalidCastException isn't raised because of the type incompatibility between the PlacementID property and string. If that was the case, you'd get a compile-time error. The problem is the first field in the result set is not a string, it's something else.

Why am I getting this Objective-C error message: invalid conversion from 'objc_object*'

This error message had me stumped for a while:
invalid conversion from 'objc_object* to 'int'
The line in question was something like this:
int iResult = [MyUtils utilsMemberFunc:param1,param2];
It doesn't matter what the "to" type is, what is important is that you recognize that this message, in this context, is reporting that the utilsMemberFunc declaration was not found and due to Objective-C's dynamic binding it is assuming it returns an objc_object* rather than the type that utilsMemberFunc was declared to return.
So why isn't it finding the declaration? Because ',' is being used rather than ':' to separate the parameters.