Forums

'Could not load file or assembly Cobra.Lang'

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

'Could not load file or assembly Cobra.Lang'

Postby pchapin » Sat Oct 23, 2010 6:05 pm

I'm installing my Cobra from the workspace using the "install from workspace" script. I'm on Windows 7, 64 bit edition. I've updated to revision 2446. However, I am not able to execute even the most trivial Cobra program. For example I entered this program into the file Hello.cobra

class Hello
def main
print 'Hello, World!'


I attempt to run it using the command: 'cobra Hello.cobra' In response I get

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Cobra.Lang, Version=0.8.0.1, Culture=neutral, PublicKeyToken=0a4783a5c7c9616e' or one of its dependencies. The system cannot find the file specified. File name: 'Cobra.Lang, Version=0.8.0.1, Culture=neutral, PublicKeyToken=0a4783a5c7c9616e'
at Hello.Main()
at MainWrapper.Main()


Is there an additional installation step that I should be doing? Note that the command above does generate a Hello.exe. When I run that executable I get the unhandled exception I mentioned above.
pchapin
 
Posts: 46
Location: Vermont, USA

Re: 'Could not load file or assembly Cobra.Lang'

Postby Charles » Sat Oct 23, 2010 6:44 pm

Two different things to try:

1) cobra -sharp-args:"/platform:x86" hello.cobra

2) "cd C:\Windows\Microsoft.NET\Framework64\v2.0.50727" and then enter "ldr64 setwow" to force .NET programs to run as 32-bit. (You can enter "ldr64 set64" to switch back.) Then try just "cobra hello.cobra"

I'd really like to know the results you get with each of these.

When I ventured into Windows 7 64-bit I was disappointed how much the 64-bitness interfered with my .NET development. I was hoping any issues would be automatically managed by the VM leaving me to do custom tweaking only if I wanted complete control or if I needed to squeeze out extra performance. Such was not the case.

See also: http://cobra-language.com/trac/cobra/wiki/Troubleshooting

Let us know how it goes.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: 'Could not load file or assembly Cobra.Lang'

Postby pchapin » Sun Oct 24, 2010 7:52 am

I understand that there can be frustrations related to native bit sizes. I've experienced them before in other contexts. Still, it's nice to get the issues worked out, of course.

Anyway I tried both of the suggestions you mentioned. Neither of them helped. I get exactly the same exception that I mentioned in my previous post.
pchapin
 
Posts: 46
Location: Vermont, USA

Re: 'Could not load file or assembly Cobra.Lang'

Postby pchapin » Sun Oct 24, 2010 7:55 am

I should also mention that I deleted Hello.exe between each attempt. I'm not sure if this is an issue or not but since I haven't changed the source I thought it might be possible the compiler would just run the existing executable. By deleting the executable each time I forced the compiler to rebuild it. As I said, it didn't help.
pchapin
 
Posts: 46
Location: Vermont, USA

Re: 'Could not load file or assembly Cobra.Lang'

Postby zengeek » Sun Oct 24, 2010 10:09 am

hi, i had this same problem and i have the same system. I solved this by executing InstallFromWorkspace in administrator mode. Before i ran this 3 times without without admin mode it appeared to install but could not load cobra.lang assembly. When i executed in admin mode it worked successfully.
zengeek
 
Posts: 8

Re: 'Could not load file or assembly Cobra.Lang'

Postby Charles » Mon Oct 25, 2010 12:38 am

I confirm that on my Windows 7 64-bit, I can install and run properly as Admin. It's actually the only way I've ever done it which is why I was unaware of the problem pchapin and zengeek encountered. Any suggestions on how the installer should deal with this?
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: 'Could not load file or assembly Cobra.Lang'

Postby pchapin » Mon Oct 25, 2010 2:58 pm

I tried running install-from-workspace as an administrator and that did fix the problem. Thanks!

The installer already produces a warning that says if one encounters an error one should try running it as Administrator. However, the installation appeared at first glance to go fine even when executed by my ordinary user account so I didn't consider the possibility of an installer issue.

I notice at one point in the installation there is this:

==== Install Cobra standard library to the GAC

Invoking Publish.GacInstall...
Done.


Is this the part that is causing trouble when done by a non-administrator? After installing as administrator I tried rerunning install-from-workspace under my ordinary account. I carefully examined the output and I didn't see any error messages (the business about installing the standard library to the GAC seemed to succeed). However, everything also continued to work afterward. I guess the previous installation into the GAC allowed everything to work even after running the installer as an ordinary user. That's just a wild guess.

Peter
pchapin
 
Posts: 46
Location: Vermont, USA

Re: 'Could not load file or assembly Cobra.Lang'

Postby Charles » Mon Oct 25, 2010 3:21 pm

I think your guess is correct. I'm not sure why the GAC installation seemingly succeeds, when it obviously does not.

Perhaps the installer should detect if you have admin privs at the beginning and give an error if not.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: 'Could not load file or assembly Cobra.Lang'

Postby pchapin » Mon Oct 25, 2010 4:42 pm

Chuck wrote:Perhaps the installer should detect if you have admin privs at the beginning and give an error if not.


That seems like a reasonable solution to me.
pchapin
 
Posts: 46
Location: Vermont, USA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 79 guests