Selenium.WebDriver.ChromeDriver Nuget - Asterisk downloading previous version - c#

I have the package reference set as
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="*" />
However tests are failing in AppVeyor throwing this error:
System.InvalidOperationException : session not created: This version of ChromeDriver only supports Chrome version 100
Current browser version is 99.0.4844.84 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe (SessionNotCreated)
Shouldn't the asterisk be downloading the latest version on each AppVeyor run?

Try using *-*. Using * only takes into account release versions.
Reference:
https://learn.microsoft.com/en-us/nuget/concepts/package-versioning#floating-version-resolutions

Chrome have pushed the version to 100 just now.
Update your browser (incase not auto updated), you will be good to go.

Related

ICU Package installation Linux

When I try to run a c# program on my linux controller I get the following error:
Process terminated. Couldn't find a valid ICU package installed on the system. Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support.
at System.Environment.FailFast(System.String)
at System.Globalization.GlobalizationMode.GetGlobalizationInvariantMode()
at System.Globalization.GlobalizationMode..cctor()
at System.Globalization.CultureData.CreateCultureWithInvariantData()
at System.Globalization.CultureData.get_Invariant()
at System.Globalization.CultureInfo..cctor()
at System.StringComparer..cctor()
at System.StringComparer.get_OrdinalIgnoreCase()
at Microsoft.Data.Sqlite.SqliteConnectionStringBuilder..cctor()
I want to install an ICU package to get rid of this error. So I downloaded a package from this site:
Internationnal Components for Unicode
When I installed the package on the controller I still got the message. Is there any proper way to install an ICU package on the linux controller so I can get rid of this message?
P.S. (turning globalization invariant on is not an option because my code (SQL-Server) does not allow it to be on...)
you can disable ICU usage putting this in your .csproj:
<PropertyGroup>
<InvariantGlobalization>true</InvariantGlobalization>
</PropertyGroup>
before running your project, delete manually /bin and /obj

Process terminated. Couldn't find a valid ICU package installed on the system in Asp.Net Core 3 - ubuntu

I am trying to run a Asp.Net Core 3 application in Ubuntu 19.10 thru terminal using dotnet run command but it does not seem to work. I get this error.
Process terminated. Couldn't find a valid ICU package installed on the system.
Set the configuration flag System.Globalization.Invariant to true if you want
to run with no globalization support.
at System.Environment.FailFast(System.String)
at System.Globalization.GlobalizationMode.GetGlobalizationInvariantMode()
at System.Globalization.GlobalizationMode..cctor()
at System.Globalization.CultureData.CreateCultureWithInvariantData()
at System.Globalization.CultureData.get_Invariant()
at System.Globalization.CultureInfo..cctor()
at System.StringComparer..cctor()
at System.StringComparer.get_OrdinalIgnoreCase()
at Microsoft.Extensions.Configuration.ConfigurationProvider..ctor()
at Microsoft.Extensions.Configuration.EnvironmentVariables.EnvironmentVariablesConfigurationSource.Build(Microsoft.Extensions.Configuration.IConfigurationBuilder)
at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder..ctor(Microsoft.Extensions.Hosting.IHostBuilder)
at Microsoft.Extensions.Hosting.GenericHostWebHostBuilderExtensions.ConfigureWebHost(Microsoft.Extensions.Hosting.IHostBuilder, System.Action'1<Microsoft.AspNetCore.Hosting.IWebHostBuilder>)
at Microsoft.Extensions.Hosting.GenericHostBuilderExtensions.ConfigureWebHostDefaults(Microsoft.Extensions.Hosting.IHostBuilder, System.Action'1<Microsoft.AspNetCore.Hosting.IWebHostBuilder>)
at WebApplication.Program.CreateHostBuilder(System.String[])
at WebApplication.Program.Main(System.String[])
I installed the dotnet core sdk using the ubuntu store and after that I also installed Rider IDE.
The weird thing here is that when I run the app using Rider it runs fine, the only issue is using terminal dotnet core commands.
Does anybody know what might be the issue ?
The application is created using Rider. I don't think that this plays a role but just as a side fact.
I know there are also other ways to install dotnet core in ubuntu but since the sdk is available in the ubuntu story I thought it should work out of the box and of course its an easier choice.
Also tried this one but does not seem to work for me. Still the same issue happens after running the commands.
The alternative solution as described in Microsoft documentation is to set environment variable before running your app
export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
If you want to run with no globalization support, you need to get "System.Globalization.Invariant": true into your published output AppName.runtimeconfig.json file as shown in the example below:
{
"runtimeOptions": {
"tfm": "netcoreapp3.0",
"configProperties": {
"System.GC.Server": true,
"System.Globalization.Invariant": true
}
}
}
You can add it manually every time you deploy by adding or updating the AppName.runtimeconfig.json file. Better yet, add it once to a runtimeconfig.template.json file like this:
{
"configProperties": {
"System.Globalization.Invariant": true
}
}
Make sure that runtimeconfig.template.json is included in build/publish.
It seem the package libicu63 will provide the ico support for dotnet on Linux, at least on Debian'ish distros.
Update:
And it seems it's "missing" when doing a small installing of Debian (i.e. deselect all applications/system-options in the installation program, except for SSH server)
The trick around it on Ubuntu 20.04 based on this thread https://github.com/dotnet/core/issues/2186#issuecomment-671105420
$export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
Yes. When installing Github action in Debian. It is also required.
As the response from MrCalvin,
sudo apt-get update && sudo apt-get install -qqq libicu63 resolve my issue.
edit your .bashrc file by adding the following line, e.g.:
nano ~/.bashrc
add
export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
Ctrl+o, Ctrl+x
restart terminal and run pwsh again
I had this issue while trying to run Umbraco version 9.2.0. Fiddling with System.Globalization.Invariant was not a good solution as it broke globalization in the backoffice. This issue has been solved in v9.4: https://github.com/umbraco/Umbraco-CMS/pull/11961
I didn't want to upgrade my Umbraco version to solve this, so I just copied the change in that commit to my project.
Simply go into the .csproj file of your web project and change the ICU package reference lines to:
<!-- Force windows to use ICU. Otherwise Windows 10 2019H1+ will do it, but older windows 10 and most if not all winodws servers will run NLS -->
<ItemGroup>
<PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="68.2.0.9" />
<RuntimeHostConfigurationOption
Condition="$(RuntimeIdentifier.StartsWith('linux')) Or $(RuntimeIdentifier.StartsWith('win')) Or ('$(RuntimeIdentifier)' == '' And !$([MSBuild]::IsOSPlatform('osx')))"
Include="System.Globalization.AppLocalIcu"
Value="68.2.0.9" />
</ItemGroup>
In my case, I followed the Windows documentation to install SDK dependencies and Runtime, watch out for the corresponding version to each Linux distribution to avoid compatibility issues.
This helped me override the default ICU version to the one that's installed on the machine running arch linux.
export CLR_ICU_VERSION_OVERRIDE=$(pacman -Q icu | awk '{split($0,a," ");print a[2]}' | awk '{split($0,a,"-");print a[1]}')

I have an error with WebDriver.dll in visual studio Chrome version must be between 70 and 73. CHROME WEB DRIVER

I have updated my chrome without thinking to much about it as I am fairly new with selenium however this has caused the following error in visual studio.
An unhandled exception of type 'System.InvalidOperationException' occurred in WebDriver.dll. Additional information: session not created: Chrome version must be between 70 and 73.
I have tried to update the libraries but all my libraries are up to date.
Here are dose libraries and the version.
Selenium.Support 3.141.0
Selenium.Chrome.WebDriver 74.0.0
Selenium.WebDriver 3.141.0
NunitTestAdapter 2.1.1
What can I do to fix this error without downgrading chrome. Thank you very much.
UPDATE Thanks to Dazed I found In packages.config
<package id="Selenium.WebDriver.ChromeDriver" version="73.0.3683.68" targetFramework="net461" />
And I replaced the version with my version.
<package id="Selenium.WebDriver.ChromeDriver" version="74.0.3729.6" targetFramework="net461" />
Also my csproj has the following lines.
<Error Condition="!Exists('..\packages\Selenium.WebDriver.ChromeDriver.73.0.3683.68\build\Selenium.WebDriver.ChromeDriver.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Selenium.WebDriver.ChromeDriver.73.0.3683.68\build\Selenium.WebDriver.ChromeDriver.targets'))" />
</Target>
<Import Project="..\packages\Selenium.WebDriver.ChromeDriver.73.0.3683.68\build\Selenium.WebDriver.ChromeDriver.targets" Condition="Exists('..\packages\Selenium.WebDriver.ChromeDriver.73.0.3683.68\build\Selenium.WebDriver.ChromeDriver.targets')" />
When I replace the 73.0.3683.68 with 74.0.3729.6 I get the following error
Severity Code Description Project File Line Category Suppression State
Error This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Selenium.WebDriver.ChromeDriver.74.0.3729.6\build\Selenium.WebDriver.ChromeDriver.targets. AutoFillForm C:\Users\Junior\Desktop\columbia project\erp_columbia\erp_columbia\AutoFillForm\AutoFillForm\AutoFillForm.csproj 106
Despite the fact the the files exists in my packages folder as you can see on this image.
I was facing the same issue.
To solve the issue i did following steps:
Go to manage nuGet packages..
then go to browse tab and search the package with keyword: "Selenium.Chrome.WebDriver"
(For other browser, install corresponding package)
and then install it. (Note: if it is already installed then remove the package before installing it.)
update your chrome driver from here: http://chromedriver.chromium.org/downloads
and save it to your local machine and give the path of it into your code
For reference, you can visit my github page Google Login by selenium
Try to run my code by replacing your email id and password.

System.Runtime.CompilerServices.Unsafe produce unexpected behavior in Xamarin Forms

I built a complete Xamarin From application. When I change build mode to Release I get this error message:
Severity Code Description Project File Line Suppression State
Error The "LinkAssemblies" task failed unexpectedly.
Mono.Linker.MarkException: Error processing method: 'System.Void
Microsoft.Extensions.Primitives.InplaceStringBuilder::Append(System.String,System.Int32,System.Int32)'
in assembly: 'Microsoft.Extensions.Primitives.dll' --->
Mono.Cecil.ResolutionException: Failed to resolve System.Void
System.Runtime.CompilerServices.Unsafe::CopyBlockUnaligned(System.Void*,System.Void*,System.UInt32)
at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference
reference) at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference
reference) at
Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body) at
Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
at Mono.Linker.Steps.MarkStep.ProcessQueue() --- End of inner
exception stack trace --- at
Mono.Linker.Steps.MarkStep.ProcessQueue() at
Mono.Linker.Steps.MarkStep.ProcessEntireQueue() at
Mono.Linker.Steps.MarkStep.Process() at
Mono.Linker.Steps.MarkStep.Process(LinkContext context) at
Mono.Linker.Pipeline.Process(LinkContext context) at
MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext&
context) at
Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver
res) at Xamarin.Android.Tasks.LinkAssemblies.Execute() at
Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at
Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() EClinicForDoctor.Android
After searching on the Internet, I find this solution which says:
The resolution to this issue is to make sure you have the latest supported Android SDK versions, and set the Target Framework to Use latest installed platform. It's also recommended that you set the Target Android Version to Use Target Framework Version and the minimum Android version to API 15 or higher. This is considered the supported configuration.
Thus I update Android SDKs, set Target Framework and set minimum Android version to API 15.
However, I still get the same error. Another solution says that I should update NuGet Packages. I found that the version of the package System.Runtime.CompilerServices.Unsafe is 4.3.0 and there is an update for this package. When updating the package, the error no longer appear but another problem occur. When the app deployed, it run and stop without any error message. The mobile just exit from application without showing any error message. This happens when the package System.Runtime.CompilerServices.Unsafe is on version higher than 4.3.0. I tried to remove the package and the same problem happens again. How can I solve this problem?
I've seen this issue popup at a few different locations now. There is some discussion going around it like here: https://github.com/xamarin/xamarin-android/issues/1196
This Github issue also lists some (possible) solutions, the one with the most positive feedback seems to be this one:
Here's a functioning workaround. It's hacky and ugly but works with
minimum fuss. Put this in an XML file and <Import> it in your Android
csproj file at the end. It works at least for System.Buffers
<!-- Workaround for https://github.com/xamarin/xamarin-android/issues/1162 -->
<Project>
<Target Name="ReplaceRefAssemblies" AfterTargets="_ResolveAssemblies">
<ItemGroup>
<ResolvedAssembliesFixedWindows Include="#(ResolvedAssemblies->Replace('\ref\','\lib\'))" />
<ResolvedAssembliesFixedUnix Include="#(ResolvedAssemblies->Replace('/ref/','/lib/'))" />
<ResolvedAssembliesFixed Include="#(ResolvedAssembliesFixedWindows)" Condition="#(ResolvedAssembliesFixedWindows) != #(ResolvedAssemblies)" />
<ResolvedAssembliesFixed Include="#(ResolvedAssembliesFixedUnix)" Condition="#(ResolvedAssembliesFixedUnix) != #(ResolvedAssemblies)" />
<ResolvedAssemblies Remove="#(ResolvedAssemblies)" />
<ResolvedAssemblies Include="#(ResolvedAssembliesFixed)" />
</ItemGroup>
</Target>
</Project>
Another uses the XML from above and says:
I've just copied the content from the link above and saved as UnsafeFix.xml file in the Android project folder.
Then just added: <Import Project="UnsafeFix.xml" /> at the end of android .csproj file, just before
Cleared everything, recompiled and it finally worked!
Finally I get the solution. One of the comments in the issue provided by #Gerald Versluis solve the problem:
I follow these steps of hongliyu2002
https://forums.realm.io/t/could-not-load-assembly-system-runtime-compilerservices-unsafe-during-startup-registration/974/4
Go to C:\Users%user%.nuget\system.runtime.compilerservices.unsafe\4.4.0, and
delete "ref" folder then make a copy of "lib" folder and rename the
copy back to "ref".
Cleanup all the "bin" and "obj" folders in the projects.
Rebuild and run..
This simple workaround , works for me :) My current version is
Xamarin.Forms 2.5.1.444934

.NET project Nunit tests are failing during mono build

I'm pretty new to CI (from a brand new set up point at least). I created a project in Rider, using the default version of NUnit that is provided if you select to 'Create new NUnit Project', and I am now trying to set up an automated build for it using travis-CI.
The target .NET framework version of my project and test projects (confirmed in Project properties in Rider) is 4.5.
The version of Nunit I am using is the default version provided with Rider, 3.5.
Here is my .travis.yml build file:
language: csharp
solution: .sln
install:
- nuget restore FindWordsWithConcatenations.sln
- nuget install NUnit.Runners -Version 3.5.0 -OutputDirectory testrunner
script:
- xbuild /p:Configuration=Debug ./FindWordsWithConcatenations.sln
- mono ./testrunner/NUnit.ConsoleRunner.3.5.0/tools/nunit-agent.exe ./TestFindWordsWithConcatenations/bin/Debug/TestFindWordsWithConcatenations.dll
I confirmed on my own machine by running the nuget command that the test runner path should be correct, when I run the nunit-agent (via agent, agent-x86, or agent-console) I get the following error (locally, and on the server):
Unhandled Exception: System.FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
at System.Guid..ctor(String g)
at NUnit.Agent.NUnitTestAgent.Main(String[] args)
I've also tried running with no configuration mode specified, and with configuration mode of Debug and Release specified.
Unfortunately, the normal tactic of googling/stack overflow hasn't helped, I've seen this error in a few questions, but the cause never seems related to what I'm experiencing.
The last build of the pipeline is available to view here, all the builds thus far have failed, previous builds can be seen here.
Thanks in advance, I would be very grateful if someone had any idea about the cause of this issue, or how I could tackle the test running in a different way.
Solved it.
Updated the script section of the travis config to:
script:
- xbuild /p:Configuration=Debug ./FindWordsWithConcatenations.sln
- mono ./testrunner/NUnit.ConsoleRunner.3.5.0/tools/nunit3-console.exe ./TestFindWordsWithConcatenations/bin/Debug/TestFindWordsWithConcatenations.dll
So it's now running the correct console application. Also had to modify the test paths a bit for it to run on the server.

Categories

Resources