.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

My first .NET code with lots of errors, please need help.

22 REPLIES 22
Reply
Message 1 of 23
junoj
1645 Views, 22 Replies

My first .NET code with lots of errors, please need help.

Hi everyone,
I am having a difficult time understanding the errors that the .NET API is giving me. When I run my first code:

'---code--------------------------------------
Imports Autodesk.AutoCAD.Runtime

Public Class vbstudentClass

' Define command 'NewCmd1'
_
Public Sub NewCmd1()
MsgBox("NewCmd1")
' Type your code here

End Sub

End Class
'----Immediate Window--------------------------------------

System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='NaN' BindingExpression:Path=Source.MinimumWidth; DataItem='ToolBarControl' (Name=''); target element is 'ToolBarControl' (Name=''); target property is 'MinWidth' (type 'Double')
System.Windows.Data Error: 39 : BindingExpression path error: 'BackgroundOpacity' property not found on 'object' ''ContentPresenter' (Name='PART_CustomizeButtonInMainPanel')'. BindingExpression:Path=BackgroundOpacity; DataItem='ContentPresenter' (Name='PART_CustomizeButtonInMainPanel'); target element is 'SystemDropShadowChrome' (Name='Shdw'); target property is 'Opacity' (type 'Double')
System.Windows.Data Error: 39 : BindingExpression path error: 'Current' property not found on 'object' ''QuickAccessUndoControl' (HashCode=32115247)'. BindingExpression:Path=Current; DataItem='QuickAccessUndoControl' (HashCode=32115247); target element is 'ContentPresenter' (Name=''); target property is 'NoTarget' (type 'Object')
System.Windows.Data Error: 39 : BindingExpression path error: 'Current' property not found on 'object' ''QuickAccessRedoControl' (HashCode=6503226)'. BindingExpression:Path=Current; DataItem='QuickAccessRedoControl' (HashCode=6503226); target element is 'ContentPresenter' (Name=''); target property is 'NoTarget' (type 'Object')
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='NaN' BindingExpression:Path=Source.MinimumWidth; DataItem='InfoToolbar' (Name='InfoCenter'); target element is 'InfoToolbar' (Name='InfoCenter'); target property is 'MinWidth' (type 'Double')
System.Windows.Data Error: 39 : BindingExpression path error: 'BackgroundOpacity' property not found on 'object' ''ContentPresenter' (Name='PART_CustomizeButtonInMainPanel')'. BindingExpression:Path=BackgroundOpacity; DataItem='ContentPresenter' (Name='PART_CustomizeButtonInMainPanel'); target element is 'SystemDropShadowChrome' (Name='Shdw'); target property is 'Opacity' (type 'Double')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=mToggleButton'. BindingExpression:(no path); DataItem=null; target element is 'RibbonItemControl' (Name=''); target property is 'KeyTipPlacementTarget' (type 'UIElement')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=mToggleButton'. BindingExpression:(no path); DataItem=null; target element is 'RibbonItemControl' (Name=''); target property is 'KeyTipActivationTarget' (type 'UIElement')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=mText'. BindingExpression:(no path); DataItem=null; target element is 'RibbonItemControl' (Name=''); target property is 'KeyTipPlacementTarget' (type 'UIElement')
System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=BackgroundBorderColor; DataItem=null; target element is 'SolidColorBrush' (HashCode=5425146); target property is 'Color' (type 'Color')


Thank you,

-Jay
22 REPLIES 22
Message 21 of 23

Hi,

 

ok, when i start AutoCAD from VS (project in debug-mode), then within AutoCAD I start _NETLOAD and point to youir DLL, the command "helloworld" can be started fine.

 

The only thing I would change is you set Framework to version 3.5, as long as you want to run this app with AutoCAD 2012 you should use 4.0 instead. But that is only necessary for debug-reasons (to get breakpoints and so on).

 

>> but the actual demand loaded command

First: do you agree that your code runs fine when using NETLOAD to load your DLL and then start the command?

If so the problem is not the project or code itsself, it's demand-loading then? What have you done to get this project demand loaded? Played with the plugin-directory or manually set some registry stuff?

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 22 of 23

Alfred, you are indeed correct in that the program works when I produce a compiled .dll, and load it with _netload. 

 

I actually haven't done anything to my registry settings whatsoever.  The computer I'm working on is a new build (only two weeks old) that I specifically re-initialized so that I could get all of these tools working.  So I'm a bit mystified as to what is causing this problem.  That being said, I'm using a company specific instance of AutoCAD Map, so the only thing I can think is that there is something within that configuration that is causing the problem.  But even then, it should have affected the Plant3D instance.  That is, actually, a raw installation with no configuration loaded whatsoever.  So... hmm... don't know.

 

But as long as the .dll actually works, the question is, do I care?  I can still use it to load the the application, and then just _netload the dll when required.  So it might be just something I put on the back-burner until I have another idea.

 

Thanks for the help.

Message 23 of 23

Hi,

 

so the number of debug-messages you receive from AutoCAD is not your problem ... and should not be your's, it's a problem Autodesk and/or Microsoft should check (and resolve).

 

Also your code runs fine after you did load your DLL with command _NETLOAD. So everything seems to be as designed.

 

Last point I see now is you want to have your tool automatically loaded when your AutoCAD starts.

Three options I read about it:

 

HTH, - alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost