Save up to 50% off any of our desktop apps in our 2021 spring sale, including
DisplayFusion, ClipboardFusion, FileSeek, LogFusion, TrayStatus, and VoiceBot!

Title

Message

Confirm

<< DiscussionsReply

Function refers to Bitmap not working

NetMage
255 discussion posts
I have a function that stopped working recently and I just realized it.

It uses System.Drawing.Bitmap and has references to System.Drawing.dll and using System.Drawing and using System.Drawing.Imaging.

DF says it is forwarding Bitmap to System.Drawing.Common, which is a .Net Core extension package (I have .Net Core 3.1 with add-ons installed).

Has something changed in recent versions causing DF to try to use .Net Core packages?

DF 9.7 beta 14
Windows 10 v1909
May 23, 2020 (modified May 23, 2020)  • #1
Keith Lammers (BFS)'s profile on WallpaperFusion.com
I think there were some backend changes to the scripting but I'm not 100% sure on what they all entailed. I will pass this over to our devs to get some input here.

Thanks!
May 26, 2020  • #2
Jon Tackabury (BFS)'s profile on WallpaperFusion.com
Would you be able to post the script you're having issues with, along with your references list? Thanks!
May 27, 2020  • #3
NetMage
255 discussion posts
The Scripted Function Gaussian Lock is the one that is failing.

(Note: My version is two functions, one calls the other and then locks the screen, so I can update the bitmap on a idle time schedule just before the computer locks due to idle time.)

References:

System.Core.dll|System.Data.dll|System.dll|System.Drawing.dll|System.Management.dll|System.Web.dll|System.Windows.Forms.dll|System.Xml.dll
May 27, 2020 (modified May 27, 2020)  • #4
NetMage
255 discussion posts
I hoped Beta 16 would resolve this issue, but I still see the same error on trying to Verify Code?
Jun 9, 2020  • #5
Keith Lammers (BFS)'s profile on WallpaperFusion.com
It was supposed to be fixed in B16! I'll re-open the ticket and we'll have another look at it.

Thanks!
Jun 9, 2020  • #6
Jon Tackabury (BFS)'s profile on WallpaperFusion.com
If you just download the "Gaussian Lock" scripted function and click "Verify Code" does it fail for you? Doing that seems to be working fine in testing, can you confirm that it works or doesn't work for you? Can you post the exact message you're receiving as well if the error continues? Thanks!
Jun 10, 2020  • #7
Jon Tackabury (BFS)'s profile on WallpaperFusion.com
Can you post the exported scripted function that is failing to verify for you? You can do this by selecting the script in Functions list and clicking the "Scripted Functions" button then "Export". Thanks!
Jun 10, 2020  • #8
serch037
2 discussion posts
I'm facing an issue which seems similar when running the script from
https://www.displayfusion.com/ScriptedFunctions/View/?ID=dd88a3f2-f17d-4cff-9db0-a03a8f9a2064

However, in this case, the error is:

Code

Jun 11, 2020  • #9
Keith Lammers (BFS)'s profile on WallpaperFusion.com
I can't seem to reproduce this here, even with .NET Core 3.1 installed. Do you guys also have .NET 4.6.2 or higher installed?
Jun 11, 2020  • #10
NetMage
255 discussion posts
Yes, I have 4.8.03752 installed as well as .Net Core 3.1.300 and VS 2019.

Note this code has been working fine for me until an update.
Jun 11, 2020 (modified Jun 11, 2020)  • #11
NetMage
255 discussion posts
My function is attached.

I downloaded the Gaussian Lock function and hit Verify Code. This was the result:

44: The type name 'Bitmap' could not be found. This type has been forwarded to assembly 'System.Drawing.Common, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Consider adding a reference to that assembly.
67: The type name 'Bitmap' could not be found. This type has been forwarded to assembly 'System.Drawing.Common, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Consider adding a reference to that assembly.
188: The type name 'Bitmap' could not be found. This type has been forwarded to assembly 'System.Drawing.Common, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Consider adding a reference to that assembly.
188: The type name 'Bitmap' could not be found. This type has been forwarded to assembly 'System.Drawing.Common, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Consider adding a reference to that assembly.
0: Error: Compile failed.
[System.Exception]
• Attachment: GuassianLockUpdate.dfscript [8,071 bytes]
Jun 11, 2020  • #12
serch037
2 discussion posts
After trying serveral things out, I finally tracked down the issue.

It seems that when getting asking for common assembiles, Windows prioritized the ones bundled with Powershell 7.0 (maybe versions 6.x as well) instead of the ones included by .Net framework itself. But by design they do not always behave in the same way https://github.com/dotnet/runtime/issues/29823, particularly with WinForms. There are also several open issues related to the TypeHandler in net core 3.x which may be related.

Maybe a possible fix is fiddling around with the TargetFramework attribute and/or the assembly conversions to force referencing the correct assemblies.

However, the quickest way to solve the issue is to simply uninstall Powershell 7.0.x (6.x), this allows both scripts to compile.

The following issues were also resolved:
- Slow Settings UI
- Visual Basic scripting being completely broken

As a sidenote, I tried the latest 7.0.2 release but the issue persisted. However, after upgrading to 7.1 preview, which is based on .Net 5 (both include fixes regarding references and the TypeHandler), everything kept working ok.
Jun 12, 2020  • #13
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Good find! We were able to reproduce this here now as well, and we should be able to fix it up for the next beta.
Jun 12, 2020  • #14
NetMage
255 discussion posts
I can confirm the latest beta has fixed this issue for me.
Jun 15, 2020  • #15
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Glad to hear it, thanks for the help tracking this down!
Jun 16, 2020  • #16
Was this helpful?    
<< DiscussionsReply