Author Topic: Help debugging some problem  (Read 5118 times)

hammerpiano

  • Newbie
  • *
  • Posts: 2
Help debugging some problem
« on: October 13, 2019, 02:11:19 AM »
Hi,
I am trying to make a plugin for Elite Dangerous. The plugin is an expedition assistant. It loads a csv file, with planets names, and tells what planets to scan and in which system. It has 5 commands:
1. Init - read csv
2. Start - say first system
3. Next system - iterate through systems
4. Abort - aborts the expedition
5. repeat planets - repeats which planets to scan

For some reason, voiceattack crashes after running "Next System" command. VoiceAttack generated one log file, and then stopped generating files. When it crashes, I don't see any error messages, logs or whatever, it just closes.

Here is the log file:
Code: [Select]
2019-10-12 16:01:49***************************************************************************************

2019-10-12 16:01:49***************************************************************************************
System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.
   at System.Threading.Thread.SleepInternal(Int32 millisecondsTimeout)
   at System.Threading.Thread.Sleep(Int32 millisecondsTimeout)
   at VoiceAttack.frmMain.(Command2 , Process , Boolean , Boolean , Int32 , Boolean , Nullable`1 , Guid , Guid , List`1 )
   at VoiceAttack.frmMain.‚.()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

I tried surronding the contents of the function VA_Invoke1, but VoiceAttack still crashes.


Link to the repository:
https://github.com/HammerPiano/R2R_Assistant

There is a test profile I use, and the csv file. In the "init" command, set the variable path to the path of the csv.
I run the following order of commands:
1. init
2. start
3. next system (run until it finishes)

Is this a bug in my code that I can't find?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Help debugging some problem
« Reply #1 on: October 13, 2019, 03:25:09 AM »
The exception text indicates the issue is within unmanaged code.

If I were you I'd use the System.Windows.Forms.Clipboard class, instead of using P/Invoke to call unmanaged methods.

hammerpiano

  • Newbie
  • *
  • Posts: 2
Re: Help debugging some problem
« Reply #2 on: October 13, 2019, 04:19:05 AM »
When I removed the copy to clipboard part, the crashing stopped, so thats nice.
When I used the Clipboard class, I had crashes stating that I need to use STA thread. So now I create one, to do the copying, and it works without problems.
I pushed the fix to the repository.

Thanks for the help!