PC Review


Reply
Thread Tools Rate Thread

C# 2.0.50727 compiler crashes

 
 
tsahiasher@gmail.com
Guest
Posts: n/a
 
      22nd Nov 2007
the following code crashes my csc.exe (visual studio 2005):

project Base
references: System
BaseClass.cs:
namespace Base
{
public class BaseClass<T>
{
public void BaseFunc()
{
Console.WriteLine("BaseFunc");
}
}
}

project Type
references: System
TClass.cs:
namespace Type
{
public class TClass
{
public void TFunc()
{
Console.WriteLine("TFunc");
}
}
}

project Derived
references: System, Base, Type
DerivedClass.cs:
using Base;
using Type;

namespace Derived
{
public class DerivedClass : BaseClass<TClass>
{
public void DerivedFunc()
{
Console.WriteLine("DerivedFunc");
}
}
}

namespace Main
references: System, Base, Derived
Program.cs:
using Derived;

namespace ConsoleApplication1
{
class Program
{
DerivedClass _obj;

static void Main(string[] args)
{
Program x = new Program();
x.MainFunc();
}

public void MainFunc()
{
_obj = new DerivedClass();
_obj.DerivedFunc();
_obj.BaseFunc(); //crash point
}
}
}

the problem is at calling _obj.BaseFunc(); in Program.MainFunc(). if
you comment this out, the compilation succeeds. another option is to
add a reference to Type in project Main. the thing is, i don't want to
add a reference in Main to a project i'm not using directly, or even
have access to any methods defined in it. i'd like to have as much
seperation between projects as possible.
besides, if this is a syntax error, i should get an error message, not
a compiler crash.

any solutions?
 
Reply With Quote
 
 
 
 
Marc Gravell
Guest
Posts: n/a
 
      22nd Nov 2007
But Derived depends intrinsically on TClass from Type, so I don't see
any way you can avoid this.

I can confirm it dies horribly in 2005, but among the fatal compiler
errors (after the error report) is what you were looking for:

Error 1 The type 'Type.TClass' is defined in an assembly that is not
referenced. You must add a reference to assembly 'Type,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. D:\Develop\Test
\Final\Program.cs 20 13 Final

You can't get around this. The solution is to add the necessary
reference.

However, I have tested it in VS2008, and it works fine - i.e. the
above is the *only* error message (no compiler panic). So it looks
like this has been fixed in the new compiler.
 
Reply With Quote
 
tsahiasher@gmail.com
Guest
Posts: n/a
 
      25th Nov 2007
On Nov 22, 5:53 pm, Marc Gravell <marc.grav...@gmail.com> wrote:
> But Derived depends intrinsically on TClass from Type, so I don't see
> any way you can avoid this.
>
> I can confirm it dies horribly in 2005, but among the fatal compiler
> errors (after the error report) is what you were looking for:
>
> Error 1 The type 'Type.TClass' is defined in an assembly that is not
> referenced. You must add a reference to assembly 'Type,
> Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. D:\Develop\Test
> \Final\Program.cs 20 13 Final
>
> You can't get around this. The solution is to add the necessary
> reference.
>
> However, I have tested it in VS2008, and it works fine - i.e. the
> above is the *only* error message (no compiler panic). So it looks
> like this has been fixed in the new compiler.


then how come there is no problem if i comment out the call to
_obj.BaseFunc() in Program.MainFunc()? if this was a reference
problem, then it wouldn't have mattered if i call this method or not.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Security Exception Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42 wenning@kvsa.nl Microsoft ASP .NET 5 23rd Aug 2006 02:26 PM
Problems with ASP.NET v2.0.50727 benb Microsoft ASP .NET 2 7th Aug 2006 01:57 PM
.NET Framework 2.0.50727 Cat Microsoft Dot NET 5 6th Oct 2005 02:31 PM
compiler crashes and can't run asp projects anymore Kris Desmadryl Microsoft Dot NET 0 15th Nov 2004 03:08 PM
fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'f:\vs70builds\3077\vc\Compiler\Utc\src\P2\main.c', line 148) PufferFish Microsoft VC .NET 10 6th Aug 2004 10:33 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:47 PM.