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 ExtensionsModulesModulesModule backwards compatibilityModule backwards compatibility
Previous
 
Next
New Post
1/12/2013 8:55 AM
 

I have a module that needs to be compatible with DNN 5.2 to 7.0. DNN 5.x is compiled against .NET 2.0, DNN 7.0 against v4.0 of the framework. The module references a copy of DNN 5.2 and is now compiled against .NET v4.0.

The module works fine on DNN7 as expected. It also runs on older versions of DNN. However, at one point, there is one piece of code that is not working on the older versions. I have a method that returns the Guid of the assembly:

 private static Guid GetApplicationUid() 
       Assembly assembly = Assembly.GetExecutingAssembly(); 
       GuidAttribute attribute = (GuidAttribute)assembly.GetCustomAttributes(typeof(GuidAttribute), false)[0]; 
       return new Guid(attribute.Value); 
}

The method fails with an "Index was outside the bounds of the array." exception. The reason for this is that when the module is compiled against a .NET version other than the one the current application is executing against, the assembly reference created by GetExecutingAssembly() is to a temporary assembly rather than the underlying "real" one.

How do I configure the site so that this doesn't happen? Can I use assembly redirection for this? Alternatively (and preferably), is there a way of always getting a reference to the real assembly, even when .NET generates and executes a temporary one, as in this case?



Paul Taylor
Dotcom Software Solutions Ltd
DotNetNuke, ASP.NET and SQL Server Development
 
New Post
1/12/2013 9:25 AM
 
I am surprised that the current approach even works unless you are you running your DNN5.2 test site under Framework 4.0. If that's the case it probably will not work for any customer running DNN5.2 under Framework 2.0

Isn't the obvious answer to build the component with .Net 2.0? Then it should be compatible with any DNN5.2 site, and upward compatible with later versions. Am I missing somthing?

Best wishes,
- Richard
Agile Development Consultant, Practitioner, and Trainer
www.dynamisys.co.uk
 
New Post
1/12/2013 9:53 AM
 

I was surprised too, but it does. Originally, the module was built against 2.0 and yes, then it works for DNN 5 and 6. However, the same issue with the temporary assembly then occurs when running on DNN7. I decided to build it against .NET 4 simply because it solves the problem on DNN7 and I expect that to be the majority platform going forwards. But any solution that works for all versions will do me.



Paul Taylor
Dotcom Software Solutions Ltd
DotNetNuke, ASP.NET and SQL Server Development
 
New Post
1/12/2013 10:58 AM
 

Richard,

Thanks, you were right. Turns out I had something misconfigured when I initially tried to integrate the module as a .NET 2.0 (actually 3.5) module. Probably the target framework of a dependent module. Anyway I recompiled all as 3.5 assemblies and the module now works on all platforms.




Paul Taylor
Dotcom Software Solutions Ltd
DotNetNuke, ASP.NET and SQL Server Development
 
New Post
1/12/2013 11:05 AM
 
Hi Paul,

I didn't do much, but I am delighted that your problem is solved.

Best wishes,
- Richard
Agile Development Consultant, Practitioner, and Trainer
www.dynamisys.co.uk
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesModule backwards compatibilityModule backwards compatibility


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