You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Version 3.1.2 chokes (fails hard) on parsing real-world user agent that previous versions could parse successfully #95
Thanks for building and maintaining this great library! I upgraded to the latest release and found an issue parsing some
Repro code:
HttpUserAgentParser.Parse("Mozilla/5.0 (Linux; U; Android 13; Infinix X6836 Build/TP1A.220624.014; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/145.0.7632.120 Mobile Safari/537.36 OPR/98.0.2254.81553");
On 3.1.2, this fails with:
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
at MyCSharp.HttpUserAgentParser.HttpUserAgentParser.GetBrowser(String userAgent) in /home/runner/work/HttpUserAgentParser/HttpUserAgentParser/src/HttpUserAgentParser/HttpUserAgentParser.cs:line 108
at MyCSharp.HttpUserAgentParser.HttpUserAgentParser.Parse(String userAgent) in /home/runner/work/HttpUserAgentParser/HttpUserAgentParser/src/HttpUserAgentParser/HttpUserAgentParser.cs:line 30
On 3.0.28, this works and gives us MobileDeviceType: Android, Name: Opera, Platform: Android, Version: 98.0.2254.81553
Other examples that fail on 3.1.2 but not 3.0.28:
Mozilla/5.0 (Linux; U; Android 13; Hisense U53 Build/TP1A.220624.014; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/145.0.7632.79 Mobile Safari/537.36 OPR/98.0.2254.81553
Mozilla/5.0 (Linux; Android 10; MED-LX9) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.5481.192 Mobile Safari/537.36 OPR/74.0.3922.71152
Mozilla/5.0 (Linux; U; Android 13; Infinix X6526 Build/TP1A.220624.014; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/145.0.7632.79 Mobile Safari/537.36 OPR/97.1.2254.80849
Thank you. I added all of yours and current listed Opera User Agents to the test suite and fixed the issue.
Because it's an hot path issue, I have unlisted 3.1.2 and released 3.1.3
Activity
BenjaminAbt commentedon Mar 5, 2026
Thank you. I added all of yours and current listed Opera User Agents to the test suite and fixed the issue.
Because it's an hot path issue, I have unlisted 3.1.2 and released 3.1.3
mikethea1 commentedon Mar 6, 2026
@BenjaminAbt I ran 3.1.3 against the set of user agents that originally hit the error and I now see no failures. Really appreciate the quick fix!