
.Net 4.0 compatibility
Posted Monday, 22 March, 2010 - 22:13 by bandit| Project: | The Open Toolkit library |
| Version: | 1.x-dev |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | confirmed |
Jump to:
Description
I'm using VS2010 RC und win7 x64 and newest SVN version of OpenTK. I also have the bug which was already discussed befor. OpenTK.Examples and OpenTK.Compatibility which decline to reference to OpenTK.dll.
MethodAccesException breaks on this line in API.cs
Debug.Print("Initializing threaded X11: {0}.", Functions.XInitThreads().ToString());
It really depends on settings of target framework, cause the following line throws DisplayDevice exception:
public TestClass() : base(640, 480, GraphicsMode.Default, "Test") //this will help us track down bugs { }
I already tried different ways of assigning privileges to the project, changing target framework and x86/x64 target architecture. Does anyone already stumbled upon this issues and found a solution?


Comments
#11
Prebuild has a bug that could result in incorrect solution paths and cause conversion to fail in some cases. OpenTK 1.0 rc1 contains a workaround for this issue - worth a try.
Most of the issues seem to stem from the new security model in .Net 4.0. As a temporary workaround, you can try adding:
to the OpenTK project (e.g. in AssemblyInfo.cs) and see if that allows the code to work.
#12
I'm using the current 1.0 branch from the svn repository.
Replacing the existing security rule for OpenTK with [assembly: System.Security.SecurityRules(System.Security.SecurityRuleSet.Level1)] makes the examples indeed working, thanks.
#13
Reading through the issue-posting at MS connect that bandit posted, the problem with the conversion to a full .NET 4.0 project comes from OpenTK originally targetting the v2.0 tools (vs2005 presumably), which vs2010 does not automatically convert. To fix this, the OpenTK build process would have to target v3.5 of the framework tools (and of .NET I guess), which may not be wanted, or a separate vs2010 profile for the building tools (this seems to lack support from the Prebuild side currently, right?).
What's the general idea about targetting .NET versions along with visual studio versions, like should all profiles target v2.0 (the current vs2008 build does that)? I could not get vs2010/rc to compile OpenTK targetting .NET 2.0, anybody succeeded with that?
#14
I have installed VS2010 and tested OpenTK with that. It works after applying the correct SecurityRulesAttribute. SVN r2679 now contains this attribute, which is conditionally compiled if "NET40" is #defined.
The first step towards a complete solution would be to add a 4.0 target to Build.exe (I'll post a new issue report for that). For a complete solution we should try to see if it is possible to make OpenTK work with the new Level2 SecurityRuleSet.
#15