add

Saturday, September 16, 2023

ERROR : Only the invariant culture is supported in globalization-invariant mode.

 Hi All,


While working with dot net core, if you encounter the following error:

Only the invariant culture is supported in globalization-invariant mode. 

See https://aka.ms/GlobalizationInvariantMode for more information. (Parameter 'name')

en-us is an invalid culture identifier.


Here is the simple solution to resolve this:

1. Right click the dot net core project --> Select Edit Project File

2. In the XML file, file the node : 

    <InvariantGlobalization>true</InvariantGlobalization>

3. Replace 'true' with 'false'

The line should be :

    <InvariantGlobalization>false</InvariantGlobalization>

4. Save the project file.

5. Build the project and check for error.

There will be no error on the globalization.

Cheers :) 

Friday, September 15, 2023

.NET 8 preview not showing in Visual Studio 2022

 Have you faced an issue where .Net 8 version framework is not available to select while creating a new .Net core project?


Steps to check:

  1. Check whether you have installed the latest preview of Visual Studio 2022 (17.7).
  2. Enable Preview feature usage:
    1. Visual Studio --> Go to 'Tools' --> 'Manage Preview Features'
    2. Ensure you have 'Preview Feature' selected.
    3. Scroll down and on the right you will see an option 'Use Preview of the .Net SDK'
    4. Select the option. Click 'Ok' and restart the Visual Studio
    5. Now you will have the .Net 8 Preview SDK listed.









Thursday, September 14, 2023

A connection was successfully established with the server, but then an error occurred during the login process.

 If you are creating the database using code first db approach using Entityframework Core and while creating the database using 'Update Database' command encounter the below error:


A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.)

Chances are there that there is an issue with the connection string mentioned in the web.config or appsettings.json (if using asp.net core app).

Compare the below before and after connection string :

OLD:

data source=YOUR_SERVER_NAME;initial catalog=YOUR_DB_NAME;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework


NEW:

data source=YOUR_SERVER_NAME;initial catalog=YOUR_DB_NAME;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework;Trusted_Connection=SSPI;Encrypt=false;


Add the above highlighted part at the end of the connection string and try to build the database.

It should work.

Cheers :)