Umbraco-CMS icon indicating copy to clipboard operation
Umbraco-CMS copied to clipboard

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

Open Jogai opened this issue 9 months ago • 12 comments

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 [email protected] --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 [email protected] --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.

Jogai avatar Oct 07 '23 09:10 Jogai

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'll assess whether this issue relates to something that has already been fixed in a later version of the release that it has been raised for.
  • If it's a bug, is it related to a release that we are actively supporting or is it related to a release that's in the end-of-life or security-only phase?
  • We'll replicate the issue to ensure that the problem is as described.
  • We'll decide whether the behavior is an issue or if the behavior is intended.

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:

github-actions[bot] avatar Oct 07 '23 09:10 github-actions[bot]

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? 😄

andr317c avatar Oct 09 '23 10:10 andr317c

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.

Jogai avatar Oct 09 '23 20:10 Jogai

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

frytzl avatar Nov 18 '23 10:11 frytzl

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.

balintbako avatar Dec 11 '23 12:12 balintbako

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 "[email protected]" --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.

nul800sebastiaan avatar Dec 11 '23 16:12 nul800sebastiaan

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.

frytzl avatar Dec 12 '23 08:12 frytzl

Steps to reproduce:

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

frytzl avatar Dec 12 '23 08:12 frytzl

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,

  • Fresh install of Mint 21
  • It's an Ubuntu variant, so we can install .NET 7 like so: https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu-2310 (making sure to use 7.0 instead of 8.0
  • I have skipped the C# devkit extension
  • Ran dotnet new -i Umbraco.Templates::12.2.0 --force && dotnet new umbraco --force -n "MyProject" --friendly-name "Test" --email "[email protected]" --password "test123456" --development-database-type SQLite && dotnet run --project "MyProject" (also tried with Umbraco 12.3.4)

image

nul800sebastiaan avatar Dec 12 '23 13:12 nul800sebastiaan

Happy to report that Umbraco 13.0.1 is running without problems.

frytzl avatar Dec 14 '23 22:12 frytzl

@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

bigfatbird avatar Apr 15 '24 15:04 bigfatbird

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

frytzl avatar Apr 15 '24 15:04 frytzl