473,379 Members | 1,317 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

TypeloadException with static method

my problem is as follows:

abstract class A
{
abstract Foo();
static Doit()
{
A = new B();
}
}

class B : A
{
override Foo(){}
}

When I call B.DoIt(); a Typeloadexception occurs.

I extremely simplified the problem here but you basically see what its going
on. In my little example here the TypeloadException doesn't occur (I cannot
reproduce it without my whole app). But I have to note that I have the
problem since I changed Foo() from virtual to abstract. When I change it
back it works fine.

Any ideas?

--
cody

Freeware Tools, Games and Humour
http://www.deutronium.de.vu
[noncommercial and no fucking ads]
Jul 21 '05 #1
1 1535
Hi.

I tried your code (I added some public modifiers) and it worked smoothly
with .NET SDK 1.1.

If you want I can send privately the C# source I used.

Have a nice day
GV

"cody" <de********@gmx.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
my problem is as follows:

abstract class A
{
abstract Foo();
static Doit()
{
A = new B();
}
}

class B : A
{
override Foo(){}
}

When I call B.DoIt(); a Typeloadexception occurs.

I extremely simplified the problem here but you basically see what its going on. In my little example here the TypeloadException doesn't occur (I cannot reproduce it without my whole app). But I have to note that I have the
problem since I changed Foo() from virtual to abstract. When I change it
back it works fine.

Any ideas?

--
cody

Freeware Tools, Games and Humour
http://www.deutronium.de.vu
[noncommercial and no fucking ads]

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: daechulsohn | last post by:
Just thought I would contribute some knowledge for a change. After hours tracking down a problem with obfuscated code, where we were getting the exception : System.TypeLoadException: Method a...
1
by: cody | last post by:
my problem is as follows: abstract class A { abstract Foo(); static Doit() { A = new B(); } }
2
by: Eli Block | last post by:
When getting a type from a dynamically loaded assembly using Assembly.GetType, I receive the following exception: An unhandled exception of type 'System.TypeLoadException' occurred in...
1
by: @ndre | last post by:
Any type declaration of double leads to a TypeLoadException when run in cf (no compilation error), i.e. cf = reduced c# set??? see example below comments? @ndre this compiles with cf, but give...
0
by: Tintax | last post by:
Hi All, I'm trying to create a generic node class for generating class hierarchies like XmlNode/XmlDocument. Unfortunately I'm running into an interesting problem where my code compiles fine but...
0
by: Dmitry Shuklin | last post by:
I make __value type with some private fields. I want to implement System.ISerializable for custom serialization public __value struct NativeHandle : public...
0
by: ryan groth | last post by:
Every three or four compiles I get a TypeLoadException everytime I run a web application on the same one or two dlls. The exception information is vauge, no file errors, no permission errors, no...
0
by: Pierre-Alain Vigeant | last post by:
Hi, I'm getting a TypeLoadException inside an object that is located in a DLL that is dynamically loaded. I have this main program "main.exe" that dynamically load "main.dll" using o =...
1
by: Fredo | last post by:
I'm getting the following error when I'm running my application (application name changed for the example): Unhandled Exception: System.TypeLoadException: Method get_ImageFile in type...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.