BYOT & Win2k Reprise

I've done some more digging on the BYOT problem on Win2k I reported a while back. Now, I've come up with a plain C++ version of the original test (albeit more manual), and get the same errors as with .NET involved, which is not suprising at all.

What is surprising, at least to me, is that the problem only occurs if the exporter of the TIP Transaction and the importer of it (via ICreateWithTipTransaction) are running on separate processes. If both run in the same process, it works just fine, even if the thread calling ICreateWithTipTransaction::CreateInstance() is not inside a COM+ context.

For those of you wanting to play with this, here's the VC++.NET project I used this time. Now, you can call AppHost.exe with no arguments, and get a TIP Transaction URL in return, and call AppHost.exe again in another console passing the URL as an argument. Changing the code to do both inside the same process is left as an excercise for the reader :)

Comments (2)

James ButlerSeptember 15th, 2003 at 1:07 pm

I’ve just run into the same problem as you: but what’s bizarre, is that I’m only looking for a solution since it STOPPED working. 24 hours ago it worked. This definitely isn’t a mistake, was testing using distributed rollbacks and commits involving SQL and other things and it all worked.

Will post if I manage to make it work again :( .

James ButlerSeptember 15th, 2003 at 1:54 pm

I’ve managed to make it work again… it stopped working after I’d made a raft of changes and thankfully I was able to identify which!

The change was that before my “breaking changes” I’d been instantiating the COM+ ServicedComponent without BYOT, doing the following (the object was being loaded ‘dynamically’):

Assembly a = Assembly.Load(assemblyName);
objType = a.GetType(className, true, false);

m_con = m_type.GetConstructor(Type.EmptyTypes);
MyIface o = (MyIface)m_con.Invoke(null);

When I was doing my original BYOT stuff I’d left this in by mistake… when I did some cleanup and removed it, it all broke! So adding this back in at initialisation fixed it again :) . (WOW… very relieved.) Note, you don’t even need to call a method on the object, just instantiate it.

I’m not sure why exactly this fixes the problem, haven’t had any more time to go into it. Presumably there’s some initialisation somewhere that the BYOT call doesn’t do that the ‘normal’ (.NET?) COM+ stuff DOES do.

I’m not using TIP so I don’t know whether this is the same problem, but all the symptoms and the event log message from COM+ are identical so I suspect it is the same thing. I agree this might well be a bug in Win2K but maybe this workaround is worth a try?

Other things worth checking if I ever have time:
1. Is it creation of any COM+ object before using BYOT that does it (i.e. is process-wide initialisation missing)?
2. Is it creation of any COM+ object in the same COM+ application before using BYOT that solves it?
3. Or does it have to be creation of each object you want to use BYOT with?
4. My transactional object was Transactions = Supported rather than Required etc., don’t know if that matters.
5. Does creating an instance of a ‘hardcoded’ object type (the above is dynamic) have the same effect?

Cheers

James

Leave a comment

Your comment