[Mono-dev] __MonoCS__ no longer defined?

Greg Young gregoryyoung1 at gmail.com
Wed Jan 4 21:17:51 UTC 2017


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/ConsoleApplication.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/ConsoleApplication.pdb'
to '/home/greg/src/shitbird/ConsoleApplication/ConsoleApplication/bin/Debug/ConsoleApplication.pdb'
Copying file from
'/home/greg/src/shitbird/ConsoleApplication/ConsoleApplication/obj/Debug/ConsoleApplication.exe'
to '/home/greg/src/shitbird/ConsoleApplication/ConsoleApplication/bin/Debug/ConsoleApplication.exe'
Done building project
"/home/greg/src/shitbird/ConsoleApplication/ConsoleApplication/ConsoleApplication.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


More information about the Mono-devel-list mailing list