user6616198
user6616198

Reputation:

Error in getting the InstanceID BizTalk

Is there a known issue in this code for BizTalk 2010?

string InstanceID = Microsoft.XLANGs.Core.Service.RootService.InstanceId.ToString()

We keep encountering the error "Object Reference not set to an instance object" whenever we used that line. What's weird is that even if we put an if condition to check if that line is null before converting it to string, we still hit the error.

Upvotes: 0

Views: 291

Answers (2)

DTRT
DTRT

Reputation: 11050

So, the BizTalk Answer to this question is, you should not be doing this.

If you explain a bit about exactly what you're trying to do, I will amend the Answer with a better solution.

Upvotes: 1

Dijkgraaf
Dijkgraaf

Reputation: 11527

If you are trying to do that in an Orchestration you should be defining the InstanceID as a variable in the Orchestration view, rather then trying to define it in your code as a String.

e.g.

enter image description here

And your code should be

InstanceID = Microsoft.XLANGs.Core.Service.RootService.InstanceId.ToString();

Upvotes: 1

Related Questions