Forums

XS solutions, projects, etc.

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

XS solutions, projects, etc.

Postby DelphiGuy » Thu Feb 27, 2014 12:11 pm

i'm trying to understand XS solutions and projects. or perhaps i should say i'm trying to understand .net solutions and projects.

here's a likely place to look for info:

http://monodevelop.com/Documentation/Solutions_and_Projects_explained

but it looks like the above info may be obsolete, because when i go to (win 7) XS "file" >> "new", i'm not being offered a chance to create a "project" at all, rather only a choice of "file", "solution" or "workspace". it's a bit mystifying.

what i'd like is to be able to simultaneously write a program, plus a library, have them both open in windows or instances of XS, push one button to build all of it and be able to debug by stepping through the code, including automagically having the debugger jump from program code over to library code, as the library code is called by the program. (hope i'm using the right nomenclature.)

maybe that's all too much to ask for, but nevertheless i can't figure out how to even get two projects to be created under one solution name.

any comments, or explanatory links, very welcome. yes, i did of course google these issues, but must be not asking the right questions, because most of what i'm seeing is explanations of the difference between solutions and projects. and as you can see from the link i quoted above, the definition of "workspace" could perhaps be a little more complete.
DelphiGuy
 
Posts: 116

Re: XS solutions, projects, etc.

Postby Charles » Thu Feb 27, 2014 1:09 pm

A solution contains one or more projects. When you create a solution, XS will by default create one project underneath it. You can then right click on the solution (top node in the solution outline) and add more projects.

Also, in the solution outline, you can right click on references to get one project to reference another.

Your question has inspired me to create step by step instructions for a simple example. I'll post back here when the wiki page is ready.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: XS solutions, projects, etc.

Postby Charles » Thu Feb 27, 2014 1:42 pm

Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: XS solutions, projects, etc.

Postby nerdzero » Fri Feb 28, 2014 9:08 am

Wow, nice instructions, Charles. Spot on.

The only thing to keep in mind, DelphiGuy is that project references are a little awkward with the add-in right now in terms of code completion and compilation. If you find you are getting error messages about a DLL being locked, close all the open files, restart XS, and then it should build. These are technical limitations with the current approach. They can be addressed, but not quickly.

Also, I haven't tried cross project debugging. If you try it, report back on what works and what doesn't.
nerdzero
 
Posts: 286
Location: Chicago, IL

Re: XS solutions, projects, etc.

Postby DelphiGuy » Fri Feb 28, 2014 3:50 pm

thanks very much!

i will give this a try this weekend. nerdzero, do i need to install the latest and greatest add-in in order to optimally test this simple two-project solution?
DelphiGuy
 
Posts: 116

Re: XS solutions, projects, etc.

Postby nerdzero » Fri Feb 28, 2014 4:16 pm

Nope. This has been supported for a while so if you have a functional installation, it should work.
nerdzero
 
Posts: 286
Location: Chicago, IL

Re: XS solutions, projects, etc.

Postby DelphiGuy » Sun Mar 02, 2014 9:52 pm

Unhandled Exception: System.BadImageFormatException: Could not load file or asse
mbly 'Cobra.Core, Version=0.0.3108.1, Culture=neutral, PublicKeyToken=0a4783a5c7
c9616e' or one of its dependencies. An attempt was made to load a program with a
n incorrect format.
at Program.Main()
at MainWrapper.Main() in c:\Users\Paul\Documents\Projects\MyCompany.MyProject
\MyCompany.MyProject.Console\MainWrapper.cobra:line 3
Press any key to continue . . .


nerdzero, is this the dreaded "locked" dll error (in win 7)? or is this a different problem? yes, i know you provided instructions in this thread on what to do, and i tried them, but didn't help. same error message.

charles, i know you mentioned a "System.Core" error, but i'm not quite seeing that word. and in any event, i couldn't quite understand your advice to expand the References and then to right-click and delete. delete what? delete "System.Core"? how exactly?

here's my "Program.cobra":

Code: Select all
"""
Replace this text with a description of your program.
"""

class Program

   def main
      print 'Hello, world!'
      Console.readLine


here's my "Class1.cobra":

Code: Select all
"""
Replace this text with a description of your library.
"""

class Thing

    test
        pass

    get two as int
        return 2


here's the XS debugger exception output:

System.Runtime.InteropServices.COMException (0x80070032): The request is not supported. (Exception from HRESULT: 0x80070032)
at Microsoft.Samples.Debugging.CorDebug.NativeApi.ICorDebug.CreateProcess(String lpApplicationName, String lpCommandLine, SECURITY_ATTRIBUTES lpProcessAttributes, SECURITY_ATTRIBUTES lpThreadAttributes, Int32 bInheritHandles, UInt32 dwCreationFlags, IntPtr lpEnvironment, String lpCurrentDirectory, STARTUPINFO lpStartupInfo, PROCESS_INFORMATION lpProcessInformation, CorDebugCreateProcessFlags debuggingFlags, ICorDebugProcess& ppProcess)
at Microsoft.Samples.Debugging.CorDebug.CorDebugger.CreateProcess(String applicationName, String commandLine, SECURITY_ATTRIBUTES processAttributes, SECURITY_ATTRIBUTES threadAttributes, Boolean inheritHandles, Int32 creationFlags, IntPtr environment, String currentDirectory, STARTUPINFO startupInfo, PROCESS_INFORMATION& processInformation, CorDebugCreateProcessFlags debuggingFlags)
at Microsoft.Samples.Debugging.CorDebug.CorDebugger.CreateProcess(String applicationName, String commandLine, String currentDirectory, IDictionary`2 environment, Int32 flags)
at MonoDevelop.Debugger.Win32.CorDebuggerSession.<>c__DisplayClass5.<OnRun>b__4()
at MonoDevelop.Debugger.Win32.MtaThread.Run(Action ts)
at MonoDevelop.Debugger.Win32.CorDebuggerSession.OnRun(DebuggerStartInfo startInfo)
at Mono.Debugging.Client.DebuggerSession.<>c__DisplayClass10.<Run>b__e()
DelphiGuy
 
Posts: 116

Re: XS solutions, projects, etc.

Postby nerdzero » Mon Mar 03, 2014 9:28 am

Hmm, this sounds maybe like your project is targeting 'AnyCPU' but Cobra has been installed targeting 'x86'. It's kind of related to the locked DLL issue in that they are both caused by loading assemblies using Reflection. This only affects Windows 64-bit.

If you right-click your projects in the solution tree and select "Options", check the values in the "Build > Configuration" section. You should have "Debug|x86" and "Release|x86". If you have just "Debug" or "Debug|AnyCPU", this may be causing the issue.

You can email me a ZIP of your solution folder if you want and I'll check it out.
nerdzero
 
Posts: 286
Location: Chicago, IL

Re: XS solutions, projects, etc.

Postby Charles » Mon Mar 03, 2014 12:08 pm

Also, the error is not related to System.Core since it doesn't mention it.
Charles
 
Posts: 2515
Location: Los Angeles, CA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 90 guests

cron