version:
Visual studio 2022, solidworks2019, Xcad.solidworks 0.8.0-beta.4627, .net 6, win10 system
error message:
System.Reflection.TargetInvocationException:“Exception has been thrown by the target of an invocation.”
InvalidCastException: [A]System.Drawing.Bitmap cannot be cast to [B]System.Drawing.Bitmap. Type A originates from 'System.Drawing.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' in the context 'Default' at location 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\6.0.16\System.Drawing.Common.dll'. Type B originates from 'System.Drawing.Common, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' in the context 'Default' at location 'D:\ClassLibrary1\bin\Debug\net6.0-windows7.0\runtimes\win\lib\net6.0\System.Drawing.Common.dll'.
occur on code line:
var cmd_Grp = this.CommandManager.AddCommandGroup();
what I have done
Add icon to my command. When I delete the "[Icon(typeof(Resource1), nameof(Resource1.Database))] ", the error did not happen.
Upgrade frame to .net 7.0 resolved this problem. Have tried a lot of methods, including add assemblyBinding to the app.config file not worked. Quite a annoying problem in .net application.
version: Visual studio 2022, solidworks2019, Xcad.solidworks 0.8.0-beta.4627, .net 6, win10 system error message: System.Reflection.TargetInvocationException:“Exception has been thrown by the target of an invocation.” InvalidCastException: [A]System.Drawing.Bitmap cannot be cast to [B]System.Drawing.Bitmap. Type A originates from 'System.Drawing.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' in the context 'Default' at location 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\6.0.16\System.Drawing.Common.dll'. Type B originates from 'System.Drawing.Common, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' in the context 'Default' at location 'D:\ClassLibrary1\bin\Debug\net6.0-windows7.0\runtimes\win\lib\net6.0\System.Drawing.Common.dll'. occur on code line: var cmd_Grp = this.CommandManager.AddCommandGroup();
what I have done
Add icon to my command. When I delete the "[Icon(typeof(Resource1), nameof(Resource1.Database))] ", the error did not happen.