Thief007 / swingamesdk

Automatically exported from code.google.com/p/swingamesdk
1 stars 2 forks source link

TypeLoadException in C# SDK. #30

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Download and install the C# template for SwinGame SDK (3 beta) from the 
SwinGame website.
2. Open Visual Studio 2010 or Visual C# Express 2010 and create a new project 
with the SwinGame template.
3. Run the project with a debugger attached.

What is the expected output? What do you see instead?
Expected: A window will be shown with a blank screen, as specified in the 
default code in `Main.cs`.
Actual result: Various exceptions of type `System.TypeLoadException` are thrown.

What version of the product are you using? On what operating system?
C# Visual Studio 2010 template SwinGame 3 Beta. Download from 
http://mercury.it.swin.edu.au/acain/media/SwinGame/SwinGame%203.0%20Beta/SwinGam
e%203.0%20Beta%20C%23%20Template%20Installer.vsi

Issue replicated on 3 computers, running either Windows 7 x64 or Windows 7 x86.

Please provide any additional information below.

The exception of type System.TypeLoadException has the `Message` field set to 
"Could not load type 'SwinGame.Audio' from assembly 'SwinGame, Version=1.0.0.0, 
Culture=neutral, PublicKeyToken=null'.".

The actual type, in this case SwinGame.Audio corresponds to the class called. 
SwinGame.Audio.OpenAudio(), for example, will throw an exception that 
SwinGame.Audio could not be loaded. SwinGame.Graphics.OpenGraphicsWindow(...) 
will have an exception with the message "Could not load type 
'SwinGame.Graphics' from assembly 'SwinGame, Version=1.0.0.0, Culture=neutral, 
PublicKeyToken=null'.".

Attached is a brand new project created from the template that has this issue.

Original issue reported on code.google.com by freedomp...@gmail.com on 27 Aug 2011 at 2:46

GoogleCodeExporter commented 8 years ago
After a night of sleeplessness, I've isolated the issue down to project naming.

Since I created my project with the project name "SwinGame", attempts to load 
an assembly with the full name "SwinGame, Version=1.0.0.0, Culture=neutral, 
PublicKeyToken=null" will result in an ambiguity between the SwinGame.dll 
library and the currently loaded assembly. In this case, the CLR does not load 
the SwinGame.dll library, and any expected types will cannot be loaded.

Please consider documenting this issue on the download page, in the comments, 
or perhaps prevent this name from being used altogether, if possible.

Original comment by freedomp...@gmail.com on 28 Aug 2011 at 3:09

GoogleCodeExporter commented 8 years ago
An alternative would be to sign the library.

Original comment by freedomp...@gmail.com on 17 Sep 2011 at 6:03