Re: Internal constructor "visible" outside of assembly. (BUG IN COMPILER CONFIRMED, EXACT CODEEXAMPLE TO REPRODUCE INCLUDED)
From: Martin Oddman (spam_at_me.not)
Date: 08/12/04
- Next message: Ollie: ""Path 'POST' is forbidden""
- Previous message: Martin Oddman: "Re: Internal constructor "visible" outside of assembly. Compiler bug?"
- In reply to: Martin Oddman: "Re: Internal constructor "visible" outside of assembly. (BUG IN COMPILER CONFIRMED, EXACT CODEEXAMPLE TO REPRODUCE INCLUDED)"
- Next in thread: JD: "Re: Internal constructor "visible" outside of assembly. (BUG IN COMPILER CONFIRMED, EXACT CODEEXAMPLE TO REPRODUCE INCLUDED)"
- Reply: JD: "Re: Internal constructor "visible" outside of assembly. (BUG IN COMPILER CONFIRMED, EXACT CODEEXAMPLE TO REPRODUCE INCLUDED)"
- Reply: JD: "Re: Internal constructor "visible" outside of assembly. (BUG IN COMPILER CONFIRMED, EXACT CODEEXAMPLE TO REPRODUCE INCLUDED)"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 12 Aug 2004 17:40:04 +0200
LOL, it does compile in MONO but not in Microsofts own compiler.
Nice work Microsoft!!!
Delenda est Microsoft
/martin...
Martin Oddman wrote:
> I have made some research on this and found out an obvious bug in
> the compiler.
> If you have one internal constructor and one public constructor with
> the same number of arguments and the internal constructor have an
> argument with a reference to a class that shall not be accessible
> for classes that calls the public constructor then you get this
> error.
> I hadn't noticed that in my first mail so my first example wasn't
> 100% correct. Here is an exact exempel how to reproduce it:
>
> /*******************************************************************/
> /*** Create a project called Foo.Datamanager. ***/
> /*** Create a file in that project named TransactionHandler.cs ***/
> /*** and paste this code into that file. ***/
> /*******************************************************************/
>
> namespace Foo.DataManager {
> public class TransactionHandler {
> public TransactionHandler(){
> }
> }
> }
>
> /*******************************************************************/
> /*** Create a project called Foo.Kernel. ***/
> /*** Create a file in that project named CategoryItem.cs ***/
> /*** and paste this code into that file. ***/
> /*** Then make a reference from this project to Foo.Datamanager. ***/
> /*******************************************************************/
>
> using Foo.DataManager;
>
> namespace Foo.Kernel {
>
> public class CategoryItem {
>
> public CategoryItem(){
> }
>
> public CategoryItem(string s){
> }
> internal CategoryItem(TransactionHandler transaction) {
> }
>
> }
> }
>
> /*******************************************************************/
> /*** Create a project called Foo.UserInterface. ***/
> /*** Create a file in that project named UserInterface.cs ***/
> /*** and paste this code into that file. ***/
> /*** Then make a reference from this project to Foo.Kernel. ***/
> /*******************************************************************/
>
> using Foo.Kernel;
>
> namespace Foo.UserInterface {
> public class GUI {
> public void AddItem(){
> CategoryItem category = new CategoryItem(s); }
> }
> }
>
> /*******************************************************************/
> /*******************************************************************/
> /*******************************************************************/
>
> If I remove either the middle constructor or the last constructor in
> CategoryItem it works.
> If I put an extra dummy argument on the internal constructor, so the
> internal and public constructor get different number of arguments it
> also works.
> And one other funny thing is that it also works as long as you just
> use the default constructor and not the CategoryItem(s) constructor
> from the UserInterface class...
> But as soon as the public and the internal constructors has the same
> numbers of arguments I get this error message when trying to compile:
>
> error CS0012: The type 'Foo.DataManager.TransactionHandler' is
> defined in an assembly that is not referenced. You must add a
> reference to assembly 'Foo.DataManager'.
> It doesn't even matter what type the argument of the public
> constructor has.
>
> I can't see this is anything than a bug in the compiler.
>
> /Martin
>
>
- Next message: Ollie: ""Path 'POST' is forbidden""
- Previous message: Martin Oddman: "Re: Internal constructor "visible" outside of assembly. Compiler bug?"
- In reply to: Martin Oddman: "Re: Internal constructor "visible" outside of assembly. (BUG IN COMPILER CONFIRMED, EXACT CODEEXAMPLE TO REPRODUCE INCLUDED)"
- Next in thread: JD: "Re: Internal constructor "visible" outside of assembly. (BUG IN COMPILER CONFIRMED, EXACT CODEEXAMPLE TO REPRODUCE INCLUDED)"
- Reply: JD: "Re: Internal constructor "visible" outside of assembly. (BUG IN COMPILER CONFIRMED, EXACT CODEEXAMPLE TO REPRODUCE INCLUDED)"
- Reply: JD: "Re: Internal constructor "visible" outside of assembly. (BUG IN COMPILER CONFIRMED, EXACT CODEEXAMPLE TO REPRODUCE INCLUDED)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|