Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DebuggingUtils syntax error for new projects #15742

Closed
KellyThomas opened this issue Jan 15, 2018 · 7 comments
Closed

DebuggingUtils syntax error for new projects #15742

KellyThomas opened this issue Jan 15, 2018 · 7 comments

Comments

@KellyThomas
Copy link
Contributor

KellyThomas commented Jan 15, 2018

Godot version:
Godot_v3.0-rc1_mono_win64

OS/device including version:
Windows XP

Issue description:
Build fails if my project includes a c# script.

Steps to reproduce:
I have Mono 4.5.0 5.4.0 and Microsoft Build Tools 2015 installed (these were working with 3.0 beta 2)

I have deleted my C:\Users\<username>\AppData\Roaming\Godot directory.

If I create a new project and attached a new c# script to a node then when I build I receive three errors:

Core\DebuggingUtils.cs(37,42): error CS1026: ) expected 
Core\DebuggingUtils.cs(37,52): error CS1002: ; expected 
Core\DebuggingUtils.cs(37,52): error CS1513: } expected 

My C:\Users\<username>\AppData\Roaming\Godot\mono\solutions\GodotSharp_-<somenumber>\Core\DebuggingUtils.cs contains the following lines:

// Lines 37-38
if (methodBase is MethodInfo methodInfo)
    sb.AppendTypeName(methodInfo.ReturnType);

If I modify them to this then no further errors occur:

// Lines 37-38
if (methodBase is MethodInfo)
    sb.AppendTypeName(((MethodInfo)methodBase).ReturnType);

Minimal reproduction project:
Attached zip contains example project and copy of my C:\Users\<username>\AppData\Roaming\Godot\mono directory

DebuggingUtils_test_files.zip

@ghost ghost added this to the 3.0 milestone Jan 15, 2018
@akien-mga
Copy link
Member

As far as I know Mono 4.5.0 is not supported, we recommend at least version 5.2.0 (earlier versions might work, but we don't test those).

In your case, your Mono version lacks support of the is type pattern matching in C# 7.0: https://docs.microsoft.com/en-us/dotnet/csharp/pattern-matching

CC @neikeq

@akien-mga akien-mga added archived and removed bug labels Jan 15, 2018
@akien-mga
Copy link
Member

(Closing as it's not a bug, but in case @neikeq wants to keep some support for older Mono versions, removing the use of C# 7.0 features could still be done I guess)

@KellyThomas
Copy link
Contributor Author

KellyThomas commented Jan 15, 2018

@akien-mga Thanks the rapid response!

I have to confess to a typo in this report I was running mono-5.4.0.201-x64 when I first encountered this error.

Stepping forward to mono-5.4.1.6-x64-0 has not resolved it either.

I had not encountered the type pattern syntax until now so didn't recognise it as a recent language version feature.

Looking at my build log (full text in the attached zip) it ends with a reference to:

"C:\Users\Bill\AppData\Local\Temp\.NETFramework,Version=v4.5.AssemblyAttributes.cs"

This file contains the following content:

// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5", FrameworkDisplayName = "")]

So it appears my build process is limiting itself to c# 5.0 for some reason.

@akien-mga akien-mga reopened this Jan 15, 2018
@akien-mga akien-mga added bug and removed archived labels Jan 15, 2018
@akien-mga
Copy link
Member

Right, so we should likely avoid using C# 7.0 features for now.

@neikeq
Copy link
Contributor

neikeq commented Jan 15, 2018

You need MSBuild 15 (2017) for C# 7 support. However, I wanted to keep these assemblies to C# 6 in order to support MSBuild 14, but looks like I forgot about that line.

@KellyThomas
Copy link
Contributor Author

KellyThomas commented Jan 15, 2018

Thanks, I was using Build Tools 2015 as a workaround for encountering the \\csc.exe issue with Build Tools 2017.

I have now setup VS2017 / MS Build (System) as a workaround.

@akien-mga
Copy link
Member

Can you make a PR with your changes if it's enough to fix building with VS 2015?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants