locked
VS2008: Method '<method name> in type '<class>' does not have an implementation.

    Question

  • When generating accessor in a unit testing project I get this message:

    Method '<method name> in type '<class>' does not have an implementation.

    Here is the output of Publicize.exe:

    Unhandled Exception: System.TypeLoadException: Method '<method name> in type '<class>' does not have an implementation.
       at System.Reflection.Emit.TypeBuilder._TermCreateClass(Int32 handle, Module module)
       at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock()
       at System.Reflection.Emit.TypeBuilder.CreateType()
       at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.DynamicType.CreateType()
       at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.DynamicAssembly.Save()
       at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.Shadower.ShadowAssemblyHelper(ShadowerOptions options)
       at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.Shadower.ShadowAssemblyHelper(ShadowerOptions options)
       at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.Shadower.ShadowAssembly(AppDomain domain, ShadowerOptions options)
       at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.Shadower.ShadowAssembly(ShadowerOptions options)
       at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.Shadower.Main(String[] args)

    Has nyone ran into this?

    Paulo Morgado (http://PauloMorgado.NET/)
    Friday, June 13, 2008 5:08 PM

Answers

  • Looks ike it has been solved in VS2008 SP1.
    Paulo Morgado (http://PauloMorgado.NET/)
    • Proposed as answer by Rajat Arya Wednesday, January 07, 2009 12:54 AM
    • Marked as answer by Paulo MorgadoMVP Sunday, January 11, 2009 10:37 PM
    Sunday, October 05, 2008 7:14 PM

All replies

  • Yes ... for some reason I have started getting it when a accessor is generated for a class with an explicit interface implementation:

    Like this:

    class MyClass : IMyInterface
    {
        string IMyInterface.Value
        {
            get { return ""; }
        }
    }
    I get the Error: 

    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v9.0\TeamTest\Microsoft.TeamTest.targets(14,5): error :
    Method 'get_Value' in type 'MyClass' from assembly '<assembly>' does not have an implementation.

    I have no idea what to do about it ... :-(

    Friday, September 26, 2008 8:47 AM
  • Just found the answer:

    1) go to the Test Project, from the "/Test References" folder, delete the *.accessor file
    2) recompile

    ;-)
    Friday, September 26, 2008 9:00 AM
  • Looks ike it has been solved in VS2008 SP1.
    Paulo Morgado (http://PauloMorgado.NET/)
    • Proposed as answer by Rajat Arya Wednesday, January 07, 2009 12:54 AM
    • Marked as answer by Paulo MorgadoMVP Sunday, January 11, 2009 10:37 PM
    Sunday, October 05, 2008 7:14 PM
  • Unfortunately I was unable to see this working after upgrading to VS 2008 SP1.

    I have a workaround that I have successfully tested in my development environment.  Sharing it with everyone else too.

    Following the info here: http://msdn.microsoft.com/en-us/library/ms184807.aspx I added the CompilerGenerated attribute to the interface that was causing Publicize.exe to crash.  After doing that this interface was skipped when looking to create private accessors, and my build completed successfully again.

    // This is a workaround to prevent publicize.exe from attempting creation of a private accessor for this interface. 
    [System.Runtime.CompilerServices.CompilerGenerated] 
    public interface UnhappyInterface : SomeOtherInterface 
       void MakeHappy(); 



    • Proposed as answer by Rajat Arya Wednesday, January 07, 2009 12:59 AM
    Wednesday, January 07, 2009 12:59 AM