0

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();
            }
        }
Justin Ertley
  • 93
  • 1
  • 4
  • 9
  • Can you please share the code where you have first called/used Milestone SDK APIs? – MKR Jan 28 '20 at 19:58
  • @MKR It's kind of spread out - some in my models and initialize in the application_start() in Global.asax.cs - none of the code is being called on which is why I didn't include it in the original question but if you think it'll help diagnose the issue I can add it. – Justin Ertley Jan 28 '20 at 20:05
  • You can try wrapping all codes of `Application_Start` in `try/catch` and see if it catches exception. – MKR Jan 28 '20 at 20:39
  • @MKR I tried that - I set a break point there as well and that's when I get the warning "The Breakpoint will not be hit. No symbols loaded..." – Justin Ertley Jan 28 '20 at 20:42
  • Though its not allowing you to `debug` but you can still check if it was able to catch exception by setting some variable from `catch` block. – MKR Jan 28 '20 at 20:54
  • @MKR - As I said before, I tried catching an exception there to no avail. – Justin Ertley Jan 28 '20 at 20:57

0 Answers0