Sonarqube encoding set to windows-1252 but skips files stating that it is set to UTF-8

Context:

SonarScanner.MSBuild.exe encoding is kept at platform default “windows-1252”.
In the scanner log this is confirmed as follows:

INFO: Analyzing on SonarQube server 9.9.0.65466
INFO: Default locale: “en_US”, source code encoding: “windows-1252” (analysis is platform dependent)

Problem:

Despite the enconding setting some files are skipped, log message states that SonarScanner is set to encoding UTF-8:

WARN: Encoding detected by Roslyn and encoding used by SonarQube do not match for file file:C:/test/samplefile.cs. SonarQube encoding is ‘UTF-8’, Roslyn encoding is ‘windows-1252’. File will be skipped

.

Hey there.

Normally sonar.sourceEncoding doesn’t need to be set at all. What is the actual file encoding of the file in question?

Are there any other warnings in the logs? Such as:

Invalid character encountered in file [MISSING FILENAME] at line xx for encoding UTF-8.