FriendsOfCADability/CADability

Exception during design of CadCanvas control

johnnyontheweb opened this issue · 3 comments

Hello,
I'm trying to using CadCanvas control in a Winform app. During design, devEnv.exe is often terminated by this error:
Cannot find method 'Void CADability.IPaintTo3D.PrepareIcon(System.Drawing.Bitmap)'.
System.MissingMethodException

stacktrace:
in CADability.Forms.CadCanvas.Dispose(Boolean disposing)
in System.ComponentModel.Component.Finalize() in System.ComponentModel\Component.cs: riga 85

I discovered this with another instance of devEnv attached for debugging the main one. I'm using GDI2view.
Any clue?

dsn27 commented

I'm sorry I have never seen this error before. But also never use PaintToGDI.
Any chance you can provide a small sample project to reproduce this error?

Hello, thanks for replying. It's a simple Winform project with a CadControl in it. The code to initialize the view is:

        Dim cadFrame = New CadFrame(CadCanvas1, Me)
        Dim proj = cadFrame.Project
        Dim newGDIView As New GDI2DView(proj, proj.GetActiveModel, cadFrame)
        proj.GdiViews.Add(newGDIView)
        cadFrame.ActiveView = newGDIView

I believe that's all.
I often get the exception reported (System.MissingMethodException) expecially when opening the form in Visual Studio form designer.

dsn27 commented

After some trying I can now reproduce this error.
Mine is a little bit different:

I just need to open MainForm.cs in the Visual Studio designer.
grafik

Visual Studio sometimes crashes.
Eventlog:

System.MissingMethodException
   at CADability.Forms.CadCanvas.Dispose(Boolean)
   at System.ComponentModel.Component.Finalize()

This doesn't happen if you open the CadForm from CADability.Forms.

I used Fuslogvw to try to get more information:


=== Pre-bind state information ===
LOG: DisplayName = CADability.Forms, Version=1.0.0.0, Culture=neutral, PublicKeyToken=62ba9c16fd2eecf7
 (Fully-specified)
LOG: Appbase = file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = devenv.exe
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\UserName\AppData\Local\Microsoft\VisualStudio\17.0_429554e8\devenv.exe.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: CADability.Forms, Version=1.0.0.0, Culture=neutral, PublicKeyToken=62ba9c16fd2eecf7
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/CADability.Forms.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/CADability.Forms/CADability.Forms.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/PublicAssemblies/CADability.Forms.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/PublicAssemblies/CADability.Forms/CADability.Forms.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/PrivateAssemblies/CADability.Forms.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/PrivateAssemblies/CADability.Forms/CADability.Forms.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/CommonExtensions/Microsoft/TestWindow/CADability.Forms.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/CommonExtensions/Microsoft/TestWindow/CADability.Forms/CADability.Forms.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/CommonExtensions/Platform/Debugger/CADability.Forms.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/CommonExtensions/Platform/Debugger/CADability.Forms/CADability.Forms.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/PrivateAssemblies/DataCollectors/CADability.Forms.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/PrivateAssemblies/DataCollectors/CADability.Forms/CADability.Forms.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/PrivateAssemblies/DataCollectors/x64/CADability.Forms.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/PrivateAssemblies/DataCollectors/x64/CADability.Forms/CADability.Forms.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/CADability.Forms.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/CADability.Forms/CADability.Forms.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/PublicAssemblies/CADability.Forms.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/PublicAssemblies/CADability.Forms/CADability.Forms.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/PrivateAssemblies/CADability.Forms.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/PrivateAssemblies/CADability.Forms/CADability.Forms.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/CommonExtensions/Microsoft/TestWindow/CADability.Forms.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/CommonExtensions/Microsoft/TestWindow/CADability.Forms/CADability.Forms.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/CommonExtensions/Platform/Debugger/CADability.Forms.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/CommonExtensions/Platform/Debugger/CADability.Forms/CADability.Forms.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/PrivateAssemblies/DataCollectors/CADability.Forms.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/PrivateAssemblies/DataCollectors/CADability.Forms/CADability.Forms.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/PrivateAssemblies/DataCollectors/x64/CADability.Forms.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/PrivateAssemblies/DataCollectors/x64/CADability.Forms/CADability.Forms.EXE.
LOG: All probing URLs attempted and failed.

I'm not sure why Visual Studio is searching in these places for the DLL. But even installing CADability.Forms.dll and CADability.dll into the GAC does not help.
The error in Fuslogvw goes away but the error in Visual Studio stays the same.

Any ideas would be welcome.