Inspired by the ongoing CodeGarden I tried installing the latest Umbraco 9 on my Macbook Pro. Installing goes smoothly (using a SQL Server Express database on a separate machine) but when the installation is done and the installer tries redirecting into Umbraco I'm met with the following error message:
System.InvalidOperationException: Unable to convert user ID to int ---> System.InvalidCastException: Unable to cast object type 'System.String' to type 'System.Int32'
Clearing cookies and restarting the service does not help, the site backend is broken at this point. Have tried using both beta 3 and the latest nightly with the same result. dotnet --version reports 5.0.301.
Anyone else run into this and found a solution/workaround?
Yes, I found it confusing too - but installing the beta on my Windows machine (using the same database server) works just fine.
Will paste the stacktrace below:
System.InvalidOperationException: Unable to convert user ID to int ---> System.InvalidCastException: Unable to cast object of type 'System.String' to type 'System.Int32'. at Umbraco.Extensions.ObjectExtensions.TryConvertTo[T](Object input)
--- End of inner exception stack trace ---
at Umbraco.Cms.Core.Security.UmbracoUserStore2.UserIdToInt(String userId)
at Umbraco.Cms.Core.Security.BackOfficeUserStore.FindUserAsync(String userId, CancellationToken cancellationToken)
at Umbraco.Cms.Core.Security.UmbracoUserStore2.FindByIdAsync(String userId, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Identity.UserManager1.FindByIdAsync(String userId)
at Umbraco.Cms.Web.BackOffice.Install.InstallApiController.CompleteInstall()
at lambda_method271(Closure , Object )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.gAwaited|100(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.gAwaited|240(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.gAwaited|170(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.gAwaitRequestTask|60(Endpoint endpoint, Task requestTask, ILogger logger)
at Umbraco.Cms.Web.Website.Middleware.PublicAccessMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>cDisplayClass61.DisplayClass61.
Did you use a new empty database, or was the database generated from another project? You say "using the same database server", does that mean the database was
1) Originally made on windows and connected to on mac, where it fails
2) Originally made on mac and connected to, but failing. Then connection from windows where it works?
I first tried using a Linux SQL Server instance running in a Docker container (failed with the same error) but then moved over to a SQL Server Express 2016 database on our (Windows) development server. All databases were empty at the point of Umbraco installation and connected to from Umbraco using the SA account. The Express databases were created using SQL Management Studio Express.
It feels like I followed the installation instructions pretty closely to what Warren's doing here: https://www.youtube.com/watch?v=lDL9tsJojfs
However, I'm still on Catalina if that could be a factor.
Just as a heads up: I just tried installing the RC on the same mac and it resulted in the same crash as earlier. I also did try to make a new console app (adding the Umbraco.Cms package and a reference to Umbraco.Extensions in the code) and execute the code you quoted above. That worked just fine, no error at all, so the problem does not look like it's in the extension method.
Unfortunately I don't have access to another Mac with a more recent OS to see if it's something weird on my machine or if it is indeed a macos related problem.
This will boot the project, and write the log to the console. The website is now running on the Kestrel server, it will be available on the ports written in the console.
Installing Umbraco 9 on Mac OS
Hi all,
Inspired by the ongoing CodeGarden I tried installing the latest Umbraco 9 on my Macbook Pro. Installing goes smoothly (using a SQL Server Express database on a separate machine) but when the installation is done and the installer tries redirecting into Umbraco I'm met with the following error message: System.InvalidOperationException: Unable to convert user ID to int ---> System.InvalidCastException: Unable to cast object type 'System.String' to type 'System.Int32'
Clearing cookies and restarting the service does not help, the site backend is broken at this point. Have tried using both beta 3 and the latest nightly with the same result. dotnet --version reports 5.0.301.
Anyone else run into this and found a solution/workaround?
This sounds like a bug. Do you have more stacktrace?
I have no idea why this should be specific to running on Mac?
Yes, I found it confusing too - but installing the beta on my Windows machine (using the same database server) works just fine.
Will paste the stacktrace below:
System.InvalidOperationException: Unable to convert user ID to int ---> System.InvalidCastException: Unable to cast object of type 'System.String' to type 'System.Int32'. at Umbraco.Extensions.ObjectExtensions.TryConvertTo[T](Object input) --- End of inner exception stack trace --- at Umbraco.Cms.Core.Security.UmbracoUserStore
2.UserIdToInt(String userId) at Umbraco.Cms.Core.Security.BackOfficeUserStore.FindUserAsync(String userId, CancellationToken cancellationToken) at Umbraco.Cms.Core.Security.UmbracoUserStore
2.FindByIdAsync(String userId, CancellationToken cancellationToken) at Microsoft.AspNetCore.Identity.UserManager1.FindByIdAsync(String userId) at Umbraco.Cms.Web.BackOffice.Install.InstallApiController.CompleteInstall() at lambda_method271(Closure , Object ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask
1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.gAwaited|100(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.gAwaited|240(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.gAwaited|170(ResourceInvoker invoker, Task task, IDisposable scope) at Microsoft.AspNetCore.Routing.EndpointMiddleware.gAwaitRequestTask|60(Endpoint endpoint, Task requestTask, ILogger logger) at Umbraco.Cms.Web.Website.Middleware.PublicAccessMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>cDisplayClass61.DisplayClass61.Did you use a new empty database, or was the database generated from another project? You say "using the same database server", does that mean the database was 1) Originally made on windows and connected to on mac, where it fails 2) Originally made on mac and connected to, but failing. Then connection from windows where it works?
I first tried using a Linux SQL Server instance running in a Docker container (failed with the same error) but then moved over to a SQL Server Express 2016 database on our (Windows) development server. All databases were empty at the point of Umbraco installation and connected to from Umbraco using the SA account. The Express databases were created using SQL Management Studio Express.
It feels like I followed the installation instructions pretty closely to what Warren's doing here: https://www.youtube.com/watch?v=lDL9tsJojfs However, I'm still on Catalina if that could be a factor.
I have no idea if or how that should be the problem.. Based on the stacktrace, it should be the same as executing this code.
Are you somehow able to execute similar code in a simple example?
Maybe as first thing in public static void Main(string[] args)? And then maybe you can debug and see what is going wrong?
Personally I can only test on windows and ubuntu
Just as a heads up: I just tried installing the RC on the same mac and it resulted in the same crash as earlier. I also did try to make a new console app (adding the Umbraco.Cms package and a reference to Umbraco.Extensions in the code) and execute the code you quoted above. That worked just fine, no error at all, so the problem does not look like it's in the extension method.
Unfortunately I don't have access to another Mac with a more recent OS to see if it's something weird on my machine or if it is indeed a macos related problem.
Does sound like it's specific to Mac, I have tested install on Windows and Raspberry Pi, both went very smoothly
This will boot the project, and write the log to the console. The website is now running on the Kestrel server, it will be available on the ports written in the console.
I get the same error when using Umbraco 9 in Linux Docker. Did anyone find a fix?
Another heads up: this could possibly have to do with .net 5 doing some weird things with string parsing in some certain cultures, as Shannon writes about here: https://twitter.com/Shazwazza/status/1437842495627403265
As I'm working on a Mac with the OS set to Swedish culture, it would make sense.
This is identified as a bug, and will be fixed in next RC
Can confirm that the release version of Umbraco 9 installs flawlessly on my machine. Looking great!
is working on a reply...