1
Saving a file causes 'using' statements to be removed from file
Problem reported by Dave Black - 9/27/2019 at 10:48 AM
Submitted
I'm using VS 2019 v16.2.5 and GhostDoc Community v2019.2.19200

After installing GhostDoc, when I save a file (either via CTRL + S, the VS menu item or Save button), the using statements at the top of the file are removed. I use the VisualStudio extension "Productivity Power Tools" (marketplace.visualstudio.com/items?itemName=VisualStudioPlatformTeam.ProductivityPowerPack2017 ) which works flawlessly.  It has a feature "Remove and Sort Usings on Save" that I have enabled.  Somehow, GhostDoc is interfering with this extensions feature and causing the usings to be deleted.

If I disable GhostDoc, the problem goes away.

5 Replies

Reply to Thread
0
Misha Zhutov Replied
Employee Post
Hi Dave, 

It is strange behavior because GhostDoc does not intercept any open/close document events and does not do anything when such an events raised. Please send us the log file from c:\Users\<user>\Documents\SubMain\GhostDoc for VS2019\GhostDoc.log, Maybe, we will find anything there which helps us to solve the problem.
0
Dave Black Replied
Thank you for your response.  Unfortunately, I don't see anything telling of what might be going on...

Log Message (9/27/2019 12:23:06 PM) : Information: Initialize package...
Log Message (9/27/2019 12:23:06 PM) : Information: Initialize DTE v16.0
Log Message (9/27/2019 12:23:06 PM) : VsPackage Loaded, m_dteApplication != null
Log Message (9/27/2019 12:23:06 PM) : LoadPackage v19.2.19200.0
Log Message (9/27/2019 12:23:08 PM) : Default optimizaton: Performance
Log Message (9/27/2019 12:23:08 PM) : Run InitializeAddIn from LoadPackage: application != null
Log Message (9/27/2019 12:23:08 PM) : Information: Create RuleConfigurationFile instance for file: "C:\Users\xxx\Documents\SubMain\GhostDoc for VS2019\Configuration.gdc", hash: 1441596967
Log Message (9/27/2019 12:23:08 PM) : GetIntegrationInformation: the "c:\users\xxx\appdata\local\microsoft\visualstudio\16.0_d9460a43\extensions\s2azv03o.hz1\GhostDocSetup.xml" setup configuration file is not exist
Log Message (9/27/2019 12:23:08 PM) : IsJustInstalled: True;True
Log Message (9/27/2019 12:23:08 PM) : IsJustInstalled = TRUE
Log Message (9/27/2019 12:23:08 PM) : Information: RuleConfigurationFile Save, hash: 1441596967
Log Message (9/27/2019 12:23:09 PM) : SEH Subscribe started...
Log Message (9/27/2019 12:23:09 PM) : SEH Subscribe finish
Log Message (9/27/2019 12:23:09 PM) : VsPackage->Initialize-> solution exists...
Log Message (9/27/2019 12:23:09 PM) : SEH OnAfterBackgroundSolutionLoadComplete: started...
Log Message (9/27/2019 12:23:09 PM) : SEH Run backgroundSolutionLoader async..
Log Message (9/27/2019 12:23:09 PM) : SEH BackgroundSL: starting...
Log Message (9/27/2019 12:23:09 PM) : Information: The package initialized successfully
Log Message (9/27/2019 12:23:09 PM) : SEH OnAfterOpenSolutionInternal: starting...
Log Message (9/27/2019 12:23:12 PM) : SEH OnAfterOpenSolution: starting...
Log Message (9/27/2019 12:23:15 PM) : SEH OnAfterBackgroundSolutionLoadComplete: started...
Log Message (9/27/2019 12:23:15 PM) : SEH Run backgroundSolutionLoader is busy.
Log Message (9/27/2019 12:23:19 PM) : Opening solution - C:\src\foo.sln, projects = 2
Log Message (9/27/2019 12:23:21 PM) : Loading project: foo1 (C:\src\foo1)
Log Message (9/27/2019 12:23:22 PM) : SolutionPropertyService->Read-> no property file: C:\src\foo.sln.GhostDoc.xml
Log Message (9/27/2019 12:23:22 PM) : SolutionPropertyService->Read-> set defaults.
Log Message (9/27/2019 12:23:23 PM) : Solution opened - foo, projects = 1, Size = 170637 bytes
Log Message (9/27/2019 12:23:23 PM) : OnAfterOpenSolution: isSolutionLoaded: true
Log Message (9/27/2019 12:23:23 PM) : SEH BackgroundSL: finished.
Log Message (9/27/2019 12:23:49 PM) : EscapeXslCharacters - text:foo
Log Message (9/27/2019 12:23:49 PM) : PrepareFooter: divElement != null
Log Message (9/27/2019 12:23:49 PM) : XmlDocumentationFileHelper->Generate: comments.xml
Log Message (9/27/2019 12:25:15 PM) : TrackProjectDocumentsEventHandler.OnAfterAddFilesEx: add valid project item 'C:\src\foo1\Mappers\DiscountCardMapper.cs'
Log Message (9/27/2019 12:25:27 PM) : TrackProjectDocumentsEventHandler.OnAfterAddFilesEx: add valid project item 'C:\src\foo1\Mappers\IDiscountCardMapper.cs'


0
Serge B. Replied
Employee Post Marked As Resolution
Hi Dave,

You are correct, there are no errors or any sort of indication that GhostDoc might be interfering...  We attempted to reproduce to no avail.

Also, GhostDoc doesn't subscribe to the events Document Save events so it technically can't interfere.

This might be related to Productivity Power Tools - have you reported the potential issue with them?

Thanks!
Serge Baranovsky
SubMain Software
(800) 936-2134
0
Dave Black Replied
Hi Serge,

Thanks for the reply. I haven't reported it to them because it works fine when GhostDoc is disabled (and well before GhostDoc was installed) so it seems odd that it would be related to them.  That being said, based on what you say, if you're not registering for those events, then it is possible the problem is with Productivity Tools and that just the presence of GhostDoc causes it to react differently.  Maybe I'll attach a VS debugger to VS and see what's going on myself.

Any tips on debugging a VS extension? Do you guys have a symbol server I can point to?
0
Misha Zhutov Replied
Employee Post
Dave, 

Is it reproduced only on one particular file? Or multiple files? Are those "usings" actually used? If it is reproduced in one file only - could you please send it to us (support@submain.com) for troubleshooting? Does GhostDoc file has any records at the time you save the file?

We have setup a test environment on a clean VM with VS2019, Productivity Power Tools and GhostDoc and were not able to reproduce the issue.

Reply to Thread