This happens when you are adding data to the Dictionary<TKey, TValue> from multiple threads, the underlying implementation is using arrays.
To solve, switch to use ConcurrentDictionary, and use GetOrAdd.
Bruce Ng's software development blog
An archive of solutions of programming problems I have faced in my career
This happens when you are adding data to the Dictionary<TKey, TValue> from multiple threads, the underlying implementation is using arrays.
To solve, switch to use ConcurrentDictionary, and use GetOrAdd.
Source: https://stackoverflow.com/a/63909711
You do not need Chrome
for Jest tests.
The simplest solution I found is to use VS Code JavaScript Debug Terminal
.
And it works with Typescript and Nrvl.Nx work-spaces out of the box.
Debug: JavaScript Debug Terminal
:npm test -- --watch
. (or yarn test --watch
if you are using yarn)watch
will run Jest tests against modified files.When you want to narrow down the number of files run by the –watch, press p
in the terminal and enter a pattern, which is just a part of the file name you want to test and hit [Enter]
To limit it to a single test in a file – focus it with f, so change it(…) to fit(…)
On Windows, you need to install nvm-windows
I found this issue when the test data is very large (some large JSON and GraphQL query strings). For some reason MemberData only generates one test, probably some limitation or an edge case that xUnit does not handle.
In this case, the way to solve this problem is to generate a very small test parameter, and then in the test run the generation code to create other test values. Then xUnit will work correctly.
Reference SO question and answer:
Try to fix this by installing “Internet Information Services” => “World Wide Web Services” => “Application Development Features” from “Turn Windows features on or off”
Maybe you need to install ASP.NET 4.8, or something similar, try out few things depending on your project.
If you encounter SSL error when a .NET 6 application tries to connect to the MSSQL database
Microsoft.Data.SqlClient.SqlException : 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.)
System.ComponentModel.Win32Exception : The certificate chain was issued by an authority that is not trusted.
Not sure why, it might be that the new libraries are more strict regarding security. A workaround is to add TrustServerCertificate=True to the connection string.
Make sure you add the docker compose project file (.dcproj) into your solution, then you can run the whole application with one click with debug capabilities.
Setting it up with other development environments is another matter.
Some applications will use as much resources as possible, like Elasticsearch.
If you are running Docker for development and it uses up all your resources because of such application, you can configure the Docker backend to limit the amount of resources it can use.
If your Docker desktop is using WSL2 as backend, create a .wslconfig file in your user home folder in Windows with the following content
[wsl2]
memory=6GB
processors=4
Then, restart the WSL backend in Powershell
Restart-Service LxssManager
This will also restart Docker Desktop.
This will limit the resources Docker will use to only 6GB RAM and 4 core processors, leaving resources for your other applications and development tools.
When working with projects that has dependencies on an internal NuGet registry, you may need add credentials for the internal registry so that NuGet can fetch the packages.
If you restore in Visual Studio, it’s possible that VS will ask you to provide credentials (not yet tested).
If you try to restore or build using the command line, it may fail with unauthorized error.
To resolve, modify nuget.config file, either in the same folder of the solution file, or modify the global nuget.config file.
<packageSourceCredentials>
<MyPrivateNugetRegistry>
<add key=”Username” value=”Your username here” />
<add key=”ClearTextPassword” value=”your password/access token here” />
</MyPrivateNugetRegistry>
</packageSourceCredentials>
Checklists
Be aware that things may stop working as there are updates.