-
Notifications
You must be signed in to change notification settings - Fork 147
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
use original opcode in DynamicMethodBuilder #448
use original opcode in DynamicMethodBuilder #448
Conversation
920e17c
to
bec0b10
Compare
reproductions/StackExchange.Redis.StackOverflow/StackExchange.Redis.StackOverflow.csproj
Outdated
Show resolved
Hide resolved
src/Datadog.Trace.ClrProfiler.Managed/Integrations/StackExchange.Redis/RedisBatch.cs
Outdated
Show resolved
Hide resolved
c402644
to
29c84a5
Compare
29c84a5
to
40e8d59
Compare
74fdb67
to
929de65
Compare
methodParameterTypes: new[] { messageType, processorType, serverType }, | ||
methodGenericArguments: new[] { genericType }); | ||
.GetOrCreateMethodCallDelegate( | ||
_redisBaseType, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTE: we intercepted a call to RedisBase.ExecuteAsync()
, so we need to call that method, not the one in type redisBase.GetType()
, which could be an override. This is required in addition to using the original opcode to avoid stack overflow exceptions (#447).
m.GetGenericArguments().Length == methodGenericArguments.Length) | ||
.ToArray(); | ||
m => m.IsGenericMethodDefinition && | ||
m.GetGenericArguments().Length == methodGenericArguments.Length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good find, no need to generate a new array!
{ | ||
// get these only once and cache them, | ||
// no need for locking, race conditions are not a problem | ||
_redisAssembly = thisType.Assembly; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I feel like I should edit my GraphQL integration to do this since the GraphQL parameters are defined in the same assembly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with doing it either way (like this or using the assembly name). In this case the assembly name can be either StackExchange.Redis
or StackExchange.Redis.StrongName
, so doing it this way allows us to handle either one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! 👍
e9c441a
to
d936f73
Compare
d936f73
to
343381c
Compare
Follow-up to #367.
Fixes the
StackOverflowException
inStackExchange.Redis
integration (see #447).Changes proposed in this pull request:
DynamicMethodBuilder
StackExchange.Redis
integration, callRedisBase.ExecuteAsync()
instead of theExecuteAsync()
method from the derived typeHttpMessageHandler.StackOverflow
project toHttpMessageHandler.StackOverflowException