No Source Available error:

Topics: Building and extending application blocks, Data Access Application Block, Enterprise Library Core
Feb 9, 2012 at 8:39 AM

I thought I chose to just install using the msi, but apparantly it might be wanting me to build the source files. I am trying to create a class library project in VS2010 and entlib5. In my solution I also have a unit testing project by which I am trying to do TDD. I hook into my class library method like so:

using OsheroveDAL;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace OsheroveDALTests
{       
    /// <summary>
    ///This is a test class for CategoriesMgrTest and is intended
    ///to contain all CategoriesMgrTest Unit Tests
    ///</summary>
    [TestClass()]
    public class CategoriesMgrTest
    {
        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }


        /// <summary>
        ///A test for CreateDatabase
        ///</summary>
        [TestMethod()]
        [DeploymentItem("OsheroveDAL.dll")]
        public void CreateDatabaseTest()
        {
            CategoriesMgr target = new CategoriesMgr();
            target.CreateDatabase();
            CategoriesMgr_Accessor targetAccessor = new CategoriesMgr_Accessor();
            Assert.IsNotNull(targetAccessor._db, "something went wrong");           
        }       
    }
}

Here is the target class:

using System;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Data;

namespace OsheroveDAL
{
    public class CategoriesMgr
    {

        private Database _db = null;

        public CategoriesMgr()
        {//empty ctor

        }
        
        public int InsertCategory(string nameOfCategory)
        {
            if (String.IsNullOrEmpty(nameOfCategory))
                throw new NullReferenceException();

            return 1;
        }

        public void CreateDatabase()
        {
            try
            {
                _db = EnterpriseLibraryContainer.Current.GetInstance<Database>("Northwinds");
            }
            catch (Exception)
            {
                               
            }           
        }

        private int AddTwoNums(int x, int y)
        {
            return x + y;
        }

    }
}

When I set a breakpoint on :

  target.CreateDatabase();
I fall into the method CreateDatabase(). I am getting a No Source Available error on the following line:

 _db = EnterpriseLibraryContainer.Current.GetInstance<Database>("Northwinds");

Here is the verbiage:

Locating source for 'c:\Home\Chris\Projects\CommonServiceLocator\main\Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs'. Checksum: MD5 {60 9a 36 4 f2 3b 16 c2 31 1c d3 1a 34 3a e4 bd}
The file 'c:\Home\Chris\Projects\CommonServiceLocator\main\Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs' does not exist.
Looking in script documents for 'c:\Home\Chris\Projects\CommonServiceLocator\main\Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs'...
Looking in the projects for 'c:\Home\Chris\Projects\CommonServiceLocator\main\Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs'.
The file was not found in a project.
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\crt\src\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\atl\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include\'...
The debug source files settings for the active solution indicate that the debugger will not ask the user to find the file: c:\Home\Chris\Projects\CommonServiceLocator\main\Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs.
The debugger could not locate the source file 'c:\Home\Chris\Projects\CommonServiceLocator\main\Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs'.

Do I need to build the source files?

Feb 10, 2012 at 6:52 AM

You don't need to install or build the source code to use Enterprise Library.  

It sounds like you tried to step into Enterprise Library code.  Are you trying to debug Enterprise Library source code?  If not, then you can just "step out" of that page to get back to your code.

--
Randy Levy
Enterprise Library support engineer
entlib.support@live.com