Skip to content

Fix GetAllNetworkInterfaces exception failure#47

Open
timmac-qmc wants to merge 2 commits intobacktrace-labs:masterfrom
timmac-qmc:master
Open

Fix GetAllNetworkInterfaces exception failure#47
timmac-qmc wants to merge 2 commits intobacktrace-labs:masterfrom
timmac-qmc:master

Conversation

@timmac-qmc
Copy link
Contributor

GetAllNetworkInterfaces can throw an exception (common on non-Windows platforms) which causes the entire submission to fail.
Captures any exceptions and falls back to guid.

Example failure on Linux:

at System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument, System.ExceptionResource)
at System.Globalization.CompareInfo.LastIndexOf(System.String, System.String, Int32, Int32, System.Globalization.CompareOptions)
at System.String.LastIndexOf(System.String, Int32, Int32, System.StringComparison)
at System.Net.NetworkInformation.StringParsingHelpers.ParseWinsServerAddressesFromSmbConfFile(System.String)
at System.Net.NetworkInformation.LinuxIPInterfaceProperties..ctor(System.Net.NetworkInformation.LinuxNetworkInterface, LinuxNetworkInterfaceSystemProperties)
at System.Net.NetworkInformation.LinuxNetworkInterface.GetLinuxNetworkInterfaces()
at Backtrace.Model.JsonData.BacktraceAttributes.GenerateMachineId()

GetAllNetworkInterfaces can throw an exception (common on non-Windows platforms) which causes the entire submission to fail.
@timmac-qmc
Copy link
Contributor Author

I've added the trace but catching individual exceptions seems entirely redundant.
The official documentation only lists "NetworkInformationException" as a possible exception which obviously isn't the case so there's no way to capture all possibilities outside of just using Exception.

Also, we wouldn't be doing anything different dependant on the exception type, the same fall back is used.

@BartoszLitwiniuk
Copy link
Collaborator

@timmac-qmc please merge latest master to your branch because we had to add formatting corrections for CI/CD checks. Please also check if your code is formatted correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants