If we use c#6 features(for instance the 'null propagating operator' e.g. '?.' ) in a partial class which extends the generated class, the UmbracoModelsBuilder fails.
Can I update the ModelsBuilder to compile c#6?
Regards
Teus
Error:
UmbracoModelsBuilder: Starting v3.0.0.90 15-2-2017 12:22:02.
UmbracoModelsBuilder: UmbracoModelsBuilder failed to generate code: Exception: Response status code does not indicate success (InternalServerError)
{"Message":"An error has occurred.","ExceptionMessage":"Feature 'null propagating operator' is not available in C# 5. Please use language version 6 or greater.","ExceptionType":"Umbraco.ModelsBuilder.Building.CompilerException","StackTrace":" at Umbraco.ModelsBuilder.Building.Compiler.ThrowExceptionFromDiagnostic(String path, String code, Diagnostic diagnostic) in C:\Users\Stéphane\Documents\Development\Umbraco\Zbu\Zbu.ModelsBuilder\Umbraco.ModelsBuilder\Building\Compiler.cs:line 161\r\n at Umbraco.ModelsBuilder.Building.Compiler.<>cDisplayClass12_0.0(KeyValuePair2 x) in C:\\Users\\Stéphane\\Documents\\Development\\Umbraco\\Zbu\\Zbu.ModelsBuilder\\Umbraco.ModelsBuilder\\Building\\Compiler.cs:line 50\r\n at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()\r\n at System.Linq.Buffer1..ctor(IEnumerable1 source)\r\n at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source)\r\n at Umbraco.ModelsBuilder.Building.Compiler.GetCompilation(String assemblyName, IDictionary2 files, SyntaxTree[]& trees) in C:\Users\Stéphane\Documents\Development\Umbraco\Zbu\Zbu.ModelsBuilder\Umbraco.ModelsBuilder\Building\Compiler.cs:line 46\r\n at Umbraco.ModelsBuilder.Building.CodeParser.Parse(IDictionary2 files, IEnumerable1 references) in C:\Users\Stéphane\Documents\Development\Umbraco\Zbu\Zbu.ModelsBuilder\Umbraco.ModelsBuilder\Building\CodeParser.cs:line 38\r\n at Umbraco.ModelsBuilder.Api.ApiHelper.GetModels(String modelsNamespace, IDictionary2 files) in C:\\Users\\Stéphane\\Documents\\Development\\Umbraco\\Zbu\\Zbu.ModelsBuilder\\Umbraco.ModelsBuilder\\Api\\ApiHelper.cs:line 16\r\n at Umbraco.ModelsBuilder.Api.ModelsBuilderApiController.GetModels(GetModelsData data) in C:\\Users\\Stéphane\\Documents\\Development\\Umbraco\\Zbu\\Zbu.ModelsBuilder\\Umbraco.ModelsBuilder.Api\\ModelsBuilderApiController.cs:line 65\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.
Models.Builder not working with C#6 code
If we use c#6 features(for instance the 'null propagating operator' e.g. '?.' ) in a partial class which extends the generated class, the UmbracoModelsBuilder fails.
Can I update the ModelsBuilder to compile c#6?
Regards Teus
Error: UmbracoModelsBuilder: Starting v3.0.0.90 15-2-2017 12:22:02. UmbracoModelsBuilder: UmbracoModelsBuilder failed to generate code: Exception: Response status code does not indicate success (InternalServerError) {"Message":"An error has occurred.","ExceptionMessage":"Feature 'null propagating operator' is not available in C# 5. Please use language version 6 or greater.","ExceptionType":"Umbraco.ModelsBuilder.Building.CompilerException","StackTrace":" at Umbraco.ModelsBuilder.Building.Compiler.ThrowExceptionFromDiagnostic(String path, String code, Diagnostic diagnostic) in C:\Users\Stéphane\Documents\Development\Umbraco\Zbu\Zbu.ModelsBuilder\Umbraco.ModelsBuilder\Building\Compiler.cs:line 161\r\n at Umbraco.ModelsBuilder.Building.Compiler.<>cDisplayClass12_0.0(KeyValuePair
2 x) in C:\\Users\\Stéphane\\Documents\\Development\\Umbraco\\Zbu\\Zbu.ModelsBuilder\\Umbraco.ModelsBuilder\\Building\\Compiler.cs:line 50\r\n at System.Linq.Enumerable.WhereSelectEnumerableIterator
2.MoveNext()\r\n at System.Linq.Buffer1..ctor(IEnumerable
1 source)\r\n at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source)\r\n at Umbraco.ModelsBuilder.Building.Compiler.GetCompilation(String assemblyName, IDictionary
2 files, SyntaxTree[]& trees) in C:\Users\Stéphane\Documents\Development\Umbraco\Zbu\Zbu.ModelsBuilder\Umbraco.ModelsBuilder\Building\Compiler.cs:line 46\r\n at Umbraco.ModelsBuilder.Building.CodeParser.Parse(IDictionary2 files, IEnumerable
1 references) in C:\Users\Stéphane\Documents\Development\Umbraco\Zbu\Zbu.ModelsBuilder\Umbraco.ModelsBuilder\Building\CodeParser.cs:line 38\r\n at Umbraco.ModelsBuilder.Api.ApiHelper.GetModels(String modelsNamespace, IDictionary2 files) in C:\\Users\\Stéphane\\Documents\\Development\\Umbraco\\Zbu\\Zbu.ModelsBuilder\\Umbraco.ModelsBuilder\\Api\\ApiHelper.cs:line 16\r\n at Umbraco.ModelsBuilder.Api.ModelsBuilderApiController.GetModels(GetModelsData data) in C:\\Users\\Stéphane\\Documents\\Development\\Umbraco\\Zbu\\Zbu.ModelsBuilder\\Umbraco.ModelsBuilder.Api\\ModelsBuilderApiController.cs:line 65\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary
2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.Hi Teus,
You can enable C# 6 syntax by adding this line to your Web.config in AppSettings:
<add key="Umbraco.ModelsBuilder.LanguageVersion" value="CSharp6" />
Other configuration options can be found here
This resolve my problem also. Thanks
Thanks Daniel, that solved it! Sorry for the late reply . Regards Teus
is working on a reply...