Skip to content

VB.NET "My" not working as expected? #3387

@DualBrain

Description

@DualBrain

@cston and @KathleenDollard,

Here is an isolated example running on the most recent bits as far as I can tell (at least with regards to the Microsoft.VisualBasic side of things).

Module Program
Sub Main(args As String())
Console.WriteLine(My.Computer.Name)
Console.WriteLine((New Microsoft.VisualBasic.Devices.ServerComputer).Name)
Console.WriteLine(System.Environment.MachineName)
End Sub
End Module

The first line doesn’t work in .NET Core 3.0; however, the second and third lines do. Playing with the same code in the full .NET Framework, all three lines work and when you jump to the reference for My.Computer.Name, it goes to Microsoft.VisualBasic.Devices.ServerComputer.Name. I then jumped back over to the .NET Core source tree and that property simply returns System.Environment.MachineName. One thing I find interesting about this is it’s not a 1:1 map… how does My.Computer.Name map to a property inside of an instantiated instance of Microsoft.VisualBasic.Devices.ServerComputer? Some “magic” black-box stuff there?

So am I just missing something as far as how to "light up" the My side of things when working with a .NET Core 3.0 console project? Or is there some additional work that still has to be done beyond the work that has taken place within the Microsoft.VisualBasic namespace?

(BTW, @cston great work thus far!)

Thanks.

Cory Smith

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions