I’m new to alljoyn and I’m trying to build a win desktop application that would serve as a AllJoyn server and other apps (mostly mobile) would connect to the server. I studied the framework and I did successfully developed a prototype of two console applications (client-server) and I even tested mobile client with the server (server as console application). Everything works smoothly in this scenario.
I mostly develop with C# so I used the unity interface (alljoyn_unity.dll) in my console app and the server is a C# console application.
I tried to move my nice and well tested framework to a WPF application but there I have a problem. I can run the server as it was possible previously and the server successfully starts and is waiting for clients. But whenever a client connects to the server it crashes my app with an Access violation exception. Since this happens inside the native library at the point when the client connects, I think it’s somehow a problem of the library.
I set up a development env. and built the alljoyn myself. There I found out that it crashes in BusAttachment.cc at line 2053 (in the method BusAttachment::Internal::CallAcceptListeners(SessionPort sessionPort, const char* joiner, const SessionOpts& opts)) when it does:
isAccepted = (*listener)->AcceptSessionJoiner(sessionPort, joiner, opts);
This is a stack trace for more details:
0cfd4538() alljoyn_unity_native.dll!ajn::AllJoynPeerObj::AcceptSession(const ajn::InterfaceDescription::Member * member, qcc::ManagedObj<ajn::_Message> & msg) Line 1560 + 0x39 bytes C++ alljoyn_unity_native.dll!ajn::BusObject::CallMethodHandler(void (const ajn::InterfaceDescription::Member *, qcc::ManagedObj<ajn::_Message> &)* handler, const ajn::InterfaceDescription::Member * member, qcc::ManagedObj<ajn::_Message> & message, void * context) Line 665 C++ alljoyn_unity_native.dll!ajn::_LocalEndpoint::HandleMethodCall(qcc::ManagedObj<ajn::_Message> & message) Line 916 C++ alljoyn_unity_native.dll!ajn::_LocalEndpoint::DoPushMessage(qcc::ManagedObj<ajn::_Message> & message) Line 470 + 0xc bytes C++ alljoyn_unity_native.dll!ajn::_LocalEndpoint::Dispatcher::AlarmTriggered(const qcc::ManagedObj<qcc::_Alarm> & alarm, QStatus reason) Line 430 + 0xf bytes C++ alljoyn_unity_native.dll!qcc::TimerThread::Run(void * arg) Line 787 C++ alljoyn_unity_native.dll!qcc::Thread::RunInternal(void * threadArg) Line 224 + 0x18 bytes C++
Did anybody experienced similar problem? Could you please give me some hints where might be the problem or how to overcome it?
The strange fact is that in console app it works, but not in the WPF. Even the simplest WPF app with one button crashes. The library is compiled for: Win7, x86, VS2010.
Thank you for any help,