Problem with Statement Completion in Visual Studio 2008 SP1 - vb.net

After installing SP1 of Visual Studio 2008, code completion shows all types when an object member shows the parameter list. Before SP1, parameter list would only show related types.
Take a look at this image for an example: http://img25.imageshack.us/img25/3484/vs2008sp1intellisense.png
Has any one else had this problem? Solutions?
This happens on a Windows 7 and Windows XP machines I have, all services packs installed.
Thanks
Javier Soques

This isn't related to the service pack. I've verified the same behavior on an RTM version of Visual Studio 2008.
What you're seeing here is an issue of overload resolution. In the particular example you are using the MessageBox.Show method which has 21 overloads.
With no arguments and just MessageBox.Show( typed in the editor it's ambiguous as to which version you will be calling. So instead of showing specific types, it will show the completion list for all expression types.
Once the overload is not ambiguous it will show the specific type list. For instance if you type
MessageBox.Show("foo","bar",
It will show only the button enumeration completion.

Related

Intellisense in Visual Studio 2017 is hiding members from the autocomplete list

I am currently using Visual Studio 2017 Enterprise and I have run into a problem that I am sincerely hoping is just because I have not found the correct setting. In Visual Studio 2017 I am missing members from my Intellisense list as seen in the comparison pictures below between VS2017 and VS2015.
From the two images you can see that VS2017 is not showing the Count property whereas VS2015 is. VS2017 is also not showing IsReadOnly, IsSyncronized, SyncRoot if I scroll down it's list.
There must be something I am doing wrong, but I can't seem to get these members to show.
Here is another example comparing DataGridViewRow members:
In this image you can see VS2017 is missing AdjustRowHeaderBorderStyle, DataBoundItem.
Refer to your description, I have reproduced this issue and reported this issue to the VS Product Team, please check this: VB-Windows Forms: the list members of 'DataGridView.SelectedRows.' miss some members, please add a comment and waiting for the feedback from the Product Team engineers.
Meanwhile, I found we can still use those missing members like ‘Count’ and there is no error reminder.

Visual Studio 2015 Analyzer threw an exception

After updating from VS 2015 Update 1 RC to VS 2015 Update 1, I keep getting the following error message:
Analyzer
'Microsoft.CodeAnalysis.VisualBasic.CodeFixes.SimplifyTypeNames.VisualBasicSimplifyTypeNamesDiagnosticAnalyzer'
threw an exception of type 'System.ArgumentNullException' with message
'Value cannot be null. Parameter name: source'
on one of my projects. Code Analysis is disabled on that project (as it is on all of my projects in the solution), so I tried to turn it on and off but still the same issue.
It seems that I can still build and run my solution, but things don't really seem to work properly after the upgrade:
everything is running really slow
after making changes and building it doesn't apply the changes
Did anyone else have this issue after the recent update or maybe even before?
Potential work-around found in here: https://github.com/dotnet/roslyn/issues/6682 posted by user dpoeschl.
And this is his original text:
Workaround: Check this checkbox: Tools | Options | Text Editor | Basic
| Code Style | Qualify member access with 'Me'
This workaround has two side-effects (that I can think of so far):
1. You will no longer get a visual indicator of the superfluous Me. or the associated code-fix, or the "Fix all occurrences in" options for
easily achieving compliance.
2. Any code generation features that generate fully qualified member accesses and depend on the Simplifier to remove them if appropriate
(or that explicitly check this option) will now generate non-compliant
code by default.
Enabling this option is particularly non-invasive in both VS2015 &
VS2015 Update 1 because this option is only enforced in one direction.
That is, the checkbox being unchecked means the analyzer runs, does
some deeper analysis (that fails in this case), and offers you a
lightbulb when you have qualified member accesses, while the checkbox
being checked means that we opt out of the deeper analysis very early
and you don't get any lightbulbs telling you to add Me. qualification.
It has worked for me, it might as well fix the problem for others.
This is a defect introduced in Update 1 and it is already tracked at Roslyn GitHub as #6682 since 2015-10-11.
Check there for status updates.
Update: Visual Studio 2015 Update 2 is now out and the problem is fixed there.
Update:
Apparently, the general issue is the code assistant is flagging calls to Shared class types when the class name is used.
For example
Private Shared Property Instance as Class1
Public Shared Function DefInstance1() as Class1
' This causes the warning
Return Class1.Instance
End Function
Public Shared Function DefInstance2() as Class1
' This is okay
Return Instance
End Function
For example, I assigned a value to the Synchronizing Object when inheriting from System.Timers.Timer as:
MyBase.SynchronizingObject = value
Instead of
SynchronizingObject = value
The VS Code Assistant detected this as a type name that can be simplified.
Note also, that a new warning is added each time VS starts.
Update:
It looks like another culprit is in the code generated by Visual Studio in the Application.Designer.vb:
this
Global.Microsoft.VisualBasic.ApplicationServices
is tagged for simplification to
ApplicationServices
It seems that Code Assistant has become a bit over-aggressive without QA noticing the issues at hand.
On March 30th, 2016, Microsoft released a new update for Visual Studio.
After installing Visual Studio Update 2 the issue seems to go away. This is the VS Update 2 and VS Update 2 Release Notes
Checking the Release Notes, this is the only thing they have touched with regards to the Analyzer:
We made Analyzer API improvements, including enabling Analyzer writers to mark their analyzers for concurrent execution, and providing control over whether analyzers run in generated code.

How to prevent Visual Studio from displaying double values with 18 decimal places

Recently I noticed in my current vb.net project that sometimes (depending on the value), if I enter a double value the editor changes my input, for example:
When I type ...
Dim x As Double = 0.6
...after commiting the line by pressing Enter it becomes:
Dim x As Double = 0.59999999999999998
If I directly undo the action, then it gets reverted back to the original value I typed in. Any future edit in that line will again produce the undesired results.
I'm aware that internally 0.6 is calculated as 0.59999999999999998 so it doesn't make a difference for the running application, but it's very annoying and the strange thing is: this hasn't always happened and, if I create a new project, it doesn't happen there either.
So my questions are: How can I prevent VS from doing this? Why does it happen at all? Why isn't it always like this (previously in my current project or in a new one)?
I'm running 64bit-Windows 8.1 on an Intel CPU - if that has anything to do with it.
Has anyone got any ideas?
EDIT: I'm using Visual Studio 2013 Professional (12.0.31101.00 Update 4) and, yes, the project has been migrated from several earlier VS versions. There are no relevant Add-Ins or extensions installed. Disabling "Pretty Listing" does indeed prevent the problem, but of course then the other highly useful aspects of the option are disabled as well :o(
EDIT2: After the tip leading to "Pretty Listing" I found the following SO article, but there also no solution was found: Visual Studio VB pretty listing settings
Several years ago I had a project where this was happening. As you wrote, the reason for the number is that some numbers can't be represented exactly in a binary floating point variable. More on this here.
My project had been upgraded through several versions of Visual Studio. It was also shared with developers using VS Express.
If I ran into this problem again today I would open and check the project-file manually, or just simply create a new project and re-add the files if I could not quickly locate the problem and the project was small enough.
If you have upgraded the project through multiple versions of Visual Studio like I had, it might be dragging some settings along that are no longer visible in the projects options dialog.
Just as an interesting experiment you could also try to turn off Visual Studio's Pretty Listings to see if that is what is actually changing your code.

Ambiguity issue with Vb.Net and MySql Connector

I'm running into a weird issue with a VB.Net project using the MySql ADO.Net connector. I have the following code:
Dim param As New MySqlParameter("#val29", MySqlDbType.DateTime)
And I'm getting the following error message:
Ambiguous invocation:
Public Enum member Datetime As MySqlDbType (in Enum MySqlDbType)
Public Enum member DateTime As MySqlDbType (in Enum MySqlDbType)
match
The difference between them, if you notice, is that DateTime is in a different case then Datetime. Since this is VB.Net and VB is case-insensitive, I'm not sure why I'm getting this error.
Interestingly enough, I opened Object Browser in Visual Studio 2013 and, as you can see from the image below, there does seem to be two definitions of DateTime:
.
Thinking maybe there was an issue with the DLL, I went to their website and downloaded the source code and rolled my own DLL. Same issue. I couldn't seem to find anything on the Internet about it, except for this page, which describes my issue exactly, except it seems to be due to a specific bug in Visual Studio 2015. I'm using Visual Studio 2013. That almost makes me think a Windows Update came along that changed the way the VB.Net compiler works. That doesn't make any sense though because updates are specific to Windows, not Visual Studio. Anyone have any ideas?

Can't use FAXCOMEXLib in VS 2010 anymore?

I'm just in the process of moving from Visual Studio 2008 to Visual Studio 2010.
One of my projects use the Microsoft Fax Service Extended COM Type Library. After converting the project to VS 2010 I get the following compiler error:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1558,9): error MSB3648: The Keycontainer-path "VS_KEY_812A0248FF872DEC" ist invalid. KeyContainer must point to an existing file.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1558,9): warning MSB3283: Wrapperassembly for type library "FAXCOMEXLib" not found.
I tried to remove FAXCOMEXLib from the project and adding it again, but it did not help.
I got a similar problem with other COM references.
How do I resolve this?
It is a known bug. Take a look at this Microsoft Connect entry which has a workaround.
this might not be relevant for you any more, but might be so for others. I've had the same problem recently and in my searches I found this list of common FAXCOMEXLib errors. I helped me, in any case.