.NET
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Re: Catastroph ic failure HRESULT: 0x8000FFFF (E_UNEXPEC TED)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
When you say "crashes" what do you mean?! It goes away or just throws some exception. If the latter what does it say?! Also, you should be using the one that comes with VS
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\WcfTestClient.exe
If that's crashing you have an Visual Studio installation issue.
Also make sure the cmd window you are using to launch WcfTestClient.exe knows about the correct .NET path. Mine is
C:\Windows\Microsoft.NET\Framework64\v4.0.30319
Re: Catastroph ic failure HRESULT: 0x8000FFFF (E_UNEXPEC TED)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I get the Exception: Object reference not set to an instance of an object
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Tools.Common.SdkPathUtility.GetRegistryV
at Microsoft.Tools.Common.SdkPathUtility.GetSdkPath(V
at Microsoft.Tools.TestClient.ToolingEnvironment.get_
etc.....
Re: Catastroph ic failure HRESULT: 0x8000FFFF (E_UNEXPEC TED)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Ok, I don't know. But good thing you can at least see it with WCFStorm. The weird stuff is when you add that SendCommand I posted above. That invokes the DOSELECTION command that works when invoked from the command line and still results in the same exact error on the same line of code when called through wcf SendCommand...
Re: Catastroph ic failure HRESULT: 0x8000FFFF (E_UNEXPEC TED)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
This works for me:
Public Sub DoSelection()
Try
activeDoc = MgdAcApplication.DocumentManager.MdiActiveDocument
Using acDocLck As DocumentLock = activeDoc.LockDocument()
Dim td As AcadDocument = DocumentExtension.GetAcadDocument(activeDoc)
Dim ssetObj As AcadSelectionSet = td.SelectionSets.Add("SSALL0") ' creates named selection set
ssetObj.Select(AcSelect.acSelectionSetAll)
log.Trace("We have a selection of size = {0}", ssetObj.Count)
activeDoc.Editor.WriteMessage("We have a selection of size = {0}", ssetObj.Count)
Autodesk.AutoCAD.ApplicationServices.Application.S howAlertDialog("We have a selection of size = " & ssetObj.Count.ToString())
Try
For Each ent As AcadEntity In ssetObj
log.Trace("{0}", ent.ObjectName)
Next
Catch
log.Error("This is the crash: '{0}'", Err.Description)
End Try
End Using
Catch
log.Error(Err.Description)
End Try
End Sub
At the beginning right after try I added this line:
activeDoc = MgdAcApplication.DocumentManager.MdiActiveDocument
When you step through the code it looks like active document is alright, but this class gets instantiated by the WCF system and when this property is initialized something is not connecting properly.
To ensure this is working on the current active document maybe this should be a method instead of a property so it always checks and returns the active document?
Results:
2013-01-29 14:22:03.3589 INFO Listening on http://127.0.0.1:7200/ISelectItems
2013-01-29 14:22:18.6964 INFO This will crash
2013-01-29 14:22:18.7094 TRACE We have a selection of size = 13
2013-01-29 14:22:21.1977 TRACE AcDbLine
2013-01-29 14:22:21.1977 TRACE AcDbLine
2013-01-29 14:22:21.1977 TRACE AcDbLine
2013-01-29 14:22:21.1977 TRACE AcDbLine
2013-01-29 14:22:21.1977 TRACE AcDbLine
2013-01-29 14:22:21.1977 TRACE AcDbLine
2013-01-29 14:22:21.1977 TRACE AcDbLine
2013-01-29 14:22:21.1977 TRACE AcDbLine
2013-01-29 14:22:21.1977 TRACE AcDbLine
2013-01-29 14:22:21.1977 TRACE AcDbLine
2013-01-29 14:22:21.1977 TRACE AcDbLine
2013-01-29 14:22:21.1977 TRACE AcDbLine
2013-01-29 14:22:21.1977 TRACE AcDbLine
I think the difference is because the Initialize plugin method is run by AutoCAD so when the current document is set it is correct. The WCF deals with the wcfSelectItems class and when this class is created it is not in the same context as when AutoCAD loads the plugin class.
Re: Catastroph ic failure HRESULT: 0x8000FFFF (E_UNEXPEC TED)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I tried this solution but I think you are right somehow I have to force autocad to activate the current document. If I make the change you are suggesting I get a Object reference not set to an instance of an object. I also tried to make it a function that returns the document: same result.
Private Function activeDoc() As Document
Return MgdAcApplication.DocumentManager.MdiActiveDocument
End Function
Re: Catastroph ic failure HRESULT: 0x8000FFFF (E_UNEXPEC TED)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Which line does the exception get thrown on?
Re: Catastroph ic failure HRESULT: 0x8000FFFF (E_UNEXPEC TED)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Public Sub DoSelection()
Try
Dim activeDoc As Document = Autodesk.AutoCAD.ApplicationServices.Application.D
Using acDocLck As DocumentLock = activeDoc.LockDocument()
Re: Catastroph ic failure HRESULT: 0x8000FFFF (E_UNEXPEC TED)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Is there any difference if you leave your property how you originally had it and change the line line after try to:
activeDoc = MgdAcApplication.DocumentManager.MdiActiveDocument
My code works if I take your original sample and just add this one line, I still have the property in my code exactly how you had yours in the first post, I just update the activeDoc at the start of the method just after try
Re: Catastroph ic failure HRESULT: 0x8000FFFF (E_UNEXPEC TED)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Yes, I tried that too. Do you have ACAD 2013?
Re: Catastroph ic failure HRESULT: 0x8000FFFF (E_UNEXPEC TED)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I have AutoCAD Electrical 2013, but should work the same for this example. I am attaching my project that works.


