Xamla / ROS.NET

ROS .NET Core Client Library
http://robotics.cs.uml.edu/
BSD 2-Clause "Simplified" License
16 stars 11 forks source link

DependencyContext null #8

Open dsjohnston opened 5 years ago

dsjohnston commented 5 years ago

Using an application that is .netfull only (UI or UnitTest), one can get a NULL DependencyContext. causing the 'Init' function to throw an NullReferenceException. This occurs due to the lack of a manifest file.

Consider null check + warning: "return context == null ? new List() : context"

https://github.com/Xamla/ROS.NET/blob/faf1d2e5ffb96f73ee7c7b285e95c3b11131fc75/Uml.Robotics.Ros.MessageBase/TypeRegistryBase.cs#L59

rgarofalo commented 2 years ago

change code with :

Assembly[] a = AppDomain.CurrentDomain.GetAssemblies(); return a.Where(x=> x.GetReferencedAssemblies().Any(y => referenceAssemblies.Contains(y.Name)));