[Mono-bugs] [Bug 558305] New: Can't call empty partial methods

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Nov 25 05:33:50 EST 2009


http://bugzilla.novell.com/show_bug.cgi?id=558305

http://bugzilla.novell.com/show_bug.cgi?id=558305#c0


           Summary: Can't call empty partial methods
    Classification: Mono
           Product: Mono: Compilers
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: dans at houmus.org
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2b3)
Gecko/20091115 Firefox/3.6b3

I'm using LightSpeed, which generates the following classes:

    [System.CodeDom.Compiler.GeneratedCode("LightSpeedModelGenerator",
"1.0.0.0")]
    public static partial class BookCatalogDtoExtensions
    {
      static partial void CopyBookCatalogDtoBase(Entity entity,
BookCatalogDtoBase dto);
      static partial void CopyBookCatalogDtoBase(BookCatalogDtoBase dto, Entity
entity);

      static partial void BeforeCopyAuthor(Author entity, AuthorDto dto);
      static partial void AfterCopyAuthor(Author entity, AuthorDto dto);
      static partial void BeforeCopyAuthor(AuthorDto dto, Author entity);
      static partial void AfterCopyAuthor(AuthorDto dto, Author entity);

      private static void CopyAuthor(Author entity, AuthorDto dto)
      {
        BeforeCopyAuthor(entity, dto);
        CopyBookCatalogDtoBase(entity, dto);
        dto.Name = entity.Name;
        dto.Code = entity.Code;
        AfterCopyAuthor(entity, dto);
      }

      private static void CopyAuthor(AuthorDto dto, Author entity)
      {
        BeforeCopyAuthor(dto, entity);
        CopyBookCatalogDtoBase(dto, entity);
        entity.Name = dto.Name;
        entity.Code = dto.Code;
        AfterCopyAuthor(dto, entity);
      }
      ....
    }

As you can see, the CopyAuthor method calls the empty partial methods
BeofreCopyAuthor and AfterCopyAuthor.
These methods are defined by LightSpeed as:
      static partial void BeforeCopyAuthor(Author entity, AuthorDto dto);
      static partial void AfterCopyAuthor(Author entity, AuthorDto dto);
      static partial void BeforeCopyAuthor(AuthorDto dto, Author entity);
      static partial void AfterCopyAuthor(AuthorDto dto, Author entity);

And are not defined anywhere else in the code.
According to the "specification" for partial methods, these calls should be
removed by the compiler entirely.


Reproducible: Always

Steps to Reproduce:
Try to call an empty partial method
Actual Results:  
Compiler error

Expected Results:  
Should compile cleanly

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list