0
votes

I am debugging a modified C# pure .NET CoreCLR Hello World application compiled with the Roslyn csc.exe compiler. The Hello World C# program is shown below:

using System;

namespace TestingMonoDevelop6.0
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string value = "one";
            Console.WriteLine("Hello World!");
        }
    }
}

This is the Roslyn csc.exe compiler directive and result:

Building TestingMonoDevelop6.0 (Debug|x86) Executing: /home/venkat/roslyn/Binaries/Debug/csc.exe /noconfig /nostdlib /debug:portable /out:/home/venkat/Caisse/Caisse/bin/Debug/Caisse.exe /r:/home/venkat/Sandbox/Microsoft.CodeAnalysis.dll /r:/home/venkat/Sandbox/Microsoft.Data.Sq

Microsoft (R) Visual C# Compiler version 42.42.42.42 Copyright (C) Microsoft Corporation. All rights reserved.

Program.cs(9,11): warning CS0219: The variable 'value' is assigned but its value is never used

---------------------- Done ----------------------

Build successful.

Here is the Ubuntu Linux 14.04 LTS mono version and path.

[mono-2015.12.15+14.05.01]venkat@clickit:~/monodevelop$ which mono /opt/mono-2015.12.15+14.05.01/bin/mono

So, I was told that Monodevelop 6.0 would support Roslyn csc.exe compilation s month ago in the github.io.mono.monodevelop forum. My first question is how do we ask Monodevelop 6.0 to compile with the Roslyn csc.exe compiler?

When I create the following Monodevelop 6.0 C# custom build step on Ubuntu : /home/venkat/roslyn/Binaries/Debug/csc.exe /noconfig /nostdlib /debug:portable /out:/home/venkat/December14/December14/bin/Debug/Program.exe /r:/home/venkat/Sandbox/Microsoft.CodeAnalysis.dll /r:/home/venkat/Sandbox/Microsoft.Data.Sqlite.dll /r:/home/venkat/.dnx/packages/System.Collections/4.0.11-beta-23409/ref/dotnet/System.Collections.dll /r:/home/venkat/.dnx/packages/System.Collections.NonGeneric/4.0.0/ref/dotnet/System.Collections.NonGeneric.dll /r:/home/venkat/.dnx/packages/System.ComponentModel/4.0.1-beta-23516/ref/dotnet5.1/System.ComponentModel.dll /r:/home/venkat/Sandbox/System.dll /r:/home/venkat/.dnx/packages/System.Data.Common/4.0.1-beta-23516/ref/dotnet5.1/System.Data.Common.dll /r:/home/venkat/.dnx/packages/System.Xml.ReaderWriter/4.0.10-beta-22816/lib/contract/System.Xml.ReaderWriter.dll /r:/home/venkat/.dnx/packages/System.Xml.XmlDocument/4.0.0-beta-22816/lib/contract/System.Xml.XmlDocument.dll /r:/home/venkat/.dnx/packages/Microsoft.CSharp/4.0.1-beta-23409/ref/dotnet/Microsoft.CSharp.dll /r:/home/venkat/Sandbox/System.Runtime.dll /r:/home/venkat/Sandbox/System.Xml.XDocument.dll /r:/home/venkat/Sandbox/System.Xml.dll /r:/home/venkat/Sandbox/System.Threading.Tasks.dll /r:/home/venkat/Sandbox/System.Linq.dll /r:/home/venkat/Sandbox/System.Xml.dll /r:/home/venkat/Sandbox/mscorlib.dll Program.cs ,

it successfully compiles. When I start debugging the Roslyn generated executable and using the Monodevelop Watch window on i, I get the following error

message: Unknown variable i

when I set a breakpoint on the Console.WriteLine("Hello World!") line.

My third question is do I have to create a Custom Execute Step in Monodevelop 6.0 for Linux referencing Corerun Program.exe instead of mono Program.exe?

1
@Derek, Have you noticed the MonoDevelop 6.0 for Linux problem with watching local variables?Frank
@Derek Van Cuyk,Have you observed the MonoDevelop 6.0 for Linux problem with watching local variables?Frank
There is a bug on the Macintosh which is a open bug at bugzilla.xamarin.com under XamarinStudio->Debugger component.Frank

1 Answers

0
votes

The answer to question 1, "how do we ask Monodevelop 6.0 to compile with the Roslyn csc.exe compiler?" is:

/home/venkat/roslyn/Binaries/Debug/csc.exe /noconfig
  /nostdlib /debug:portable
  /out:/home/venkat/December14/December14/bin/Debug/Program.exe
  /r:/home/venkat/Sandbox/Microsoft.CodeAnalysis.dll
  /r:/home/venkat/Sandbox/Microsoft.Data.Sqlite.dll
  /r:/home/venkat/.dnx/packages/System.Collections/4.0.11-beta-23409/ref/dotnet/System.Collections.dll
  /r:/home/venkat/.dnx/packages/System.Collections.NonGeneric/4.0.0/ref/dotnet/System.Collections.NonGeneric.dll
  /r:/home/venkat/.dnx/packages/System.ComponentModel/4.0.1-beta-23516/ref/dotnet5.1/System.ComponentModel.dll
  /r:/home/venkat/Sandbox/System.dll
  /r:/home/venkat/.dnx/packages/System.Data.Common/4.0.1-beta-23516/ref/dotnet5.1/System.Data.Common.dll
  /r:/home/venkat/.dnx/packages/System.Xml.ReaderWriter/4.0.10-beta-22816/lib/contract/System.Xml.ReaderWriter.dll
  /r:/home/venkat/.dnx/packages/System.Xml.XmlDocument/4.0.0-beta-22816/lib/contract/System.Xml.XmlDocument.dll
  /r:/home/venkat/.dnx/packages/Microsoft.CSharp/4.0.1-beta-23409/ref/dotnet/Microsoft.CSharp.dll
  /r:/home/venkat/Sandbox/System.Runtime.dll
  /r:/home/venkat/Sandbox/System.Xml.XDocument.dll
  /r:/home/venkat/Sandbox/System.Xml.dll
  /r:/home/venkat/Sandbox/System.Threading.Tasks.dll
  /r:/home/venkat/Sandbox/System.Linq.dll
  /r:/home/venkat/Sandbox/System.Xml.dll
  /r:/home/venkat/Sandbox/mscorlib.dll Program.cs

,

The answer to question 2 , "When I start debugging the Roslyn generated executable and using the Monodevelop Watch window on i, I get the following error message: Unknown variable i when I set a breakpoint on the Console.WriteLine("Hello World!") line.". is that the mono runtime is mdb bug free and that the Roslyn compiler on non-Window OS can produce only portable pdb's. There is an reproducible Macintosh open bug at https://bugzilla.xamarin.com/ under XamarinStudio->Debugger component.Please see https://gitter.im/dotnet/roslyn.

The answer to question 3, do I have to create a Custom Execute Step in Monodevelop 6.0 for Linux referencing Corerun Program.exe instead of mono Program.exe? Yes. In fact, if one wishes to target CoreCLR, they should use the Roslyn csc.exe compiler.