[Mono-dev] __MonoCS__ no longer defined?

Alexander Köplinger alkpli at microsoft.com
Wed Jan 4 22:29:17 UTC 2017


__MonoCS__ is a define in C# source, not an msbuild property (which the /p sets).

You need to add __MonoCS__ to <DefineConstants> in your csproj.

- Alex

> On 04 Jan 2017, at 23:13, Greg Young <gregoryyoung1 at gmail.com> wrote:
> 
> Also it appears
> 
> ➜  shitbird xbuild /p:__MonoCS__="true"
> ./ConsoleApplication/ConsoleApplication.sln
> 
> etc doesn't work. I figured /p: would work?
> 
> On Wed, Jan 4, 2017 at 11:42 PM, Greg Young <gregoryyoung1 at gmail.com> wrote:
>> What i mean by breaking is no longer shipping mcs. A build flag of
>> --with-mcs would prevent other projects from needing to say "if you
>> want to build version < X on mono > Y you must custom compile mono".
>> Saying use compile time flag --with-mcs would be a lot more palatable.
>> 
>> On Wed, Jan 4, 2017 at 11:30 PM, Greg Young <gregoryyoung1 at gmail.com> wrote:
>>> This is a rather large breaking change no?
>>> 
>>> On Wed, Jan 4, 2017 at 11:25 PM, Jon Purdy <jopur at microsoft.com> wrote:
>>>> __MonoCS__ is defined by mcs. Master is now using csc (Roslyn) on most
>>>> systems. You can configure with --with-csc=mcs to keep using mcs, or maybe
>>>> define __MonoCS__ yourself (not sure if this would break anything).
>>>> 
>>>> 
>>>> On 1/4/17, 1:17 PM, "Mono-devel-list on behalf of Greg Young"
>>>> <mono-devel-list-bounces at lists.dot.net on behalf of
>>>> gregoryyoung1 at gmail.com> wrote:
>>>> 
>>>>> I just pulled master today and am suddenly getting loads of errors in
>>>>> our unit test suite how kernel32 is not defined. EG Exception below.
>>>>> However all places where this is used are wrapped with
>>>>> 
>>>>> I was building on master recently without any issues. It appears
>>>>> __MonoCS__ is not defined?!
>>>>> 
>>>>>       public static uint GetDriveSectorSize(string path)
>>>>>       {
>>>>> #if !__MonoCS__ && !USE_UNIX_IO
>>>>>           //snip
>>>>>           WinNative.GetDiskFreeSpace(Path.GetPathRoot(path), out
>>>>> dontcare, out size, out dontcare, out dontcare);
>>>>> #else
>>>>>           //snip
>>>>> #endif
>>>>>       }
>>>>> 
>>>>> We are seeing this everywhere we have __MonoCS__
>>>>> 
>>>>> 
>>>>> So I decided to write a test:
>>>>> 
>>>>> ?  ConsoleApplication cat ConsoleApplication/Program.cs
>>>>> using System;
>>>>> using System.Collections.Generic;
>>>>> 
>>>>> namespace ConsoleApplication
>>>>> {
>>>>>   internal class Program
>>>>>   {
>>>>>       public static void Main(string[] args)
>>>>>       {
>>>>> #if __MonoCS__
>>>>>   Console.WriteLine("shitbird");
>>>>> #else
>>>>>   Console.WriteLine("wtf?");
>>>>> #endif
>>>>>       }
>>>>>   }
>>>>> }%
>>>>> 
>>>>> 
>>>>> ?  ConsoleApplication xbuild --version
>>>>> XBuild Engine Version 14.0
>>>>> Mono, Version 4.9.0.0
>>>>> Copyright (C) 2005-2013 Various Mono authors
>>>>> MSBUILD: error MSBUILD0000: Project file '--version' not found.
>>>>> ?  ConsoleApplication xbuild ConsoleApplication.sln
>>>>> XBuild Engine Version 14.0
>>>>> Mono, Version 4.9.0.0
>>>>> Copyright (C) 2005-2013 Various Mono authors
>>>>> 
>>>>> Build started 1/4/2017 9:16:26 PM.
>>>>> __________________________________________________
>>>>> Project
>>>>> "/home/greg/src/shitbird/ConsoleApplication/ConsoleApplication.sln"
>>>>> (default target(s)):
>>>>> Target ValidateSolutionConfiguration:
>>>>> Building solution configuration "Debug|Any CPU".
>>>>> Target Build:
>>>>> Project
>>>>> "/home/greg/src/shitbird/ConsoleApplication/ConsoleApplication/ConsoleAppl
>>>>> ication.csproj"
>>>>> (default target(s)):
>>>>> Target PrepareForBuild:
>>>>> Configuration: Debug Platform: AnyCPU
>>>>> Target GenerateSatelliteAssemblies:
>>>>> No input files were specified for target GenerateSatelliteAssemblies,
>>>>> skipping.
>>>>> Target CoreCompile:
>>>>> Tool /opt/mono/lib/mono/4.5/csc.exe execution started with arguments:
>>>>> /noconfig /debug:portable /debug:portable /optimize-
>>>>> /out:obj/Debug/ConsoleApplication.exe Program.cs
>>>>> Properties/AssemblyInfo.cs
>>>>> obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs /target:exe
>>>>> /define:"DEBUG;TRACE" /nostdlib /platform:AnyCPU
>>>>> /reference:/opt/mono/lib/mono/4.5-api/System.dll
>>>>> /reference:/opt/mono/lib/mono/4.5-api/System.Xml.Linq.dll
>>>>> /reference:/opt/mono/lib/mono/4.5-api/System.Data.DataSetExtensions.dll
>>>>> /reference:/opt/mono/lib/mono/4.5-api/System.Data.dll
>>>>> /reference:/opt/mono/lib/mono/4.5-api/System.Xml.dll
>>>>> /reference:/opt/mono/lib/mono/4.5-api/System.Core.dll
>>>>> /reference:/opt/mono/lib/mono/4.5-api//mscorlib.dll /warn:4
>>>>> Microsoft (R) Visual C# Compiler version 2.0.0.61205
>>>>> Copyright (C) Microsoft Corporation. All rights reserved.
>>>>> Target DeployOutputFiles:
>>>>> Copying file from
>>>>> '/home/greg/src/shitbird/ConsoleApplication/ConsoleApplication/obj/Debug/C
>>>>> onsoleApplication.pdb'
>>>>> to
>>>>> '/home/greg/src/shitbird/ConsoleApplication/ConsoleApplication/bin/Debug/C
>>>>> onsoleApplication.pdb'
>>>>> Copying file from
>>>>> '/home/greg/src/shitbird/ConsoleApplication/ConsoleApplication/obj/Debug/C
>>>>> onsoleApplication.exe'
>>>>> to
>>>>> '/home/greg/src/shitbird/ConsoleApplication/ConsoleApplication/bin/Debug/C
>>>>> onsoleApplication.exe'
>>>>> Done building project
>>>>> "/home/greg/src/shitbird/ConsoleApplication/ConsoleApplication/ConsoleAppl
>>>>> ication.csproj".
>>>>> Done building project
>>>>> "/home/greg/src/shitbird/ConsoleApplication/ConsoleApplication.sln".
>>>>> 
>>>>> Build succeeded.
>>>>> 0 Warning(s)
>>>>> 0 Error(s)
>>>>> 
>>>>> Time Elapsed 00:00:01.9957420
>>>>> ?  ConsoleApplication mono
>>>>> ./ConsoleApplication/bin/Debug/ConsoleApplication.exe
>>>>> wtf?
>>>>> 
>>>>> And it appears __MonoCS__ is no longer defined
>>>>> 
>>>>> 
>>>>> System.DllNotFoundException: KERNEL32
>>>>> at (wrapper managed-to-native)
>>>>> EventStore.Core.TransactionLog.Unbuffered.WinNative:GetDiskFreeSpace
>>>>> (string,uint&,uint&,uint&,uint&)
>>>>> at
>>>>> EventStore.Core.TransactionLog.Unbuffered.NativeFile.GetDriveSectorSize
>>>>> (System.String path) [0x00006] in <d6d24c88c72345b79de5eca974e19875>:0
>>>>> at EventStore.Core.TransactionLog.Unbuffered.UnbufferedFileStream.Create
>>>>> (System.String path, System.IO.FileMode mode, System.IO.FileAccess
>>>>> acc, System.IO.FileShare share, System.Boolean sequential,
>>>>> System.Int32 internalWriteBufferSize, System.Int32
>>>>> internalReadBufferSize, System.Boolean writeThrough, System.UInt32
>>>>> minBlockSize) [0x00000] in <d6d24c88c72345b79de5eca974e19875>:0
>>>>> at EventStore.Core.Index.PTable.CacheMidpointsAndVerifyHash
>>>>> (System.Int32 depth) [0x0002e] in <d6d24c88c72345b79de5eca974e19875>:0
>>>>> at EventStore.Core.Index.PTable..ctor (System.String filename,
>>>>> System.Guid id, System.Int32 initialReaders, System.Int32 maxReaders,
>>>>> System.Int32 depth) [0x002a5] in <d6d24c88c72345b79de5eca974e19875>:0
>>>>> at EventStore.Core.Index.PTable.FromMemtable
>>>>> (EventStore.Core.Index.IMemTable table, System.String filename,
>>>>> System.Int32 cacheDepth) [0x0018d] in
>>>>> <d6d24c88c72345b79de5eca974e19875>:0
>>>>> at EventStore.Core.Index.TableIndex.ReadOffQueue () [0x000b3] in
>>>>> <d6d24c88c72345b79de5eca974e19875>:0
>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> Studying for the Turing test
>>>>> _______________________________________________
>>>>> Mono-devel-list mailing list
>>>>> Mono-devel-list at lists.dot.net
>>>>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.dot.
>>>>> net%2Fmailman%2Flistinfo%2Fmono-devel-list&data=02%7C01%7Cjopur%40microsof
>>>>> t.com%7Cc47bb70efa0e47145d8a08d434e729a5%7C72f988bf86f141af91ab2d7cd011db4
>>>>> 7%7C1%7C0%7C636191614832257156&sdata=UqAocpYwtgbnVJc%2FsmvGH7XPnO42jk5Ivf9
>>>>> AEd8sojQ%3D&reserved=0
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> Studying for the Turing test
>> 
>> 
>> 
>> --
>> Studying for the Turing test
> 
> 
> 
> -- 
> Studying for the Turing test
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.dot.net
> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.dot.net%2Fmailman%2Flistinfo%2Fmono-devel-list&data=02%7C01%7Calkpli%40microsoft.com%7C41a86650c59d49d2d81908d434eef3ed%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636191648285788247&sdata=IkTi2YHk9R36PG53HF3GZV0qW7yjYP9BMXaUqLePXCU%3D&reserved=0



More information about the Mono-devel-list mailing list