WifiSurvey application broken

Jul 4, 2010 at 2:35 PM

I recently started looking at this framework and naturally wanted to test the sample application, I've tried both the latest release as well as a svn checkout of the latest source and in both cases the WifiSurvey application seems to be broken.

The IoC and IoC.UI projects in the solution no longer work as they point to the wrong location, I'm guessing this was an oversight when moving the application to the Samples directory as I see from the changesets this was done fairly recently. After fixing this I got a lot of errors about ambiguous references due to a GenericEventArgs class being present both in in the OpenNetCF.IoC namespace and the WiFiSurvey.Infrastructure namespace, quite a few bits of code use GenericEventArgs whilst including both of these namespaces and not qualifying which to use.

After resolving this I finally got the solution to build but when running it I got a ServiceMissingException stating "Type 'AccessPointPresenter' has a service dependency on type 'IAPMonitorService'".


Is this simply a case of the sample application not keeping step with changes made in the main framework?

Jul 4, 2010 at 7:41 PM

Just to post a bit of a followup to my own post as I've done some debugging around the ServiceMissingException.

I may be wrong on this as I'm new to the framework and new to the CAB/SCSF patterns in general but it looks to me like this problem was introduced with the changes to SmartClientApplication.cs in changeset 46163.

This changeset made changes to the Start() methods such that the TShell instance is created before the modules are loaded from the store, prior to this changeset the TShell was created after loading modules.

In the case of the WifiSurvey application this results in the following:

The concrete type of TShell is ContainerForm, in the constructor this adds the various views to the RootWorkItem Items collection, one of these is APListView, APListView in turn adds the AccessPointPresenter to the Items collection, AccessPointPresenter has a ServiceDependency on IAPMonitorService.

A service with type IAPMonitorService and concrete type of APMonitorService is created in the AddServices() implementation of the WifiSurvey.Infrastructure.Module Module.cs, this however has not actually happened yet as it will be done as part of module loading in SmartClientApplication.Start() which is now after the instantiation of the TShell instance.

Was the change to move the TShell creation before the module load an oversight? As I said before I am new to this but it seems unintuitive not to be able to use any Services etc from modules within the initialisation of the shell.

 

Coordinator
Jul 5, 2010 at 4:04 PM

I've checked in an update to the source code that fixes this.  A new release will be coming shortly that addresses this as well.

Jul 17, 2010 at 12:22 PM
Edited Jul 17, 2010 at 12:23 PM

Thanks for fixing these issues.

There are still a couple of minor points which would be nice to clean up however, the main solution which now contains the wifisurvey sample is missing the DAL module project and the wifisurvey desktop project. There is another solution file in the Samples/WifiSurvey directory but this solution has broken references to the OpenNETCF.IoC and UI projects, it would be nice for this second solution to either be fixed or removed.

I've also noticed that the unit tests project does not pass all the tests cleanly on the current source version, running the test suite I only get 84/99 tests passed, is this tests not being kept up to date with the framework changes?

Overall however I like the look of the framework and plan to use it as the basis for my next project, I'd like to thank you for the hard work you have put in to this.

Unfortunately I never did manage to try the sample project though as it seems none of the devices available to me have a WZC compliant wifi driver so the application won't work but even without this I think I now have a good enough grasp of how the framework works to proceed anyway.

 

Coordinator
Jul 20, 2010 at 4:58 PM

Thanks for the sanity check. I've cleaned up the unused WiFiSurvey solution, deleted the invalid "WiFiSurveyDesktop" project and added the DAL into WiFiSurvey.  I'll be looking at the tests next as I have to add a few more.

Sep 5, 2012 at 1:10 PM
Edited Sep 5, 2012 at 1:11 PM

I downloaded the sample applications and have also tried to run the sample WiFiSurvery solution.  I also get the above exception.  I googled the exception message and found this page.  The stack trace is below.

OpenNETCF.IoC.ServiceMissingException was unhandled

  Message="Type 'AccessPointPresenter' has a service dependency on type 'IAPMonitorService'"

  StackTrace:

       at OpenNETCF.IoC.ObjectFactory.DoInjections(Object instance, WorkItem root)

       at OpenNETCF.IoC.ManagedObjectCollection`1.Add(Object item, String id, Boolean expectNullId)

       at OpenNETCF.IoC.ManagedObjectCollection`1.AddNew(Type typeToBuild, String id, Boolean expectNullId, Boolean wrapDisposables)

       at OpenNETCF.IoC.ManagedObjectCollection`1.AddNew(Type typeToBuild, String id)

       at OpenNETCF.IoC.ManagedObjectCollection`1.AddNew[TTypeToBuild](String id)

       at WiFiSurvey.Shell.Views.APListView..ctor()

       at System.Reflection.RuntimeConstructorInfo.InternalInvoke(RuntimeConstructorInfo rtci, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)

       at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

       at System.Reflection.ConstructorInfo.Invoke(Object[] parameters)

       at OpenNETCF.IoC.ObjectFactory.CreateObject(Type t, WorkItem root)

       at OpenNETCF.IoC.ManagedObjectCollection`1.AddNew(Type typeToBuild, String id, Boolean expectNullId, Boolean wrapDisposables)

       at OpenNETCF.IoC.ManagedObjectCollection`1.AddNew(Type typeToBuild, String id)

       at OpenNETCF.IoC.ManagedObjectCollection`1.AddNew[TTypeToBuild](String id)

       at WiFiSurvey.Shell.ContainerForm..ctor()

       at System.Reflection.RuntimeConstructorInfo.InternalInvoke(RuntimeConstructorInfo rtci, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)

       at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

       at System.Reflection.ConstructorInfo.Invoke(Object[] parameters)

       at OpenNETCF.IoC.ObjectFactory.CreateObject(Type t, WorkItem root)

       at OpenNETCF.IoC.ManagedObjectCollection`1.AddNew(Type typeToBuild, String id, Boolean expectNullId, Boolean wrapDisposables)

       at OpenNETCF.IoC.ManagedObjectCollection`1.AddNew(Type typeToBuild)

       at OpenNETCF.IoC.ManagedObjectCollection`1.AddNew[TTypeToBuild]()

       at OpenNETCF.IoC.UI.SmartClientApplication`1.Start(IModuleInfoStore store)

       at OpenNETCF.IoC.UI.SmartClientApplication`1.Start()

       at WiFiSurvey.Shell.Program.Main()

Coordinator
Sep 5, 2012 at 3:03 PM

I just verified that it runs fine for me.  The exception you're seeing indicates that the AccessPointPresenter cannot be created because the DI container does not hold an IAPMonitorService instance.  This means that the WifiSurvey.Infrastructure.Module module was probably not loaded.  This is common if it's not deployed with the app.  Put a break point in Module.cs, line 18 or so and I bet it never gets hit.