umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.49k stars 2.69k forks source link

ArgumentNullException: Value cannot be null. (Parameter 'factory') on new clean project #14938

Open Jogai opened 1 year ago

Jogai commented 1 year ago

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

12.2.0

Bug summary

Following the setup described on this page: https://docs.umbraco.com/umbraco-cms/fundamentals/setup/install/unattended-install#cli the command I gave was dotnet new umbraco -n Project.Web --friendly-name "jogai" --email j@g.ai --password ********** --connection-string "Data Source=|DataDirectory|/Umbraco.sqlite.db;Cache=Shared;Foreign Keys=True;Pooling=True" --connection-string-provider-name "Microsoft.Data.Sqlite" --version 12.2.0

Then, I tried to start it in Rider (on linux) but it gave me:

System.ArgumentNullException: Value cannot be null. (Parameter 'factory')
   at System.Data.Common.DbProviderFactories.RegisterFactory(String providerInvariantName, DbProviderFactory factory)
   at Umbraco.Cms.Persistence.SqlServer.UmbracoBuilderExtensions.AddUmbracoSqlServerSupport(IUmbracoBuilder builder)
   at Umbraco.Cms.Persistence.SqlServer.SqlServerComposer.Compose(IUmbracoBuilder builder)
   at Umbraco.Cms.Core.Composing.ComposerGraph.Compose()
   at Umbraco.Cms.Core.DependencyInjection.UmbracoBuilderExtensions.AddComposers(IUmbracoBuilder builder)
   at Elim.Web.Startup.ConfigureServices(IServiceCollection services) in /home/jogai/Projects/ElimKerk/Elim.Web/Startup.cs:line 32
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services, Object instance)
   at Microsoft.Extensions.Hosting.HostBuilder.InitializeServiceProvider()
   at Microsoft.Extensions.Hosting.HostBuilder.Build()
   at Umbraco.Cms.Web.Common.Hosting.UmbracoHostBuilderDecorator.Build()
   at Elim.Web.Program.Main(String[] args) in /home/jogai/Projects/ElimKerk/Elim.Web/Program.cs:line 6

Specifics

I did go into the debugger at and confirmed the parameter is indeed null, because there is nog sqlinstance here: https://github.com/umbraco/Umbraco-CMS/blob/173d8dcf47fcd18584b80190db14144a363cbdd5/src/Umbraco.Cms.Persistence.SqlServer/UmbracoBuilderExtensions.cs#L48

Steps to reproduce

Execute dotnet new umbraco -n Project.Web --friendly-name "jogai" --email j@g.ai --password ********** --connection-string "Data Source=|DataDirectory|/Umbraco.sqlite.db;Cache=Shared;Foreign Keys=True;Pooling=True" --connection-string-provider-name "Microsoft.Data.Sqlite" --version 12.2.0

On this environment:

.NET SDK:
 Version:   7.0.111
 Commit:    06c8b346e4

Runtime Environment:
 OS Name:     endeavouros
 OS Version:  
 OS Platform: Linux
 RID:         arch-x64
 Base Path:   /usr/share/dotnet/sdk/7.0.111/

Host:
  Version:      7.0.11
  Architecture: x64
  Commit:       ecb34f85ec

.NET SDKs installed:
  7.0.111 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.11 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 7.0.11 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Expected result / actual result

Desired result: no error, show something in the browser

Actual: Exception thrown.

github-actions[bot] commented 1 year ago

Hi there @Jogai!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face:

andr317c commented 1 year ago

Hey! Thanks for posting this issue. I tried reproducing it, but I was unable to get any errors. I used your exact command on Windows, Mac, and Linux 🙁. Can you provide additional information to help me reproduce the issue? 😄

Jogai commented 1 year ago

Thanks for coming back. I tried successfully on windows, so at least I have a route to continue. I'll try to come back if I can uncover some more info. Currently I'm thinking maybe the distro has some differences that cause this, so maybe I'll compare with some other's.

Fric-88 commented 11 months ago

I have this exact issue on linux mint 21. On windows it runs without problems.

balintbako commented 10 months ago

I have the same issue on IIS 10 & dotnet 7.0.14 with Umbraco 12.3.3 but the exact same code works 12.2.0. I am using a local SQL Server Express DB.

nul800sebastiaan commented 10 months ago

Just FYI: you don't need to provide the connection string and everything, the following command will set that all up for you:

dotnet new -i Umbraco.Templates::12.2.0 --force && dotnet new umbraco --force -n "MyProject" --friendly-name "Test" --email "test@test.com" --password "test123456" --development-database-type SQLite && dotnet run --project "MyProject"

This forces v12.2.0 but there's newer versions available, I enjoy using this site to generate install commands: https://psw.codeshare.co.uk/?TemplateName=Umbraco.Templates&TemplateVersion=12.2.0&Packages=&UserEmail=test%40test.com&ProjectName=MyProject&CreateSolutionFile=false&SolutionName=MySolution&UseUnattendedInstall=true&DatabaseType=SQLite&UserPassword=test123456&UserFriendlyName=Test&IncludeStarterKit=false&StarterKitPackage=Umbraco.BlockGrid.Example.Website&OnelinerOutput=true

The above is the link for the command earlier but you can tweak everything in the Options (and other) tabs.

Fric-88 commented 10 months ago

I have now tried with two fresh linux mint installations. I cannot get version 12.3.3 to run, did not try version 12.2.0. Also installed mssql. No go.

Fric-88 commented 10 months ago

Steps to reproduce:

install latest stable Linux Mint -> install vscode -> install dotnet 7 -> c# devkit extention -> dotnet new (umb template)

nul800sebastiaan commented 10 months ago

This has been noticed back in September as well it seems: https://our.umbraco.com/forum/using-umbraco-and-getting-started/112612-umbraco-on-linux-is-not-running This is especially surprising since Mint is an Ubuntu flavor and it runs totally file on Ubuntu.

I can reproduce by the way,

image

Fric-88 commented 10 months ago

Happy to report that Umbraco 13.0.1 is running without problems.

bigfatbird commented 6 months ago

@frytzl

Happy to report that Umbraco 13.0.1 is running without problems.

With dotnet 7?

I'm gettin

The current .NET SDK does not support targeting .NET 8.0.  Either target .NET 7.0 or lower, or use a version of the .NET SDK that supports .NET 8.0.

with that

Fric-88 commented 6 months ago

@bigfatbird with dotnet 8. Umbraco versions from 13 up require .NET 8