I'm having an issue where I need to catch a FileNotFoundException when my application starts. For further context, this is a Web API that is also using the Milestone SDK. In their (Milestone SDK) developer forums, I found someone else who was having a similar issue and attempted the same things I have. The post provided some guidance, but the solution isn't exactly clear.
For reference: Milestone SDK Developer forum question
One of the Milestone reps answered the question like this:
Bo Andersen (Milestone Systems A/S)
We are speculating that you need these files in the current folder when you execute your service, we have seen issues where the current folder is no longer the expected folder, we suggest that you catch the exception, and when the exception is caught you get the current folder and logs it.
The problem I'm having is that I have yet to find a way to catch the exception given the exception happens as soon as I start to debug the application.
EDIT
Adding some code samples per request:
//Bookmarks.cs in my models
public Bookmarks(DateTime timeBegin, FQID fqid, string header, string description)
{
TimeBegin = timeBegin;
Fqid = fqid;
Header = header;
Description = description;
BmReference = BookmarkService.Instance.BookmarkGetNewReference(Fqid, true);
TimeBegin.AddMinutes(-1);
TimeEnd = TimeBegin.AddMinutes(1);
TimeTrigged = TimeBegin.AddSeconds(30);
}
//Global.asax.cs
public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
VideoOS.Platform.SDK.Environment.Initialize(); // General initialize. Always required
VideoOS.Platform.SDK.UI.Environment.Initialize();
VideoOS.Platform.SDK.Export.Environment.Initialize();
}
}