digitalcreations / MaxTo

Public issue tracker for MaxTo
https://docs.maxto.net
77 stars 5 forks source link

MaxTo 2.1.0-alpha2 "use regions" is without effect (MaxTo not working) #519

Closed thewavelength closed 4 years ago

thewavelength commented 4 years ago

Describe the bug Applying a region seems to work in the region selector but won't really be active when config.json exists. Everything is written correctly to the config files. Still windows will not snap into regions and can't be moved even with the default hotkeys. Applying a recipe with Highlight regions ingredient shows only one big region covering the whole screen, doesn't matter which preset I have loaded. After closing and reopening MaxTo, the region select still shows the correct loaded preset. It seems like something internally doesn't care about what the region selector thinks is active.

To Reproduce Steps to reproduce the behavior:

  1. Fresh install MaxTo 2.1.0-alpha2 with removing old version (and config files) before
  2. Change some setting, doesn't matter which, just make sure config.json will be written (see #520)
  3. Stop and start MaxTo
  4. Try to use a region using the region selector, doesn't matter which
  5. Use Highlight regions ingredient on some recipe to show it didn't got effective, rendering only one big region covering the whole screen.

Expected behavior Should work.

System information:

Additional context MaxTo-clean.log 5KC0391L08TL.json.log

I tested this on two different machines with the same system configuration. Same behaviour. Worked well with the same system configuration in 2.0.1.

thewavelength commented 4 years ago

I figured out something interesting... This bug only occurs when config.json exists. Deleting it and restarting MaxTo will make it work as long as the process is running.

thewavelength commented 4 years ago

Something is really weird here. Doing the following:

  1. Start MaxTo without config.json present
  2. Load my preferred preset (Ultra-wide three-way)
  3. Change some setting to write the file
  4. Pasting my preferred content to config.json
  5. Use Highlight region

Results in: Highlight region ingredient only shows one big region even though MaxTo still works with three regions (and the region selector showing it as well) because I didn't start MaxTo when config.json was existing.

vegardlarsen commented 4 years ago

@thewavelength config.json doesn't actually store your active regions, those are stored in a subfolder called monitor, and saved in separate files per monitor. The file names vary based on the monitor identification you have selected. Are these files being saved with the correct region? (The file you attached has the "Quarters" preset saved)

I will try to investigate this, but having just this week set up a new ultrawide monitor myself, almost exactly in the manner you describe, MaxTo worked fine.

thewavelength commented 4 years ago

subfolder called monitor, and saved in separate files per monitor.

That's why I attached my monitor file :)

Are these files being saved with the correct region?

Yes, as soon as I click Use region the file is updated.

The file you attached has the "Quarters" preset saved

Yep, that's the last region I have used for testing.

MaxTo worked fine.

MaxTo 2.0.1 worked fine as well. But the 2.1.0-alpha2 doesn't. Something in there must have changed.

What makes me especially curious is why the same bug happens on two different systems.

Is there something more I can do to debug this? Would a video help? Or something else? I really want to use the 2.1.x version because of the Recipe triggers, but currently really can't.

My last idea what could be a big difference between my systems and your setup is the use of a debloat script for Windows 10. I'm using a modified configuration file for that script. Of course I know you can't investigate random scripts from the internet. As you developed MaxTo, maybe going quickly through the configuration file of that script would show you if some setting name/identifier there could affect the behaviour of MaxTo.

vegardlarsen commented 4 years ago

I am going to need some time trying to debug this. I don' think it is related to your script, however there could be a lot going on behind those seemingly simple commands, and investigating this would be quite difficult.

thewavelength commented 4 years ago

Using alpha3 does not fix the problem.

thewavelength commented 4 years ago

I discovered another behaviour: when opening the region selector and trying to click on the "Use regions" button, nothing happens. The button gets it's clicked state but the region selector stays open and the region is not applied. Only way to exit that windows is clicking "Cancel changes".

Sadly, I still didn't find the common source for these types of bugs.

Just for the record: 2.0.1 is still working fine.

vegardlarsen commented 4 years ago

This sounds very strange to me. Are you using any software or mouse drivers that could in any way disturb mouse clicks? Can you try to set focus to the button and pressing space bar or enter to see if it activates then?

thewavelength commented 4 years ago

I don't. Space or Enter doesn't do the trick, sadly. In 2.0.1, it also works with Space then.

thewavelength commented 4 years ago

I can debug .NET applications on my local machine. If you let me know which function it is I could set a breakpoint on the function which gets fired when I'm pressing the button "Use regions" or the function which should be fired when pressing a hotkey to select a region and try having a look.

vegardlarsen commented 4 years ago

I have determined what makes the button not respond. If the Core process of MaxTo is not running when you click the button, the UI process will wait for a response from the core process forever before closing the windows.

I will have to do multiple things here:

  1. Find out why the Core process crashed in the first place. There does not appear to be any corresponding entries in the log files.
  2. Make it so the windows are closed before we start waiting for that response.
  3. Fail other processes if the Core process is closed.
vegardlarsen commented 4 years ago

I am 99% sure that I found the cause of this issue. When connecting to a VPN (or other network status events), MaxTo would try to get the name of the network you connected to. MaxTo uses the network name to allow filtering the network triggers. This caused an access violation (I don't know why exactly), which would crash the MaxTo.Core process immediately, with just a trace in the logs saying the MaxTo.Server process lost contact with one of the other processes.

I have fixed this for beta.2 by dropping support for filtering on network names (you can still filter on adapter name).

Can you confirm that MaxTo.Core.exe is running immediately before a change in network status, and is no longer running a few seconds afterwards @thewavelength? That would give me greater confidence that I solved this issue.

Also, this is probably the same issue as #557.

thewavelength commented 4 years ago

Shall I download the latest beta somewhere or use alpha2?

Nevertheless I'd really wonder if this is the reason. I can't think of any network change when starting MaxTo after my system has been booted. I will still try, though it can take some days.

vegardlarsen commented 4 years ago

I haven't published the new beta yet, there are still some bugs I want to check out. However, if you can verify that MaxTo.Core.exe isn't running when this problem appears, that would go a long way.

thewavelength commented 4 years ago

I can confirm two different behaviours running alpha3.

Scenario 1 (first run since months)

  1. Start MaxTo.Core.exe in elevated mode
  2. Change a region, click "Use region"
  3. Region selector closes as expected and I'd expect that the regions have been set now (like described in the initial post of this issue)
  4. No region change seems to be active, no window is snapping to any region In this scenario I confirmed MaxTo.Core.exe is still running.

Scenario 2

  1. Start MaxTo.Core.exe in elevated mode
  2. Disable ethernet adapter
  3. MaxTo.Core.exe closes
  4. Trying to change a region and click "Use region" and the button has no effect

I tried it several times and more or less it seems to be a bit random when MaxTo.Core.exe is crashing. On my third try, it crashed without me changing my adapter settings. Maybe I didn't wait long enough and got a new IP assigned which is also considered a network event.

tl;dr: even in the scenario where MaxTo.Core.exe keeps running, no regions work as expected.

thewavelength commented 4 years ago

I tried it again with 2.1.0-beta1. I can confirm the network bug still persists but all the other weird behaviours seem to be fixed! This is great news to me. So, from my previous comment, Scenario 1 now works as expected.

vegardlarsen commented 4 years ago

OK, I believe that this issue is then resolved in 2.1.0-beta.2. :)