Skip to content

Conversation

Skarsnik
Copy link

@Skarsnik Skarsnik commented Oct 5, 2025

For some reason, changing this code to this makes it stop crashing when writing to the console from another thread. The value from _lines.Count was not the same in virtualListView1.VirtualListSize, maybe write to VirtuListSize are delayed?

dev build for branch | USERNAME:BRANCHNAME

Prevent crashs when writing in the console from multiple threads.

Check if completed:

For some reason, changing this code to this makes it stop crashing when writing to the console from another thread.
The value from `_lines.Count` was not the same in `virtualListView1.VirtualListSize`, maybe write to VirtuListSize are delayed?
@YoshiRulz
Copy link
Member

What pattern were you using that wasn't working with the log window? Something like new Thread(() => Console.WriteLine(...)).Start();?

@Skarsnik
Copy link
Author

Skarsnik commented Oct 5, 2025

I have an external tool that does network stuff in its own thread. The main thread and the network thread both do some Console.Writeln().
I think my issue compared to #2694 is that I do a lot of multiline output (for example, in https://github.com/Skarsnik/Bizhawk-nwa-tool/blob/master/src/NWAServer.cs#L118 ) and if I remember correctly (sorry, I fixed this like over 6 months ago?) both _lines.Count and virtualListView1.VirtualListSize were not the same despiste the asignation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants