terrymacdonald / DisplayMagician

DisplayMagician is an open source tool for automatically configuring your displays and sound for a game or application from a single Windows Shortcut.
https://displaymagician.littlebitbig.com
GNU General Public License v3.0
456 stars 19 forks source link

Unhandled Exception when saving Display Profile first time #257

Closed MrGarrettSmith closed 1 month ago

MrGarrettSmith commented 1 year ago

Upon first time installation of DisplayMagician version 2.5.0, an unhandled exception occurs and I am unable to save a Display profile, as this message occurs each time.

Let me know if there is anything else needed from me to help resolve this issue.

Thank you.

DisplayMagician-Support-20230927-1158.zip Unhandled Exception.txt Screenshot 2023-09-27 120235

terrymacdonald commented 10 months ago

Hi @MrGarrettSmith ,

Do you have .Net Framework 4.8.1 installed? This could happen if that framework isn't installed. You can download and install it from microsoft here: https://dotnet.microsoft.com/en-us/download/dotnet-framework/thank-you/net481-web-installer

If this doesn't fix the issue then please drop a note here and we can do some more troubleshooting.

Thanks Terry

terrymacdonald commented 10 months ago

Hi @MrGarrettSmith,

After a bit more research I actually think this error is due to the bug I recently found in DisplayMagician v2.5.0, where it incorrectly misses some windows in some configurations of multi-GPU laptops. Was your device you ran this on a gaming laptop? Or a machine that has multiple different video cards in it?

I think this could be fixed with my upcoming release of DisplayMagician v2.6.0, so I will paste a test version here in the next few days for you to test.

Thanks Terry

MrGarrettSmith commented 10 months ago

It is a custom desktop build. CPU: i7-6700K GPU: GTX 1080 mini

I'll try the suggestions, thank you for replying!

terrymacdonald commented 10 months ago

Hmm, that's interesting. Trading may still throw a curveball, but will cross that road when we get there.

Terry

On Sat, 13 Jan 2024, 14:36 Garrett Smith, @.***> wrote:

It is a custom desktop build. CPU: i7-6700K GPU: GTX 1080 mini

— Reply to this email directly, view it on GitHub https://github.com/terrymacdonald/DisplayMagician/issues/257#issuecomment-1890239461, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLU5LDKSCJMAA736DKRDOLYOHQJZAVCNFSM6AAAAAA5J2J3QSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJQGIZTSNBWGE . You are receiving this because you were assigned.Message ID: @.***>

terrymacdonald commented 10 months ago

@MrGarrettSmith I've created a new test version of DisplayMagician that may fix the issue that you're experiencing, and I've attached it to this Github issue. Please download the attached zip file, extract the msi installer from the zip file, and then run the installer. It should upgrade your existing Display Profiles.

DisplayMagicianSetup-v2.6.0.446.zip

This new version of DisplayMagician has the ability to 'update' Display Profiles - effectively overwriting the display layout with the one that is currently being used. So if you start If you still start having issues with a Display Profile not working, simply:

Your DisplayMagician Display Profile will now be recreated using the current display settings, and they will overwrite the old settings. This will hopefully get rid of any display layout issues, and it doesn't require any changes to your Game Shortcuts. Nice!

There is a single known issue at the moment, which is that the NVIDIALibrary SetDisplayConfig function doesn't work for NVIDIA video cards. Luckily this issue shouldn't have much impact at all as the WindowsLibrary functions should do enough configuration of their own to ensure it all works. If you have some special NVIDIA settings that you use then this version of DisplayMagician may not apply them correctly. You will unfortunately just have to test if that is the case for your particular setup.

I am currently troubleshooting the NVIDIALibrary SetDisplayConfig function error but it looks like it could be a bit of a pain to fix, so I didn't want to hold up the test release; I'd rather get the test version into your hands so I can see what other bugs are in there!

If this fixes your issue please reply here, and if you find another bug please log a new Github issue so I can track them separately.

Thanks Terry

terrymacdonald commented 10 months ago

@MrGarrettSmith I did find some issues with the earlier v2.6.0.446 version. I've made a lot of revisions to how DisplayMagician works in v2.6.0.485 (attached) that should make it way more reliable. But it is highly likely you will need to 'update' your Display Profiles to make them work properly.

I'd recommend first of all applying a Display Profile, and then press the 'update' button. That will recreate the config for the Display Profile and should make it work properly. You'll need to do that to each of your saved Display Profiles. Then please test out changing between your Display Profiles to see if everything works as expected.

Here is the latest test version of DisplayMagician: DisplayMagicianSetup-v2.6.0.485.zip

Thanks for all your help testing.

Terry

terrymacdonald commented 10 months ago

@MrGarrettSmith, I've added in more checks and logic to avoid crashes. Could you please try this latest version? DisplayMagicianSetup-v2.6.0.508.zip

I'm hoping this will work, but at the very least it should allow DisplayMagician to boot up enough for you to create a Support ZIP File. Let's see whether I've fixed it 🤞.

terrymacdonald commented 9 months ago

@MrGarrettSmith The latest test version should be working properly, and hopefully fixes your issue. Could you please test it for me so I know that it fixes your issue? If it does then I'll be able to close this issue as the fix will be part of the next full release.

DisplayMagicianSetup-V2.6.0.515-No-NvApi_SetDisplayConfig.zip

As I've not really had any feedback from you recently I'll give it a week and then close this issue if I have no further responses. We can always reopen this issue in the future if need be.

Thanks!

terrymacdonald commented 9 months ago

@MrGarrettSmith Oops I broke the setup with my previous version. This version has a corrected setup that should install everything properly.

DisplayMagicianSetup-v2.6.0.522-corrected-setup.zip

Thanks Terry

MrGarrettSmith commented 9 months ago

@terrymacdonald Pardon my lack of responses! I will test your software this weekend! I miss it very much. Would it be alright for me to upgrade to Windows 11?

terrymacdonald commented 9 months ago

Yep. DisplayMagician is developed on win 11 so works with it fine.

On Fri, 16 Feb 2024, 07:18 Garrett Smith, @.***> wrote:

@terrymacdonald https://github.com/terrymacdonald Pardon my lack of responses! I will test your software this weekend! I miss it very much. Would it be alright for me to upgrade to Windows 11?

— Reply to this email directly, view it on GitHub https://github.com/terrymacdonald/DisplayMagician/issues/257#issuecomment-1946844842, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLU5LCKYCZWPJ6VBH54VVLYTZGONAVCNFSM6AAAAAA5J2J3QSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBWHA2DIOBUGI . You are receiving this because you were mentioned.Message ID: @.***>

Grizzler89 commented 9 months ago

@terrymacdonald I have the same error. Your posted versions didn't work for me. They didn't start. No error messages.

The Errormessage thrown by 2.5.0 seems to be the same as the authors one: System.ArgumentException: Parameter is not valid. at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format) at DisplayMagicianShared.ProfileIcon.ToTightestBitmap(PixelFormat format) at DisplayMagicianShared.ProfileItem.get_ProfileTightestBitmap() at DisplayMagician.UIForms.DisplayProfileForm.btn_save_as_Click(Object sender, EventArgs e) at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

My Setup is diffrent form MrGarrettSmith. I'm using an Lenovo Thinkpad X260 (i5-6300U with IntelGraphics). One Display is connected via HDMI, one via DP. Four Displays are connected via two DisplayLink USB-Adapters. So including the Laptops own Display there are seven in total. OS is Windows 11 Enterprise.

The same Setup with 2xDP and 4x USB-DisplayLink works fine using DisplayMagician on my Desktop PC. (Win11, AMD Ryzen 3900X, Nvidia 980 TI).

terrymacdonald commented 9 months ago

Ok @Grizzler89,

Can you please log this as a new issue? I think there is a bit to get through here and I think it needs to be done under a new issue so I can track it without getting mixed up with this issue.

Thanks Terry

On Mon, 26 Feb 2024, 21:28 Grizzler89, @.***> wrote:

@terrymacdonald https://github.com/terrymacdonald I have the same error. Your posted versions didn't work for me. They didn't start. No error messages.

The Errormessage thrown by 2.5.0 seems to be the same as the authors one: System.ArgumentException: Parameter is not valid. at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format) at DisplayMagicianShared.ProfileIcon.ToTightestBitmap(PixelFormat format) at DisplayMagicianShared.ProfileItem.get_ProfileTightestBitmap() at DisplayMagician.UIForms.DisplayProfileForm.btn_save_as_Click(Object sender, EventArgs e) at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

My Setup is diffrent form MrGarrettSmith. I'm using an Lenovo Thinkpad X260 (i5-6300U with IntelGraphics). One Display is connected via HDMI, one via DP. Four Displays are connected via two DisplayLink USB-Adapters. So including the Laptops own Display there are seven in total. OS is Windows 11 Enterprise.

The same Setup with 2xDP and 4x USB-DisplayLink works fine using DisplayMagician on my Desktop PC. (Win11, AMD Ryzen 3900X, Nvidia 980 TI).

— Reply to this email directly, view it on GitHub https://github.com/terrymacdonald/DisplayMagician/issues/257#issuecomment-1963563781, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLU5LEUKY56TFXALZTXPDLYVRBR3AVCNFSM6AAAAAA5J2J3QSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRTGU3DGNZYGE . You are receiving this because you were mentioned.Message ID: @.***>

MrGarrettSmith commented 7 months ago

Yep. DisplayMagician is developed on win 11 so works with it fine. On Fri, 16 Feb 2024, 07:18 Garrett Smith, @.> wrote: @terrymacdonald https://github.com/terrymacdonald Pardon my lack of responses! I will test your software this weekend! I miss it very much. Would it be alright for me to upgrade to Windows 11? — Reply to this email directly, view it on GitHub <#257 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLU5LCKYCZWPJ6VBH54VVLYTZGONAVCNFSM6AAAAAA5J2J3QSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBWHA2DIOBUGI . You are receiving this because you were mentioned.Message ID: @.>

Terry,

I just wanted to let you know that I have no issues on Windows 11 for my installation! I am terribly sorry for being so slow getting back to you.

Please know that I absolutely LOVE this software. Switching to Nvidia Surround mode so easily is frickin' SWEET!

Let me know if there is anything else I can do for you.

terrymacdonald commented 4 months ago

Hi All,

Time for an update.

The fix is in the code and works (also we now support 3rd apps and games added to Steam library too!) but my current hold up is actually in the packaging of the application into a windows installer. I've been testing different ways to do this as the move from .net framework 4.8.1 to .net core 8.0.0 has been a massive change. It has resulted in a completely different set of binaries and dlls and other files being created, as well as a different build process too. This is all taking some time to figure out.

I've gone from a WIXv3 based installer to a windows default installer to an NSIS installer then back to a WIXv4 installer all within the last month. It's necessitated me building a brand new way of handling the desktop background context menu, and even down to which libraries are used within the application. It's been a ton of work.

I'm now down to the last few bugs to iron out, and to finish the new packaging process. I think I should have something ready for everyone to test within the next month (assuming there aren't anymore show stoppers.

My goal is to then send out messages through this issues list to get you all to test some DM v2.6.0 test builds, and then once the major bugs are ironed out I will push out the DM v2.6.0 beta to those users who opted in the beta builds. And then I'll finally push the DM v2.6.0 update to the main user group.

Lastly, I've decided to hold back the NVIDIALibrary update for now until DM v2.7.0 as it requires a LOT more work testing and troubleshooting many errors. The Steam beta client changing file structures has forced my hand here a little bit, so a better NVIDIALibrary will just have to wait for now.

Thanks Terry

terrymacdonald commented 2 months ago

Hi!

This may be fixed by the brand new version of DisplayMagician I just released. I would suggest that you try to the new DisplayMagician v2.7.0-alpha.1 test build available here: https://github.com/terrymacdonald/DisplayMagician/releases/tag/v2.7.0-alpha.1

It should fix your problem, but it may also cause other problems instead. This version has had a complete backend change, new installer, new features, and so it may have some bugs that need squashing.

Please test it out. and if you find any new problems please log a new issue. If it fixes this issue then please update this issue to tell me and then close this issue (it helps me keep track of what I've still got to fix).

Thanks Terry

terrymacdonald commented 1 month ago

ok I believe this is fixed now in the latest alpha, so I will go ahead and close this issue for now. Please feel free to reopen it if you still have the issue after testing it.

Thanks Terry