Problem naming a BizTalk operation ReceiveMessage or SendMessage

Here was a strange one that took me a while to nail down.  First, the error messages:
The keyword new is required on ‘Microsoft.Samples.BizTalk.SendMail.ReceivePortType.ReceiveMessage’ because it hides inherited member ‘Microsoft.BizTalk.XLANGs.BTXEngine.BTXPortBase.ReceiveMessage(int, Microsoft.XLANGs.Core.Envelope, Microsoft.XLANGs.BaseTypes.XLANGMessage, Microsoft.XLANGs.Core.Correlation[], Microsoft.XLANGs.Core.Context, Microsoft.XLANGs.Core.Segment)’

‘Microsoft.Samples.BizTalk.SendMail.ReceiveSend.ReceivePort’ denotes a ‘field’ where a ‘class’ was expected

Static member ‘Microsoft.Samples.BizTalk.SendMail.ReceivePortType.ReceiveMessage’ cannot be accessed with an instance reference; qualify it with a type name instead
‘Microsoft.Samples.BizTalk.SendMail.ReceivePortType.ReceiveMessage’ denotes a ‘field’ where a ‘method’ was expected
After searching for a few hours on the Internet for that one and playing around with recent changes I had made I finally had realized what I did:  I was getting a little too creative for my own good (or not creative enough, perhaps). 
I decided that Operation_1 and Operation_2 were not good names for my receive and send ports so I decided to name them something else.  Of course, in a burst of creativness I used ‘ReceiveMessage’ and ‘SendMessage’ for the names.  I had done that a while back but apparently never did a build as I made several other changes since.  Then I compiled and got the errors above on the receive port.
Figuring it had something to do with the ports I decided to just nuke them and recreate them.  I used my usual internal justification that Microsoft’s software had somehow screwed up my code (uh … it never turns out that way).  After doing this everything compiled just fine once again.  Ah Ha! It was Microsoft screwing up my code! Then I immediately went and renamed the ports once again to my ever-so-creative names and boom. 
Moral: Either get very creative with your naming or have a complete lack of creativness altogether.  Don’t sit in the middle.

One thought on “Problem naming a BizTalk operation ReceiveMessage or SendMessage

  1. Hello JasonI just want to say that you really saved my day with this! I have been going crazy trying to figure this out. It wasn’t even me who named the operations since I was working with a port type which was imported from a third-party web service. When I tried to compile I got the uncomprehendible error saying that I was trying to use a static method on an object instance. But how could this be, since the code was auto-generated?? My thought was exactly like yours – MS software generated some bad code (always blame it on Bill, right? 😀 ). Any-way, after hours and hours of debugging I stumbled across your blog, and all my troubles were gone! Indeed, the company which made the web service had named the operation ‘SendMessage’, which in reality was a pretty good name. Luckily, it was a custom made solution so they were willing to change the name to something else.I guess that BT has an internal static method called SendMesssage which it tries to use and fails since it uses it on an instance. On this matter I DO blame Bill and Co. since I feel that they should try to warn developers about this, either through the error message or in their documentation. You know, something like "By the way dude, don’t’ call your operation ‘SendMessage’ since it conflicts with an existing method name. Peace!"We, BizTalk developers, own a big thanks to a handful of guys like your self who provide solutions to BT problems which MS fails to address. So, thanks a bunch man.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s