wimpos

Hello

I wrote an application for a HTC PDA Pocket PC Windows Mobile 5.0 to make phonecalls.
Usin P/invoke I call the native methodes lineOpen, LineMakeCall, etc.

In fact it is a bit of a translation of the CEdialer C++ (example code included in the WM5.0 SDK) into C#

The application works fine, I'm able to make phonecalls.

BUT:

the function lineInitialize has a callback function. Every time something changes on te line (ringing, accepted, busy,...) this callback function is executed.

The problem is that the only thing that I can do in that callback function is fire a messagebox. All the other things (changing a label, placing a breakpoint) cause VS2005 to crash.


Does anyone has a clue what is going on

If you need more info, please don't hesitate to ask

Kind regards


Re: .NET Compact Framework callbackfunction causes VS2005 to crash (tapi)

Sergey Kuryata

First of all, please make sure you keep a reference to the delegate that you pass into liniInitialize as a callback function (make sure it is not a local variable).

It also seems that the callback function is executed on a separate thread (not on the main GUI thread). If that is the case, you cannot access properties of your controls from it. Please try using Control.Invoke() to change properties of Winforms controls.

Thank you,

Sergey.





Re: .NET Compact Framework callbackfunction causes VS2005 to crash (tapi)

wimpos

this is all true, but normally I would expect VS2005 to give a warning (crossthread, ...)
but it actually crashes...




Re: .NET Compact Framework callbackfunction causes VS2005 to crash (tapi)

Ilya Tumanov

What do you mean by ¡°it crashes¡± What is ¡°it¡± Also there's no warning for illegal cross thread operations, just an exception at runtime which is up to you to fix.






Re: .NET Compact Framework callbackfunction causes VS2005 to crash (tapi)

wimpos

"it crashes" means it shuts down,
when i deploy my application VS2005 shuts down giving me this error:

Microsoft Visual Studio has encountered a problem and needs to close


I used invoke to interact with GUI components, but breakpoints makes VS stop






Re: .NET Compact Framework callbackfunction causes VS2005 to crash (tapi)

Ilya Tumanov

So "it" is VS itself, not NETCF or your application. That means it's unlikely the way you interact with UI is the reason for that as VS does not really care what you do in your application.

Can you run your application without VS Have you tried repairing VS and installing latest NETCF V2 SP2