wakatime / ssms-wakatime

SQL Server Management Studio plugin to quantify your coding with automatic time tracking and metrics about your programming. https://wakatime.com
BSD 3-Clause "New" or "Revised" License
40 stars 19 forks source link

Install for 17.9.1 doesn't appear to be working #20

Closed leemcmullen closed 2 years ago

leemcmullen commented 5 years ago

I have the plugin installed and working fine within VS2017 and Notepad++. I have a .wakatime.cfg file which contains my API key.

I'd like to get it working within SSMS too so I followed the instructions as detailed here: https://wakatime.com/sql-server-management-studio

However SSMS doesn't prompt me for my API key, nor is there a Wakatime menu option either at the top level nor within Tools, nor is my time in SSMS being recorded. I'm not receiving any errors and I've tried running as Admin but that doesn't appear to make a difference either.

The only other extension I have installed is SSMS Tools.

Here's the info from my SSMS about screen:

Microsoft SQL Server Management Studio: 14.0.17289.0 Microsoft Analysis Services Client Tools: 14.0.1016.283 Microsoft Data Access Components (MDAC): 10.0.17134.1 Microsoft MSXML: 3.0 5.0 6.0 Microsoft Internet Explorer: 9.11.17134.0 Microsoft .NET Framework: 4.0.30319.42000 Operating System: 6.3.17134

gandarez commented 5 years ago

Try enabling Debug into wakatime.cfg file and see if there's any logged data into wakatime.log or the console inside SSMS.

leemcmullen commented 5 years ago

@gandarez Hi, I've enabled debug as you suggested however it's only returning messages about my Visual Studio installation. Nothing is appearing in there related to SSMS.

I'm not seeing any errors (or anything related to Wakatime) in any SSMS view either.

When you mention the console inside SSMS, are you referring to the Output view?

gandarez commented 5 years ago

Yea, sorry output window. Nothing there?

leemcmullen commented 5 years ago

No, nothing I'm afraid. Is there anything else I can try?

gandarez commented 5 years ago

You can try looking at ActivityLog.xml to find if there're any errors related to Wakatime loading process.

leemcmullen commented 5 years ago

So there's nothing related to Wakatime in ActivityLog.xml either.

However, I did some more digging and found that if I remove the registry key added by the AddPackage.bat file and then start SSMS (with the Wakatime extension files in place), I get the following error when SSMS loads: The WakaTimePackage package did not load correctly and I get the following in ActivityLog.xml:

<entry>
    <record>122</record>
    <time>2019/07/24 09:14:33.629</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Entering function CVsPackageInfo::HrInstantiatePackage</description>
    <guid>{52D9C3FF-C893-408E-95E4-D7484EC7FA47}</guid>
  </entry>
  <entry>
    <record>123</record>
    <time>2019/07/24 09:14:33.629</time>
    <type>Warning</type>
    <source>VisualStudio</source>
    <description>Appid denied the loading of package</description>
    <guid>{52D9C3FF-C893-408E-95E4-D7484EC7FA47}</guid>
  </entry>

This happens whether I start as normal or run as Admin.

If I then clear ActivityLog.xml, run the .bat file (i.e. add the reg keys) and then start SSMS again then I don't get the error and nothing appears in the activity log.

When I don't get an error, I also noticed that the following directory is created and populated within the registry: HKEY_CURRENT_USER\Software\Microsoft\SQL Server Management Studio\14.0_Config\Packages\{52d9c3ff-c893-408e-95e4-d7484ec7fa47}. Here are the keys/values:

(Default): WakaTimePackage
Class: WakaTime.WakaTimePackage
CodeBase: C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\Extensions\WakaTime\WakaTime.dll
InprocServer32: C:\WINDOWS\SYSTEM32\MSCOREE.DLL

That makes me think that it's at least loading something on SSMS startup. However nothing is logged in my Wakatime dashboard and I don't see any reference to Wakatime in SSMS.

Is there anything else I can try?

gandarez commented 5 years ago

If there's any error showing up when starting SSMS maybe you're behind a proxy/firewall which is blocking the call to the api?

leemcmullen commented 5 years ago

No not using a proxy I'm afraid and I'm having no other issues re: firewall.

If the calls were being blocked, wouldn't that also affect Wakatime within Visual Studio and Notepad++?

Both of those are logging ok and presumably use the same endpoint as the SSMS extension?

gandarez commented 2 years ago

The extension has been bumped to version 3.0.0. Please follow the updated instructions on README to reinstall it.