0

AllJoyn Crashing in WPF/XNA application

asked 2014-06-04 04:48:17 -0700

anonymous user

Anonymous

updated 2014-06-04 04:52:42 -0700

Hi all,

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,

Lubos

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2014-06-06 14:08:44 -0700

bspencer gravatar image

updated 2014-07-14 18:05:29 -0700

Odds are the issue is due to the library being C# for Unity and not traditional C# for windows development. Would need to investigate further the root cause the problem, but we do not offer a C# windows language binding at this time.

Just to check, when you compiled the C# unity project (alljoyn_unity) did you edit the file AllJoyn.cs inside the StartAllJoynCallbackProcessing() to have 0 passed into the alljoyn_unity_set_deferred_callback_mainthread_only method? So for Android it needs to be:

        alljoyn_unity_set_deferred_callback_mainthread_only(1); //FOR ANDROID THIS NEEDS TO BE SET TO 1 INSTEAD OF 0

But for windows it should be:

        alljoyn_unity_set_deferred_callback_mainthread_only(0); //FOR ANDROID THIS NEEDS TO BE SET TO 1 INSTEAD OF 0

Just a random thought as that might be the problem you have on windows.

edit flag offensive delete publish link more
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2014-06-04 04:48:17 -0700

Seen: 551 times

Last updated: Jul 14 '14