none
VB.Net Function overload resolution issue in VS2017 RRS feed

  • Question

  • while migrating the vb.net project from VS2010 to VS 2017 we are getting missing reference error due to incorrect function overload resolution

    JS

     **************************Project 1 *******************************
    Imports Microsoft.Practices
    Imports Microsoft.Practices.EnterpriseLibrary.Data
    Public MustInherit Class DataLayerSQLBase
        Private m_factory As EnterpriseLibrary.Data.DatabaseProviderFactory
        Private m_database As Microsoft.Practices.EnterpriseLibrary.Data.Database
        Public Function ExecuteReader(ByVal spName As String) As IDataReader
            m_database = m_factory.CreateDefault
            Return ExecuteReader(m_database, spName)
        End Function
        Public Function ExecuteReader(ByVal spName As String, ByVal secondparam As String) As IDataReader
            m_database = m_factory.CreateDefault
            Return ExecuteReader(m_database, spName)
        End Function
        Public Function ExecuteReader(ByVal database As EnterpriseLibrary.Data.Database, ByVal spName As String) As IDataReader
            Dim m_Command = database.GetStoredProcCommand(spName)
            m_Command.CommandTimeout = 300
            Return m_Command.ExecuteReader
        End Function

    End Class

     **************************Project 1 *******************************

     **************************Project 2 *******************************

    This project refers project 1 and doesn't have Enterprise.Library.Data.dll reference, this fails to compile in VS2017 asking for adding reference but works in VS2010 without adding reference

    Imports ClassLibrary1
    Public Class Class3
        Inherits DataLayerSQLBase
        Public Sub Test()
            MyBase.ExecuteReader("aaaa", "aaaaa")
        End Sub
    End Class

    • Edited by javed123 Thursday, July 5, 2018 1:31 PM
    Thursday, July 5, 2018 9:37 AM

All replies

  • While migrating the vb.net project from VS2010 to VS2017 we are getting missing reference issue due to overload resolution failure in vs2017.

    • Merged by Stanly Fan Friday, July 6, 2018 1:27 AM the same thread
    Thursday, July 5, 2018 9:34 AM
  • while migrating the vb.net project from VS2010 to VS 2017 we are getting missing reference error due to incorrect function overload resolution

    JS

    Please post the line of code which causes this error, as well as the exact error message itself.  It would also be helpful to tell us what you mean by "migrating the vb.net project"... did you simply open the project using VS2017?  Did you start a new project in VS2017 and copy code files into it?  What exactly did you do?

    Also, please read this thread about using this forum to avoid these requests for additional information and/or sarcastic replies.

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/36cfcded-06ea-4163-9c82-1bf35c510c6d/how-to-use-this-forum-amp-faq-read-before-making-your-first-thread?forum=vbgeneral


    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Thursday, July 5, 2018 11:57 AM
    Moderator
  • :) I didn't find a way to upload the solution

    JS

    Thursday, July 5, 2018 1:28 PM

  • This project refers project 1 and doesn't have Enterprise.Library.Data.dll reference, this fails to compile in VS2017 asking for adding reference but works in VS2010 without adding reference


    Check the references in the original project... it must already exist.  You will need to add the reference in the new project as the error has indicated.

    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Thursday, July 5, 2018 1:43 PM
    Moderator
  • Enterpriselibrary was never referred in project 2 and it works fine in VS2010.  But VS2017 is unable to resolve the overload to correct function during compile 

    JS

    Thursday, July 5, 2018 1:48 PM
  • Enterpriselibrary was never referred in project 2 and it works fine in VS2010.  But VS2017 is unable to resolve the overload to correct function during compile 

    JS


    Were you using late binding in 2010?  Or perhaps it is part of VS2017 improved debugging/performance monitoring?  I'm not certain, but either way, why not simply add the reference and move on?

    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Thursday, July 5, 2018 2:06 PM
    Moderator
  • Enterpriselibrary was never referred in project 2 and it works fine in VS2010.  But VS2017 is unable to resolve the overload to correct function during compile 

    JS

    JS,

    Is this the lib you mean? Do you need to download and install it for this system/2017?

    What is it a dll or what? Seems there are many add ins.

    Other ideas:

    Perhaps the 2010 project has the file in the project bin/debug folder so it finds a ref that way.

    However you should include it in your project references to avoid this type of problem.

    If your 2017 is set on Option Strict by default then that can cause err message you did not get in 2010 which maybe is on Option Implict On or some other.

    PS Do you know what or where the reference OP is needing Reed? I am not familiar with it if you are.

    Thursday, July 5, 2018 2:25 PM
  • Even if its in the bin folder it should give compile error till you explicitly add reference.  

    Regarding setting Strict On and other setting, its same in 2010 and 2017.  


    JS

    Friday, July 6, 2018 6:06 AM
  • Even if its in the bin folder it should give compile error till you explicitly add reference.  

    Regarding setting Strict On and other setting, its same in 2010 and 2017.  


    JS


    If the file is not on the system you may get that error. Perhaps on one system it is in the bin and on another it is in some other folder.

    If you use option implicit ON then you may not get an error even if not on the system.

    Since the file does not exist on my system you must have added it to your 2010 somehow but not 2017.

    Perhaps if you answer my first question and Reed's quesitons perhaps someone will know something.

    Friday, July 6, 2018 12:00 PM

  • PS Do you know what or where the reference OP is needing Reed? I am not familiar with it if you are.

    I don't know what, but I searched for it in NuGet and it is there.  So the OP should simply add the NuGet reference to their project if they want to move on with the development.

    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Friday, July 6, 2018 12:11 PM
    Moderator
  • We can add reference to the required dll, but was curios about this behavior change in VS2017.  Hence added this to the forum

    JS

    Friday, July 6, 2018 5:17 PM
  • We can add reference to the required dll, but was curios about this behavior change in VS2017.  Hence added this to the forum

    JS


    Without analyzing the old solution, I'm not sure how to identify the difference.  What does the old .sln file look like?

    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Friday, July 6, 2018 5:28 PM
    Moderator
  • NO need of analyzing the old solution, you can create new solution in VS2010 and copy the above code.  you will be able to see the behavior that is mentioned above

    JS

    Monday, July 9, 2018 5:27 AM
  • NO need of analyzing the old solution, you can create new solution in VS2010 and copy the above code.  you will be able to see the behavior that is mentioned above

    JS


    I no longer have VS2010... that's an OLD version.  Again, what does your .sln file look like in the old solution?  Open it in a text editor and post the content.

    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Monday, July 9, 2018 5:33 PM
    Moderator
  • --Solution File after opening in VS2015

    Microsoft Visual Studio Solution File, Format Version 12.00
    # Visual Studio 15
    VisualStudioVersion = 15.0.27428.2043
    MinimumVisualStudioVersion = 10.0.40219.1
    Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ClassLibrary2", "ClassLibrary2\ClassLibrary2.vbproj", "{008B891E-5B5D-4821-9964-08582DE18020}"
    EndProject
    Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ClassLibrary3", "ClassLibrary3\ClassLibrary3.vbproj", "{93074669-B115-4DA4-A09C-55527F62A713}"
    EndProject
    Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.vbproj", "{57B4EE11-8458-4D12-ABEC-EC6F06D3AB4B}"
    EndProject
    Global
     GlobalSection(SolutionConfigurationPlatforms) = preSolution
      Debug|Any CPU = Debug|Any CPU
      Debug|Mixed Platforms = Debug|Mixed Platforms
      Debug|x86 = Debug|x86
      Release|Any CPU = Release|Any CPU
      Release|Mixed Platforms = Release|Mixed Platforms
      Release|x86 = Release|x86
     EndGlobalSection
     GlobalSection(ProjectConfigurationPlatforms) = postSolution
      {008B891E-5B5D-4821-9964-08582DE18020}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
      {008B891E-5B5D-4821-9964-08582DE18020}.Debug|Any CPU.Build.0 = Debug|Any CPU
      {008B891E-5B5D-4821-9964-08582DE18020}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
      {008B891E-5B5D-4821-9964-08582DE18020}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
      {008B891E-5B5D-4821-9964-08582DE18020}.Debug|x86.ActiveCfg = Debug|Any CPU
      {008B891E-5B5D-4821-9964-08582DE18020}.Release|Any CPU.ActiveCfg = Release|Any CPU
      {008B891E-5B5D-4821-9964-08582DE18020}.Release|Any CPU.Build.0 = Release|Any CPU
      {008B891E-5B5D-4821-9964-08582DE18020}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
      {008B891E-5B5D-4821-9964-08582DE18020}.Release|Mixed Platforms.Build.0 = Release|Any CPU
      {008B891E-5B5D-4821-9964-08582DE18020}.Release|x86.ActiveCfg = Release|Any CPU
      {93074669-B115-4DA4-A09C-55527F62A713}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
      {93074669-B115-4DA4-A09C-55527F62A713}.Debug|Any CPU.Build.0 = Debug|Any CPU
      {93074669-B115-4DA4-A09C-55527F62A713}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
      {93074669-B115-4DA4-A09C-55527F62A713}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
      {93074669-B115-4DA4-A09C-55527F62A713}.Debug|x86.ActiveCfg = Debug|Any CPU
      {93074669-B115-4DA4-A09C-55527F62A713}.Release|Any CPU.ActiveCfg = Release|Any CPU
      {93074669-B115-4DA4-A09C-55527F62A713}.Release|Any CPU.Build.0 = Release|Any CPU
      {93074669-B115-4DA4-A09C-55527F62A713}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
      {93074669-B115-4DA4-A09C-55527F62A713}.Release|Mixed Platforms.Build.0 = Release|Any CPU
      {93074669-B115-4DA4-A09C-55527F62A713}.Release|x86.ActiveCfg = Release|Any CPU
      {57B4EE11-8458-4D12-ABEC-EC6F06D3AB4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
      {57B4EE11-8458-4D12-ABEC-EC6F06D3AB4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
      {57B4EE11-8458-4D12-ABEC-EC6F06D3AB4B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
      {57B4EE11-8458-4D12-ABEC-EC6F06D3AB4B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
      {57B4EE11-8458-4D12-ABEC-EC6F06D3AB4B}.Debug|x86.ActiveCfg = Debug|Any CPU
      {57B4EE11-8458-4D12-ABEC-EC6F06D3AB4B}.Debug|x86.Build.0 = Debug|Any CPU
      {57B4EE11-8458-4D12-ABEC-EC6F06D3AB4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
      {57B4EE11-8458-4D12-ABEC-EC6F06D3AB4B}.Release|Any CPU.Build.0 = Release|Any CPU
      {57B4EE11-8458-4D12-ABEC-EC6F06D3AB4B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
      {57B4EE11-8458-4D12-ABEC-EC6F06D3AB4B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
      {57B4EE11-8458-4D12-ABEC-EC6F06D3AB4B}.Release|x86.ActiveCfg = Release|Any CPU
      {57B4EE11-8458-4D12-ABEC-EC6F06D3AB4B}.Release|x86.Build.0 = Release|Any CPU
     EndGlobalSection
     GlobalSection(SolutionProperties) = preSolution
      HideSolutionNode = FALSE
     EndGlobalSection
     GlobalSection(ExtensibilityGlobals) = postSolution
      SolutionGuid = {3E29CA0D-326F-424E-9141-8D2D95676668}
     EndGlobalSection
    EndGlobal


    JS

    Tuesday, July 10, 2018 6:58 AM
  • Hi

    Is your problem solved? If so, please mark the useful replies as answers. 

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, July 24, 2018 9:24 AM