-
Notifications
You must be signed in to change notification settings - Fork 63
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
Cannot set "isExpected" in the NoticeError method due to overload specificity #2787
Comments
@mnbuhl Thank you for reaching out to us. In this case you are attempting to use an overload that does not exist. See newrelic-dotnet-agent/src/Agent/NewRelic.Api.Agent/NewRelic.cs Lines 188 to 480 in 6490ef1
In order to prevent precedence confusion, only the "string error" overloads (not the "exception" overloads, include the boolean parameter to specify whether or not an error is expected. The expectation is that expected errors are controlled by agent configuration settings. Those configuration settings are applicable to exceptions, but not applicable to errors that come is as just strings. For the errors that come in as just strings, we provide overloads to allow those errors to be flagged as expected (because using the configuration settings will not work). For the exception-based overloads we do not provide that parameter, because it will cause confusion about which setting should be used, the parameter or the configuration settings. As a result, if you want to mark an exception as expected you need to use the agent configuration to control which exceptions are expected. If you just have an error string such as "My error string" and no exception, then you can use one of the string overloads to specify that the error is expected. |
I am blind 🤦 Thank you for clarifying and sorry for taking some of your time @nrcventura. I'll use for agent configuration settings for this. Thanks for pointing me in the right direction, and have a nice day ⭐ |
Not a problem. Questions similar to this have come up a few times in the last year, and this gave me an opportunity to document the current rationale for the differences between some of these overloads. |
Description
NOTE: # ( Describe the problem you're encountering. )
[TIP]: # ( Do NOT share sensitive information, whether personal, proprietary, or otherwise! )
When calling
NewRelic.Api.Agent.NewRelic.NoticeError
, you are unable to set theisExpected
parameter, no matter how you format theparameters
parameter.Expected Behavior
NOTE: # ( Tell us what you expected to happen. )
I expect to be able to set the "isExpected" property. The compiler will not accept it no matter how I define the parameters.
Troubleshooting or NR Diag results
NOTE: # ( Provide any other relevant log data such as the agent and/or profiler logs, preferably at DEBUG level or higher. )
[TIP]: # ( Scrub logs and diagnostic information for sensitive information )
Steps to Reproduce
NOTE: # ( Please be as specific as possible. )
[TIP]: # ( Link a sample application that demonstrates the issue. )
Try to call NoticeError with
isExpected
parameterYour Environment
[TIP]: # ( Describe your environment, please include the running version of the agent, .NET Framework, .NET Core, or .NET versions, and any relevant configurations)
Tested on
NewRelic.Agent.Api
10.29.0
and10.31.0
using .NET 8Additional context
[TIP]: # ( Add any other context about the problem here. For example, relevant community posts or support tickets. )
For Maintainers Only or Hero Triaging this bug
Suggested Priority (P1,P2,P3,P4,P5):
Suggested T-Shirt size (S, M, L, XL, Unknown):
The text was updated successfully, but these errors were encountered: