BornToBeRoot/NETworkManager · error · FileNotFoundException
Embedded resource…
Error message
Embedded resource "NETworkManager.Resources.Maps.world-map.json" not found.
What it means
TracerouteMapControl loads the world-map GeoJSON from an embedded resource named "NETworkManager.Resources.Maps.world-map.json" via Assembly.GetManifestResourceStream. If the resource is absent from the executing assembly (build misconfiguration, wrong resource name, or stripped resources), the null stream is converted into a FileNotFoundException with this message.
Solutions
- Verify Source/NETworkManager.csproj contains <EmbeddedResource Include="Resources\Maps\world-map.json" /> (or equivalent glob) and rebuild the NETworkManager project.
- Confirm the resource name matches the default namespace + folder path (NETworkManager.Resources.Maps.world-map.json); rename the file/folder or the resourceName constant accordingly.
- List actual resources at runtime with assembly.GetManifestResourceNames() to compare names and fix the mismatch.
- Restore the original world-map.json if it was deleted, then rebuild and redeploy the full build output.
Example fix
// csproj before <None Include="Resources\Maps\world-map.json" /> // after <EmbeddedResource Include="Resources\Maps\world-map.json" />
Defensive patterns
Strategy: fallback
Validate before calling
var names = Assembly.GetExecutingAssembly().GetManifestResourceNames();
bool ok = names.Contains("NETworkManager.Resources.Maps.world-map.json"); Try / catch
try
{
var countries = LoadCountries();
}
catch (FileNotFoundException ex)
{
logger.Error("world-map.json embedded resource missing", ex);
MessageBox.Show("Map data is missing from this installation. Please reinstall.");
} Prevention
- Keep world-map.json as an EmbeddedResource in the csproj; never switch it to None/Content accidentally.
- Add a unit test asserting GetManifestResourceStream("NETworkManager.Resources.Maps.world-map.json") != null.
- When moving resource files, update both the folder path and the resourceName constant together.
- Avoid resource-stripping publish settings that drop embedded assets.
When it happens
Trigger: Calling the private resource loader in TracerouteMapControl (constructor path) when the assembly has no manifest resource with the exact name "NETworkManager.Resources.Maps.world-map.json" — e.g. the .csproj lacks the EmbeddedResource entry, the file lives under a different folder namespace, or a custom/partial build omitted it.
Common situations: Hand-compiled or modified builds where world-map.json was not included as EmbeddedResource; resource file moved/renamed in the repo without updating the csproj; custom packaging tools stripping resources; running a trimmed/published output that dropped the resource.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Embedded resource…
- Specified argument was out of the range of valid values…
- Could not load PSDiscoveryProtocol.psm1
- Process could not be started!
- Process could not be started!
AI-assisted analysis of BornToBeRoot/NETworkManager@2780d65469 (2026-09-12).
Data as JSON: /api/errors/96b76249fa9b3ba3.
Report an issue: GitHub.
Appendix: source
Thrown at Source/NETworkManager/Controls/TracerouteMapControl.xaml.cs:1656
bestBoundsArea = boundsArea;
bestCenter = new Point((minX + maxX) / 2, (minY + maxY) / 2);
}
if (bestBoundsArea >= 0)
labels.Add((country.N, bestCenter));
}
return labels;
}
private static List<CountryData> LoadCountries()
{
const string resourceName = "NETworkManager.Resources.Maps.world-map.json";
var assembly = Assembly.GetExecutingAssembly();
using var stream = assembly.GetManifestResourceStream(resourceName) ??
throw new FileNotFoundException($"Embedded resource \"{resourceName}\" not found.");
using var reader = new StreamReader(stream);
return System.Text.Json.JsonSerializer.Deserialize<List<CountryData>>(reader.ReadToEnd()) ?? [];
}
/// <summary>
/// Minimal representation of a simplified country outline (name + outer ring coordinates as [lon, lat] pairs).
/// </summary>
private sealed class CountryData
{
[JsonPropertyName("n")]
public string N { get; set; }
[JsonPropertyName("r")]
public List<List<List<double>>> R { get; set; }
}
private static List<CityData> LoadCities()View on GitHub (pinned to 2780d65469)