The followiing code produces this error:
Unhandled exception has occurred in a lcomponent in your application. If you click continue, the application will ignore this error and attempt to continue.
Error binding to target method.
With the following:
************** Exception Text **************
System.ArgumentException: Error binding to target method.
at System.Delegate.CreateDelegate(Type type, Object firstArgument, MethodInfo method, Boolean throwOnBindFailure)
at System.Delegate.CreateDelegate(Type type, Object firstArgument, MethodInfo method)
at AcMgCommandClass.InvokeWorker(AcMgCommandClass* , MethodInfo mi, Object commandObject, Boolean bLispFunction)
at AcMgCommandClass.InvokeWorkerWithExceptionFilter(AcMgCommandClass* , MethodInfo mi, Object commandObject, Boolean bLispFunction)
at AcMgPerDocumentCommandClass.Invoke(AcMgPerDocumentCommandClass* , gcroot<System::Reflection::MethodInfo ^>* mi, Boolean bLispFunction)
at AcMgCommandClass.CommandThunk.Invoke(CommandThunk* )
This from VS2005 express.
Any suggestions?
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Geometry
Imports Autodesk.AutoCAD.Colors
Public Class MKWCommands
' Define command 'Asdkcmd1'
<CommandMethod("Create")> _
Public Function Create()
Dim Circle As Circle
Dim btr As BlockTableRecord
Dim bt As BlockTable
Dim db As Database = HostApplicationServices.WorkingDatabase
Dim oColor As New Color
Dim trans As Transaction
trans = db.TransactionManager.StartTransaction()
Circle = New Circle(New Point3d(10, 10, 0), Vector3d.ZAxis, 2.0)
bt = trans.GetObject(db.BlockTableId, OpenMode.ForRead)
Dim btrId As ObjectId = bt.Item(BlockTableRecord.ModelSpace)
btr = trans.GetObject(btrId, OpenMode.ForWrite)
btr.AppendEntity(Circle)
trans.AddNewlyCreatedDBObject(Circle, True)
trans.Commit()
trans.Dispose()
End Function
End Class