the error message is reported by the memory manager. Evidently the heap is corrupted. Try to clarify following questions:
1. Which EmWi version are you using?
2. Are you using your own HW or an evaluation/dicovery board? Eventually, the RAM configuration is incorrect causing the RAM contents to be lost.
3. If you comment out the above C code section to call the UpdateString() method, does the error still occur? If yes, it is not related to this code.
4. Are you using an operating system? If yes, have you ensured to not execute EmWi code in context of a foreign thread? EmWi code is not thread safe Call EmWi code always in context of the thread, which initialized and drive the GUI.
5. How do you obtain access to the device object (how you initialize the variable DeviceObject)?
6. The variable DeviceObject, does it store the reference to the object permanently? If yes, the EmWi Garbage Collector does not know anything about it. As soon as the object is not used in the GUI application, it is released leaving your variable initialized with an outdated reference. Accessing it may currupt the heap. The best is to not store references to EmWi objects in C code.
7. Do you have another (your own) C code linked together with the application? Try to narrow down the possible heap corruption by commenting out your code blocks.
Hope it helps you to narrow down the problem.