Comments (10)
The main fix for it was to make sure you don't store the instance of HttpContext.Current
(since it requires things to happen in a certain order and also won't work good for multiple requests), but instead always evaluate it. Also, not sure why HttpContext
was set to null in all test cases, but had to remove it since it's a getter only by now.
Static properties/variables are always a pain 😄
Btw, PR here: #134
from raven-csharp.
@mathieukempe Is this in any way improved in version 2.1 of SharpRaven?
from raven-csharp.
Any updates on this? I almost never get the correct user info in Sentry.
from raven-csharp.
@genne Which version are you using?
from raven-csharp.
2.1.0 (nuget package)
from raven-csharp.
@genne How are you capturing? Which method on ISentryClient
are you using?
from raven-csharp.
I'm calling Capture(SentryEvent) on an instance of RavenClient.
from raven-csharp.
@genne, @mathieukempe: Would any of you care to submit a pull request with the alleged fix? I don't quite understand how it can fix this problem, but if it does, I'll happily merge it!
from raven-csharp.
As mentioned by @mathieukempe, the order of the two lines must be swapped, since SentryUserFactory.Create()
depends on SentryRequestFactory
. Though, even if you fix that you still store the current HttpContext
as a static instance which will not work when you have multiple requests occurring at the same time. You either need to use ThreadStaticAttribute
before each static variable, or remove them completely and handle it in a better way.
I'll try to fix a PR just to get it working.
Further, you have a test case to make sure User
is initialized correctly (Constructor_WithHttpContext_UsertIsNotNull
), but
- in
SimulateHttpRequest
you initialize User and Request differently from how it's actually initialized, and - you don't test multiple requests occurring at the same time.
from raven-csharp.
@genne I'll be the first to admit that this part of the code is bad in every imaginable interpretation of the word. It's horrible. But I blame most of that on HttpContext.Current
being static and requiring a reference to System.Web.dll
. If you have ideas on how to improve this, you'd receive all the virtual ❤️ I can give and I'd be very happy. 😃 Looking forward to that PR!
from raven-csharp.
Related Issues (20)
- Wrong device architecture in SharpRaven.Data.Context.Device HOT 1
- Don't report ILOffset as Line number HOT 7
- Unable to set contexts data HOT 9
- No stack traces for intentional error captures HOT 3
- Sentry skips User Agent parsing if context is set; SentryEvent.Context is internal HOT 4
- Feature - Add UnhandledExceptionEventHandler HOT 2
- Setting the user per Sentry Capture HOT 8
- User-created exceptions HOT 3
- Kill in repo-docs
- Development RavenClient HOT 1
- If there is any possibility to Compatible to .net 2.0 ? HOT 5
- Unable to capture the execution time on Sentry HOT 9
- Build.cake error
- Unity 2017 with .NET 3.5 not send events to Sentry HOT 1
- DllNotFoundExceptions and SecurityException when using with Mono HOT 32
- FileNotFoundException for System.Configuration.ConfigurationManager when referenced from .Net Standard library HOT 3
- Question: How to check if error occured while sending error from app to sentry server HOT 1
- Deprecated? HOT 4
- Consider using Ben.Demystifier for stack traces HOT 1
- When sentry server is down , my app is slow down HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from raven-csharp.