I’m back to moving one of my VB.NET solutions to Mercury. One of my projects is a class library that has a Public Class with a constructor that looks like this:
Sub New(pDataContextType As Type) MyBase.New(pDataContextType) End Sub
Notice that the Sub is not explicitly defined as “Public”. However, in VB.NET this is treated as Public - creating a new object with this constructor compiles fine, apparently because this is the default in VB.NET.
However, after switching the project to Mercury, I’m getting this error:
(E672) Type "xxxx" has no accessible constructors
After experimenting a bit with this, it appears to me that this only happens if the class is in a different project from the calling code. If it is in the same project, it finds the constructor without an issue.
I’ve attached an example. The “ScopeExample.sln” points to the vbproj files, and should compile fine. The “ScopeExampleMercury.sln” has the exact same code files but points to the elements files instead, and shows the compile error.
I’ll admit I shouldn’t rely on the defaults, and so it was no big deal to change it to add the “Public” for the Sub. On the other hand, depending on the code base being moved to Mercury, it might be a lot more work than it was for me - I only had a few places where this was an issue.
ScopeExample.zip (592.7 KB)