Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesRecompiling Module Breaks different module in sub PortalRecompiling Module Breaks different module in sub Portal
Previous
 
Next
New Post
3/9/2011 12:08 PM
 
I have a DNN website built on 04.09.04 that has been up and running for over a year with current setup.
I develop on a local site that is a duplicate of the live server.
I am developing a Report module using the MS ReportViewer control, have gotten it working (with some unresolved issues that need to be resolved such as a conflict between the script control and DNN'S script control) so I can produce multiple reports from my DataBase as expected.
The site has 2 portals the main site is used for modules that allow set up and maintenance for the application and the sub portal is used only for punching in to the application and contains 2 modules a custom login module and the punch in module.
The report module is on the main portal.

The problem is when I recompile the report module(for the main Portal) the Punchin module(on the sub Portal) does not work correctly. I get the following error when accessing data via the DNN DAL (so my dropdown objects are not populated with the data):
System.Reflection.TargetException was caught
  Message="Object does not match target type."
  Source="mscorlib"
  StackTrace:
       at System.Reflection.RuntimeMethodInfo.CheckConsistency(Object target)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
       at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)
       at DotNetNuke.Common.Utilities.CBO.HydrateObject(Object objObject, IDataReader dr)
       at DotNetNuke.Common.Utilities.CBO.CreateObject(Type objType, IDataReader dr)
       at DotNetNuke.Common.Utilities.CBO.FillObject(IDataReader dr, Type objType, Boolean ManageDataReader)
       at DotNetNuke.Common.Utilities.CBO.FillObject(IDataReader dr, Type objType)
       at TripleTrace.Modules.TTSTimeClock.TTSTimeClockController.TTS_DivisionsGet(String bureauID, String companyID, String divisionID) in C:\Inetpub\wwwroot\TTSTimeClock\httpdocs\DesktopModules\TTSTimeClock\Components\TTSTimeClockController.vb:line 75
       at TripleTrace.Modules.TTSTimeClock.ViewTTSTimeClock.ManageDivisions(String& tZone, String& divisionName) in C:\Inetpub\wwwroot\TTSTimeClock\httpdocs\DesktopModules\TTSTimeClock\ViewTTSTimeClock.ascx.vb:line 2369

When I recompile the PunchIn Module(for the subPortal) I get the following error on the main portal when accessing the Report Module:
System.Reflection.TargetException was caught
  Message="Object does not match target type."
  Source="mscorlib"
  StackTrace:
       at System.Reflection.RuntimeMethodInfo.CheckConsistency(Object target)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
       at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)
       at DotNetNuke.Common.Utilities.CBO.HydrateObject(Object objObject, IDataReader dr)
       at DotNetNuke.Common.Utilities.CBO.CreateObject(Type objType, IDataReader dr)
       at DotNetNuke.Common.Utilities.CBO.FillCollection(IDataReader dr, Type objType)
       at TripleTrace.Modules.TTSTimeClock_Reports.TimeClock_Controller.TTS_DivisionsList(String bureauID, String companyID) in C:\Inetpub\wwwroot\TTSTimeClock\httpdocs\DesktopModules\TTSTimeClock_Reports\Components\TimeClock_Controller.vb:line 117
       at TripleTrace.Modules.TTSTimeClock_Reports.ViewTTSTimeClock_Reports.FillDivisionCombo() in C:\Inetpub\wwwroot\TTSTimeClock\httpdocs\DesktopModules\TTSTimeClock_Reports\ViewTTSTimeClock_Reports.ascx.vb:line 725
 
Again If I recompile the Report module it will then work but the punchIn module will not. I can also achieve the exact same results by restarting the application in whichever portal is having the problem rather than recompiling.

Some things I have checked:
  • I do not see anything that is shared between the 2 modules.
  • I checked the definitions to the modules and they do not point to the other modules forms.
  • There is no Setting or Edit forms for the Report module but there are for the PunchIn Module
  • I removed the script control from My report module (so now I can not see the reports in the viewer but the rest of the form functions correctly) so there is no conflict with that control for now.
  • The results of all these actions are the same on the live and development machines.
  • There are other modules that use the exact same code within the individual modules that are working fin and do not conflict when compiled or if the application is restarted.
I am obviously stumped and development has come to a halt on this. I would appreciate any assistance at all in correcting this problem.
Thanks in advance!

 
New Post
3/9/2011 6:27 PM
 
Dan,
Are you developing the modules using WAP projects (compiled DLLs) or WSP (website project, meaning you don't compile into a DLL)?


As for your script manager control, try firing it off in the OnInit method rather then during the page load event. 

Check if AJAX.IsInstalled() then call AJAX.RegisterScriptManager()

Chris Hammond
Former DNN Corp Employee, MVP, Core Team Member, Trustee
Christoc.com Software Solutions DotNetNuke Module Development, Upgrades and consulting.
dnnCHAT.com a chat room for DotNetNuke discussions
 
New Post
3/9/2011 6:42 PM
 
Chris
WAP Projects each Module is in their own DLL. That is what is crazy.
Also As noted I noticed that when one module does not work if I restart the application Via the Host settings off the menu then the broken module in that portal I just restarted will work correctly and the other module on the other portal that was working correctly will not work. What exactly is it doing when you restart the application that is the same when you recompile the dll?

to further investigate I added a new page to the sub portal and then added the report module to that page so both modules are on the same portal.
Then exact same thing happens- so On the same portal Module 1 doesn't work but module 2 does so I restart the application on that portal and then module 1 works and when I go to the page with module 2 it kicks me out of DNN altogether. I then re login and goto module2 and it doesn't work?
Restarting the app or recompiling the module that is not working at the time will reverse the results.

As for script control I have this in the Load:
 If DotNetNuke.Framework.AJAX.IsInstalled Then 
	' Check to see if the user has AJAX installed on their server
 	DotNetNuke.Framework.AJAX.RegisterScriptManager() 
End If
 
New Post
3/9/2011 8:26 PM
 
As I believe Chris was thinking in his post asking if you were developing using WAP or WSP project, I have usually seen behavior such as this with an ambiguous type specification in a WSP project that doesn't cause a problem until another module or core code introduces a class of the same name that conflicts due to use of a non-fully qualified namespace. But since you are developing using WAP we can rule out that obvious cause and look to a much more obscure one . . .

This error and behavior appears to be caused by an ambiguous type reference or less than fully qualified namespace for the object which is being created via reflection used in the DotNetNuke.Common.Utilities.CBO.CreateObject method. Due to the high "cost" of reflection the object mapping information (from class property to SQL column name) is cached between calls. This ObjectMappingInfo cache is shared across portals. Picture this: Module 1 in Portal 0 instantiates the object based on its type name and maps its properties to its SQL columns to hydrate the object using reflection. The mapping information is cached. Along comes Module 2 in Portal 1 which instantiates the object based on its type name but sees that there is already mapping information for this object type in cache and uses the cached mapping info. However, even though the type names are the same (or more likely one is abiguous), the mapping information between properties and SQL columns is different from the the object previously created by Module 1 resulting in the "object does not match target type info".

I would look in particular at the object being created in the method

TTSTimeClockController.TTS_DivisionsGet(String bureauID, String companyID, String divisionID)

vs the object created in the method

TTSTimeClockController.TTS_DivisionsGet(String bureauID, String companyID, String divisionID)

to see if they either have the same type names but different mappings of properties to SQL columns or if there is an ambiguity between the two types caused by using a less than fully qualified namespace when referencing one or both classes in your controller code.

You might also want to look into having your various entity objects implement the DotNetNuke.Entities.Modules.IHydratable interface to avoid the need for reflection when the CBO.FillObject or CBO.FillCollection, etc. methods hydrate the object.


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
3/10/2011 8:08 AM
 
That kind of makes sense why it would do this either when recompiled or when the application is restarted.
I have cut and pasted some of my DAL between Modules but have assumed because they were in a DLL that it would not matter.

I am assuming that you meant to indicate the 2 different calls? as in :
TTSTimeClockController.TTS_DivisionsGet(String bureauID, String companyID, String divisionID)
  vs the object created in the method
TimeClock_Controller.TTS_DivisionsList(String bureauID, String companyID)

The first call returns a control type defined where the second returns an arraylist. I will look into the names used and see if there needs to be some changes.

I was considering creating a DAL DLL that would hold all possible Data Access that is needed for all modules so they would be in one place, easier to maintain and consistent. I would assume this would also avoid any naming conflicts? I have referenced another module DLL in one of the modules so I could use the DAL so I assume this would be ok?

Would this "DotNetNuke.Entities.Modules.IHydratable interface" you referenced be a better solution to the one DLL for all DAL? And if so would you be able to point me in a good starting place for learning?

Thanks for your reply!

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesRecompiling Module Breaks different module in sub PortalRecompiling Module Breaks different module in sub Portal


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out