-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'System.InvalidCastException' occurs intermittently when using Visual Studio 2019 (Professional) #11
Comments
Thanks for the report. Is the exception consistent or is it thrown randomly? |
No problem, for myself and my colleague currently using the tool, this error appears to occur intermittently while using Visual Studio 2019. I've tested to verify whether the exception appears during a certain time or circumstance, such as starting up Visual Studio, loading a solution, or opening certain files in the 'Solution Explorer', but unfortunately it seems to be intermittent from what we can tell. Thanks in advance. |
@elishalom I have the same problem, but at present, it's just the cs file of the winforms that has problems? |
Thanks for the update. I don't maintain the extension on a regular basis anymore, so it may take me some time to get to it. But, this issue is the top one I plan to fix. |
Thank you for bringing us such an excellent extension! We look forward to your update! |
Can you please share the code that causes the error? Even a dummy version that reproduces it will be very helpful. I'm trying to create a repro of the issue but I'm failing to create a code that raises the exception. |
I upload my ActivityLog.xml to Firefox Send. Here is https://send.firefox.com/download/de30e1ab028364ea/#fXVNs7c6paqUdYZbggqGSA And my Visual Studio Version is Visual Studio Enterprise 2019(VisualStudio.16.Release/16.4.4+29728.190) |
Thanks for the details. I could not reproduce the exception, but, I think I identified a potential spot that causes the exception. I've updated the extension with a fix to that issue. The version with the change is 0.9.1.1. |
@elishalom The frustration is that the problem still seems to exist. In the picture, my red arrow points to the file I edited. When I open the CS file corresponding to the form, an error will occur, but opening other classes will not appear. Details of the extension I installed Here is the new ActivityLog https://send.firefox.com/download/b0383d087d78b5ef/#aMWbojoW6lnfrT6M3dp9Kg |
And what I want to add is that Code Metrics will not work in the cs file that the form is bound to. Just like NOT Also, it's amazing that in WPF project, the file bound by WinForms is normal, but the WPF file is abnormal. In some WinForms project, the CS file bound by the form is abnormal (Some are normal). In WPF project: In WinForms project: Some may work |
Thanks for the detail @KevinZonda. |
I'm not sure how to share such code. I'm just editing a my repository. Here is https://github.com/KevinZonda/Widget-WPF In this repository, the xaml.cs will cause the exception, but other cs file will not. |
Exception also happens in this file: https://github.com/elishalom/netcodemetrics/blob/master/CodeMetrics.Adornments/CodeMetricsPackage.cs |
Thanks, that reproduces the error. The exception is due to the fact the complexity extension is based on an old version of NRefactory which does not support new features of the language. I'll port it to roslyn to fix it and potentially support new features of the language. |
That sounds fantastic! |
Hi, This issue is still present and quite annoying. In fact it renders the whole extension useless. On top of that, once you get the exception, the extension stops working. Are there any plans on fixing that soon? |
using roslyn code analysis may help, see more https://github.com/vojtechkacmarik/netcodemetrics and #1 |
Thank you but this extension is not installing on latest VS 2019 16.7 |
Hi guys, I've raised a Pull Request here on the 'vojtechkacmarik' fork of the original Repo, which means the Extension (with the Roslyn changes) will now work with Visual Studio 2019 once this PR is merged. The good news is I've got the Roslyn version of the Extension installed successfully after building it locally with the PR changes for updating the VSIX manifest. The Roslyn version also seems to be able to handle calculations involving Expression Body syntax, where the original Code Metrices Extension I think still has issues with this. [Screenshot of 'Expression Body' Code samples with Roslyn Code Metrics Tool installed] Hope this helps! |
When using Visual Studio 2019 Professional, an exception is occassionally thrown with a 'System.InvalidCastException' being recorded in the log.
[Log]
3028 2019/09/30 07:29:37.148 ErrorThe text was updated successfully, but these errors were encountered: