Wiki

Ticket #364 (new defect)

Opened 11 years ago

Last modified 11 years ago

Cobra snapshot may have been compiled on .NET 4.5 and inadvertently introduced a dependency

Reported by: nerdzero Owned by:
Priority: medium Milestone:
Component: Cobra Compiler Version: 0.9.6
Keywords: snapshot Cc: thriwkin@…

Description

I was installing Cobra on a new box for testing some older patches. The OS is Ubuntu 12.04 LTS.

I installed the prerequisites:

sudo apt-get install mono-runtime mono-dmcs mono-xbuild

This installed Mono 2.10.8.1

I downloaded the latest source from subversion:

svn co http://cobra-language.com/svn/cobra/trunk/ cobra

I executed the installer:

cd cobra/Source
sudo bin/install-from-workspace

I got this exception:

Compiling installation program...
Missing method System.Environment::get_CurrentManagedThreadId() in assembly /usr/lib/mono/4.0/mscorlib.dll, referenced in assembly /home/ramon/cobra/Source/Snapshot/cobra.exe

Unhandled Exception: System.MissingMethodException: Method not found: 'System.Environment.get_CurrentManagedThreadId'.
  at Cobra.Core_ert_b2a27b97480f2efb38f55a0042ba2a48.Extend_IEnumerable__T__ExtendIEnumerable.Numbered[FileSpec] (IEnumerable`1 _lh_this) [0x00000] in <filename unknown>:0
  at Compiler._compile1 (.CompileParams params) [0x00000] in <filename unknown>:0
  at Compiler.Compile (.CompileParams params) [0x00000] in <filename unknown>:0
  at CommandLine.DoCompile (System.Collections.Generic.List`1 paths, Boolean willPrintSuccessMsg, Boolean writeTestInvocation, System.Predicate`1 stopCompilation) [0x00000] in <filename unknown>:0
  at CommandLine.DoRun (System.Collections.Generic.List`1 paths) [0x00000] in <filename unknown>:0
  at CommandLine.Run (System.Collections.Generic.List`1 args) [0x00000] in <filename unknown>:0
  at CommandLine.Run () [0x00000] in <filename unknown>:0
  at CobraMain.Main () [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Method not found: 'System.Environment.get_CurrentManagedThreadId'.
  at Cobra.Core_ert_b2a27b97480f2efb38f55a0042ba2a48.Extend_IEnumerable__T__ExtendIEnumerable.Numbered[FileSpec] (IEnumerable`1 _lh_this) [0x00000] in <filename unknown>:0
  at Compiler._compile1 (.CompileParams params) [0x00000] in <filename unknown>:0
  at Compiler.Compile (.CompileParams params) [0x00000] in <filename unknown>:0
  at CommandLine.DoCompile (System.Collections.Generic.List`1 paths, Boolean willPrintSuccessMsg, Boolean writeTestInvocation, System.Predicate`1 stopCompilation) [0x00000] in <filename unknown>:0
  at CommandLine.DoRun (System.Collections.Generic.List`1 paths) [0x00000] in <filename unknown>:0
  at CommandLine.Run (System.Collections.Generic.List`1 args) [0x00000] in <filename unknown>:0
  at CommandLine.Run () [0x00000] in <filename unknown>:0
  at CobraMain.Main () [0x00000] in <filename unknown>:0

I googled the exception and got this hit:

 http://marcgravell.blogspot.de/2012/09/iterator-blocks-missing-methods-and-net.html

I haven't had the chance to test on .NET 4.0. Need to find a system that doesn't have 4.5

Change History

Changed 11 years ago by thriwkin

See also:
 http://cobra-language.com/forums/viewtopic.php?f=4&t=17243

Cobra cannot this: "Multitargeting"
 http://msdn.microsoft.com/en-us/library/hh264223.aspx
 http://msdn.microsoft.com/en-us/library/bb398197.aspx

Essentially this works with
1. the 'reference assemblies', and
2. these two compiler commandline options (like those of the C# compiler):
-nostdlib (Do not reference standard library: mscorlib.dll, Cobra.Core.dll)
-noconfig (Do not implicitly reference assemblies: System.dll, System.Core.dll)

If anyone is interested, I could provide details about this.

Changed 11 years ago by nerdzero

  • priority changed from critical to medium

Ah, yes. That explains the dejavu. I am downgrading the priority from critical as this does not affect 0.9.6 but only the svn version.

Changed 11 years ago by thriwkin

  • cc thriwkin@… added

Changed 11 years ago by Charles

It happened in svn when I made a new snashot (see CobraWorkspace/Source/Snapshot?) on a machine that had .NET 4.5 that I thought had .NET 4.0. We could revert the snapshot and try again, maybe making the snapshot on a machine with Mono 2.10 or seeing if passing some -native-compiler and native-compiler-args on Windows does the trick.

Note: See TracTickets for help on using tickets.