question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

C# -> VB: Type members in a module cannot be shared

See original GitHub issue

Input code

static partial class SpecializedCollections
{
        public static readonly byte[] EmptyBytes = EmptyArray<byte>();
        public static readonly object[] EmptyObjects = EmptyArray<object>();
}

Erroneous output

Partial Module SpecializedCollections
        Public Shared ReadOnly EmptyBytes As Byte() = EmptyArray(Of Byte)()
        Public Shared ReadOnly EmptyObjects As Object() = EmptyArray(Of Object)()
End Module

Expected output

Partial Module SpecializedCollections
        Public ReadOnly EmptyBytes As Byte() = EmptyArray(Of Byte)()
        Public ReadOnly EmptyObjects As Object() = EmptyArray(Of Object)()
End Module

Details

The example shows fields, but applies to anything declared in a module.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
RussellSmith2commented, Apr 1, 2018

Also, module constructors cannot be private.

0reactions
GrahamTheCodercommented, May 9, 2018

Apologies for the confusion. I wasn’t talking about project specific stuff, just standard Visual Studio build workflow. Fortunately VS has extensive documentation and articles on getting started, so you can just Google:

Where do I copy the test case to?

Tests\VB\MemberTests.cs

While this is a “trivial bug” in the sense that a sequence of small understandable steps will solve it, it will require quite a few changes, and some careful reading of the C# and VB documentation. I tagged it “good first issue” because there’s something else to copy the style of (the conversion in the other direction), not because it’s inherently easy.

While you’re getting used to the development environment too I’d probably recommend starting on the other issue I’ve just tagged here which is a bit smaller.

Hope that helps!

Read more comments on GitHub >

github_iconTop Results From Across the Web

vb.net - Is a Module really identical to a SharedMembers- ...
The VB equivalent is Shared , but Shared Classes are not permited with VB (only the Members). The guidelines described below are tentatives...
Read more >
Shared - Visual Basic
Sharing a member of a class or structure makes it available to every instance, rather than non-shared, where each instance keeps its own ......
Read more >
Type members
This chapter defines members of types. Members include methods, properties, fields, delegates, and events.
Read more >
Shared classes or modules? - Visual Basic .NET
it. I normally prefer "Shared" classes over Modules as they require the class name to prefix the member names, which to me is...
Read more >
Thread: Sub Main in Module vs Shared Class
A module is internally a class where all members are declared 'Shared' So there's no practical difference between a class where you declare ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found