-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
config files (newrelic.config, app.config, etc.) UTF-8 encoded with Byte Order Mark can't be parsed on Linux #267
Comments
An update on my progress analyzing and debugging this issue: This issue really only seems to be reproducible in a Linux environment. I created a C++ test application in Visual Studio on Windows, and forklifted the relevant code from the profiler that is in the path of this issue...the However, by adding a bunch of debugging printouts and running the profiler in Linux, I've found the following:
|
I'm still seeing this in the Log Stream of Azure App Service Linux: [Info ] 2022-08-22 09:41:35 Found newrelic.config at: /home/site/wwwroot/newrelic/newrelic.config I'm testing New Relic for the first time and I try to change the log level from info to warn and have created a local newrelic.config file in Visual Studio 2022. When changing the file to not include BOM it seems to work in the regards that I don't see the Debug message anymore. It still logs on Info level though. [Info ] 2022-08-22 10:33:52 ICorProfilerInfo10 available I'm running the 10.0 version of the Agent. |
Description
The profiler component of the agent has a problem parsing
newrelic.config
or other config files (e.gapp.config
for a profiled application) if it is encoded in UTF-8 with BOM (Byte Order Mark: https://en.wikipedia.org/wiki/Byte_order_mark)The symptom of the issue is that a profiler log will only have the following lines:
Expected Behavior
The agent should start normally if the config file is in UTF-8 with BOM.
Steps to Reproduce
newrelic.config
file encoded in UTF-8 with BOM. You can do this easily with VS Code. Open the config file in VS Code, click the encoding in the lower right hand corner, choose "Save with encoding" from the dialog that opens, and select "UTF-8 with BOM" to save the file as. You can confirm that this worked by installing the "Hexdump" extension and viewing the file as a hexdump and confirming that the first three bytes of the file are "EF BB BF".newrelic.config
file in/usr/local/newrelic-netcore20-agent
in a Linux environment, and run any .NET Core application with profiling enabled. Look at the resulting profiler log and note that it stops after the first three lines.Initial debugging with extra logging statements shows that the breakdown is occurring somewhere when trying to read the resultant
xstring_t
from theReadFile()
method inICorProfilerCallbackBase.h
.xstring_t
is a custom typedef we use to handle Windows/Linux cross-compatibility, it's defined inxplat.h
.For Windows:
For Linux:
Your Environment
.NET Core agent on Linux
The text was updated successfully, but these errors were encountered: