TheOnionMaster TheOnionMaster - 1 month ago 5
C# Question

Program only works correctly in debug mode

Here is my previous question, if you want some further information regarding my current problem:

WinForm: Inherited Panel wont Autosize

If you don't want to read through it, I'll give you some general information:

  • I'm not working directly via the programme, I'm just editing a specific DLL, that is used by this programme

  • That means, that I don't have any access to the source code of this specific programme

  • That also means that I have to fix this problem via some changes in the DLL, that is - as I mentioned before - used by this programme.

What I found out so far:

  • It works without any problems, if I attach the programme to the DLL's source code in VS2015.

  • But it has some glitches if I build the code and then copy the DLL into the programme's folder - that's also my actual problem: it somehow shrinks the tableLayoutpanel to half its actual size and I get some weird glitches in the other half of its actual, in normal start somehow not used, size.

What I tried out:

  • I changed the size manually, not via
    "Dock = Fill" or "Autosize = true"
    and it worked. But that's, as you all may know, not the best solution and we only want to use it, if there is absolutely no other way around it. No one likes to hard-code.

  • I tried to inherit its Parent's Size via:

    this.tablelayoutPanel.Size = this.Size;


    this.tableLayoutPanel.Size = new Size(this.Height, this.Size);

So do you guys have any ideas?


Okay, I did not figured out why the debuger worked and the release/debug build not. But I just forced a redraw on the tableLayoutPanelMainwith with Application.DoEvents(). I never tried this out before, because Invalidate() + Update() or Refresh() did not work - I was like: okay, that wont be that easy, so just forget about that.

But after some trial & error and a lot of time...well, I was working for two weeks on it...I tried the simpliest thing out and YEAHY, it worked!

Anyways, thank you for your help, guys. I appreciate that.