DNN Upgrade 7 to 8 Error (DotNetNuke.UI.WebControls.SolPartActions) - c#

when i upgrade the my dnn web site its give the following error
Could Not Load Container: /Portals/_default/Containers/20067-UnlimitedColorsPack-049/No Title.ascx
DotNetNuke.Services.Exceptions.ModuleLoadException: Unhandled error loading module.
---> System.Web.HttpParseException: Could not load type 'DotNetNuke.UI.WebControls.SolPartActions'.
---> System.Web.HttpParseException: Could not load type 'DotNetNuke.UI.WebControls.SolPartActions'.
---> System.Web.HttpException: Could not load type 'DotNetNuke.UI.WebControls.SolPartActions'.
at System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError)
at System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly)
at System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData) --- End of inner exception stack trace
--- at System.Web.UI.TemplateParser.ProcessException(Exception ex) at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)

In DNN 8 Removed the Solpart so this causes raise .
please remove the following line in your Container file.
<%# Register TagPrefix="dnn" TagName="ACTIONS" Src="~/Admin/Containers/SolPartActions.ascx" %>
<dnn:ACTIONS runat="server" id="dnnACTIONS" />
For more information about DNN Release click here

Looking at the error I assume the site itself does work, only that the correct Container is not loaded.
For some reason DNN can't find the Container No Title.ascx located in /Portals/_default/Containers/20067-UnlimitedColorsPack-049/. Manually check if it is still there and if the folder is accessible for IIS and the AppPool.
If not you can do 3 things:
Create that folder again and copy a Container from another Container
folder to that one and give it the same name.
Select a different default Container under "Site Settings >
Appearance".
Reinstall the Container pack under "Host > Extensions"
If one of there does not solve your problem then there is something else going on and we'll have to look further.

The key here is that the SolPart menu has been removed in DNN8. Either of the answers you've received will work. The first one, to remove references to SolPart from the container files should be fine, and not change behavior if the containers provide decoration that you want/need.
Might be a good time to revisit your skin/theme, as it's clearly an old one.

Related

Executable fails with weird exception

I am using ILMerge and Quartz.NET in a C# .NET 4.0 Windows Service application. The app runs fine without using ILMerge, but now that we're nearing shipping release, I wanted to combine all DLLs into a single executable.
Problem is, that ILMerge seems to work fine, but when I run the combined executable, it throws this exception:
Unhandled Exception: Quartz.SchedulerException: ThreadPool type 'Quartz.Simpl.SimpleThreadPool' could not be instantiated. ---> System.InvalidCastException: Unable to cast object of type 'Quartz.Simpl.SimpleThreadPool' to type 'Quartz.Spi.IThreadPool'.
at Quartz.Util.ObjectUtils.InstantiateType[T](Type type) in :line 0
at Quartz.Impl.StdSchedulerFactory.Instantiate() in :line 0
--- End of inner exception stack trace ---
at Quartz.Impl.StdSchedulerFactory.Instantiate() in :line 0
at Quartz.Impl.StdSchedulerFactory.GetScheduler() in :line 0
Does anyone have any idea why this is? I have been wasting over 4 hours already and I can't figure it out. If I don't combine with ILMerge, then everything runs fine (with the Quartz.dll and Common.Logging.dll in the same directory).
I'm sure someone must have tried packaging Quartz.net up like this before, any ideas?
Disclaimer: I don't know Quartz.NET at all, although I spent some time struggling with ILMerge. When I finally understood its limitations... I stopped using it.
ILMerge'd application tends to have problems with everything which contains the word "reflection".
I can guess (I've never used Quartz.NET) that some classes are resolved using reflection and driven by configuration files.
Class is not only identified by its name (with namespace) but also by assembly it is coming from (unfortunatelly it doesn't get displayed in exception message).
So, let's assume you had (before ILMerging) two assemblies A (for you Application) and Q (for Quartz.NET).
Assembly 'A' was referencing assembly 'Q' and was using a class 'Q:QClass' which was implementing 'Q:QIntf'.
After merging, those classes became 'A:QClass' and 'A:QIntf' (they were moved from assembly Q to A) and all the references in code has been replaced to use those (completely) new classes/interfaces, so "A:QClass" is implementing "A:QIntf" now.
But, it did not change any config files/embedded strings which may still reference "Q:QClass".
So when application is reading those not-updated config files it still loads "Q:QClass" (why it CAN find it is a different question, maybe you left assembly 'Q' in current folder or maybe it is in GAC - see 1).
Anyway, "Q:QClass" DOES NOT implement "A:QIntf", it still implements "Q:QIntf" even if they are binary identical - so you can't cast 'Q:QClass' to 'A:QIntf'.
The not-ideal-but-working solution is to "embed" assemblies instead of "merging" them. I wrote a open-source tool which does it (embedding instead of merging) but it is not related to this question. So if you decide to embed just ask me.
You can test it by removing (hiding, whatever works for you) every single instance of Q.dll on your PC. If I'm right, the exception should say now 'FileNotFound'.
You could try creating your own ISchedulerFactory and avoid using reflection to load all of your types.
The StdSchedulerFactory uses this code to creat a threadpool. It's where your error is happening and would be the place to start looking at making changes:
Type tpType = loadHelper.LoadType(cfg.GetStringProperty(PropertyThreadPoolType)) ?? typeof(SimpleThreadPool);
try
{
tp = ObjectUtils.InstantiateType<IThreadPool>(tpType);
}
catch (Exception e)
{
initException = new SchedulerException("ThreadPool type '{0}' could not be instantiated.".FormatInvariant(tpType), e);
throw initException;
}
The ObjectUtils.InstantiateType method that is called is this one, and the last line is the one throwing your exception:
public static T InstantiateType<T>(Type type)
{
if (type == null)
{
throw new ArgumentNullException("type", "Cannot instantiate null");
}
ConstructorInfo ci = type.GetConstructor(Type.EmptyTypes);
if (ci == null)
{
throw new ArgumentException("Cannot instantiate type which has no empty constructor", type.Name);
}
return (T) ci.Invoke(new object[0]);
}
Right after this section in the factory, datasources are loaded using the same pattern and then the jobs themselves are also loaded dynamically which means you'd also have to write your own JobFactory. Since Quartz.Net loads a bunch of bits and pieces dynamically at runtime going down this road means you might end up rewriting a fair amount of things.

ASP.net exception "FileNotFoundException" after idle when assembly file is present in the bin folder

The file is present, correctly named and not corrupted. If I move it out and back in from the "Bin", it works again, for about 5 minutes, then the error bellow comes back. Any operation that refreshes the file is fine, publishing it the anew, renaming or moving makes the site work again, for a moment.
{"Message":"Could not load file or assembly \u0027Ouranos,
Version=1.0.0.0, Culture=fr-CA, PublicKeyToken=null\u0027 or one of
its dependencies. Le fichier spécifié est introuvable.","StackTrace":"
at Services.Asynchrone(String DimensionX, String DimensionY, String
Action, String Culture, String Utilisateur, String Interface, String
Source, String Champ, String Valeur, String Classement, String
Direction, StriFileNotFoundExceptionng Page, String
Itérations)","ExceptionType":"System.IO."}
Fusion did give me an error code (0x80070002), which pointed me to get Process Monitor. Which lead me to the temporary assembly folder. Now I may be wrong about this. Comparing the cache files from an healthy website and the sick one, I noticed something odd.
Healthy website as all the DLL from the BIN in cache.
The sick website is missing two DLL in the cache that are present in the BIN.
Now, I know that ASP.net tends to say that the main library is missing when it's in fact one of the referenced library that is missing. In this current situation I don't know what I could do to fix that problem. The two DLL are not set in the cache, thus when it tries to load the main DLL it fails locating the two others from the cache and throws a file not found on the main DLL.
The two culprits are:
PresentationCore.dll
WindowsBase.dll
To troubleshot this kinf of errors, you can use Fusion log, instructions about how to enable it and how to use it can be found here: How to enable assembly bind failure logging (Fusion) in .NET.
It would seem that the following code actually fixes the problem. It checks for all the required assemblies for the assembly and loads the missing. I had such a code before and it did not work, because without the !(Assemblée is System.Reflection.Emit.AssemblyBuilder) && (Assemblée.GetType().FullName != "System.Reflection.Emit.InternalAssemblyBuilder") was not present and has the code causing an exception in .net 4.0 and over. It's not elegant, but it does the job.
public static void Chargeur()
{
var Assemblées_Chargées = (from Assembly Assemblée in AppDomain.CurrentDomain.GetAssemblies() where !(Assemblée is System.Reflection.Emit.AssemblyBuilder) && (Assemblée.GetType().FullName != "System.Reflection.Emit.InternalAssemblyBuilder") && (!Assemblée.GlobalAssemblyCache) && (Assemblée.CodeBase != Assembly.GetExecutingAssembly().CodeBase) select Assemblée).ToList();
var Chemins_Chargés = Assemblées_Chargées.Select(Assemblée => Assemblée.Location).ToArray();
var Chemins_Référencés = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.dll");
var Assemblées_NonChargées = Chemins_Référencés.Where(Références => !Chemins_Chargés.Contains(Références, StringComparer.InvariantCultureIgnoreCase)).ToList();
Assemblées_NonChargées.ForEach(path => Assemblées_Chargées.Add(AppDomain.CurrentDomain.Load(AssemblyName.GetAssemblyName(path))));
}

FileNotFoundException - no file missing

When entering a view for the first time, this exception is raised:
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
First of all - why would it just happen the first time I enter that specific view? Even IF the issue was in the constructor (which it could not be), it would be called (and the exception thrown) every time I enter the view.
Second of all - how would I find the source of such an exception? It doesn't break into the debugger, and there are no resource files (like background images, app bar icons) missing.
Lastly - what (except directly referencing files in the code) would throw such an exception?
I would show you the code in question, but the file is a bit too big to post all of it.
UPDATE:
After debugging, I have noticed that the error happens after the constructor and OnNavigatedTo() and before Loaded(). There is a thread being launched in the OnNavigatedTo method, but I have tried to try-catch every single element of that part (and every internal part of it), and no error was found.
UPDATE 2:
After debugging some more, I found the error message:
File or assembly name 'System.Windows.debug.resources, Version=2.0.5.0, Culture=en-US, PublicKeyToken=xxxxxxxxxxxxx', or one of its dependencies, was not found.
Also the stack trace:
at System.ThrowHelper.throwVersion37CompatException(ExceptionType newEType,
String newString, ExceptionType oldEType, String oldString)
at System.Reflection.Assembly.Load(String assemblyString)
at System.Windows.Resx..ctor()
at System.Windows.Resx.GetLoader()
at System.Windows.Resx.GetStringHelper(String name)
at System.Windows.Resx.GetString(String name)
at System.Windows.Controls.Primitives.ToggleButton.ToString()
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj,
IntPtr unmanagedObjArgs, Int32 argsTypeIndex,
Int32 actualArgsTypeIndex, String eventName)
you can set break for the first chance exception visual studio, debug in to see the detail about the FileNotFound exception, which file is missing.
sometime, clr try to find some extension dll, which is normally too magic to us. for example, if you use XmlSerialize in your project, if you don't use sgen.exe to generate the dynamic xml serialize dll for your serializble type, CLR will generate one during runtime, but before this, clr will try to load the assemble, which will cause FileNotFoundException, but catched

Cassette.AssetReferenceException being fired when removing a file from folder

I used to have a .js file in /Public/javascripts/jquery1.1js.
Everything was working perfectly but then I needed to delete this file from my project, so I just removed it from the solution in Visual Studio.
Now when I visit my application, I get:
Reference error in "~/Public/javascripts/jquery.unobtrusive-ajax.js",
line 1. Cannot find "~/Public/javascripts/jquery-1.5.1.js". Reference
error in "~/Public/javascripts/jquery.validate.unobtrusive.js", line
1. Cannot find "~/Public/javascripts/jquery-1.5.1.js".
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: Cassette.AssetReferenceException: Reference error
in "~/Public/javascripts/jquery.unobtrusive-ajax.js", line 1. Cannot
find "~/Public/javascripts/jquery-1.5.1.js". Reference error in
"~/Public/javascripts/jquery.validate.unobtrusive.js", line 1. Cannot
find "~/Public/javascripts/jquery-1.5.1.js".
Here's a stacktrace:
[AssetReferenceException: Reference error in "~/Public/javascripts/jquery.unobtrusive-ajax.js", line 1. Cannot find "~/Public/javascripts/jquery-1.5.1.js".
Reference error in "~/Public/javascripts/jquery.validate.unobtrusive.js", line 1. Cannot find "~/Public/javascripts/jquery-1.5.1.js".]
Cassette.BundleContainer.ValidateAssetReferences() +387
Cassette.BundleContainer..ctor(IEnumerable`1 bundles) +41
Granted, I know why this is happening, Cassette is still trying to find the deleted file, but I'm not sure how to tell Cassette: "Hey, this file is no longer relevant. Scan the folder again and rebuild a list of files you need to work with."
But I just don't know how to accomplish this.
The documentation has no mention of this and just implies that it should do this automatically for me.
Here's my Configuration class:
using Cassette.Configuration;
using Cassette.Scripts;
using Cassette.Stylesheets;
namespace XXX.WebUI
{
/// <summary>
/// Configures the Cassette asset modules for the web application.
/// </summary>
public class CassetteConfiguration : ICassetteConfiguration
{
public void Configure(BundleCollection bundles, CassetteSettings settings)
{
bundles.AddPerIndividualFile<ScriptBundle>("Public/javascripts/");
bundles.AddPerIndividualFile<StylesheetBundle>("Public/stylesheets/");
}
}
}
And in my _Layout.cshtml file:
#{
Bundles.Reference("Public/javascripts/site.js");
Bundles.Reference("Public/javascripts/jquery.validate.unobtrusive.js");
Bundles.Reference("Public/stylesheets/site.less");
}
<!DOCTYPE html>
...
<head>
<title>#ViewBag.Title</title>
#Bundles.RenderStylesheets()
...
#Bundles.RenderScripts()
</body>
Does the jquery.validate.unobtrusive.js file contain a JavaScript reference at the top to jquery-1.5.1.js?
The line would look like:
/// <reference path="jquery-1.5.1.js" />
If so, remove that line. Cassette uses those references to determine build order.
ref: http://getcassette.net/documentation/scripts
This can also happen if you reference files with the same root
e.g. easyXDM.js and easyXDM.debug.js
When you reference easyXMD.js it gives the exception and the solution seems to be use a different naming convention that ensures the roots are different such as easyXMDdebug.js.

Issue with GetLocalResource object

I am trying to access my local resources file in my code-behind. I did some googling since I was unsure of how to do it and found this:
oContent.Text = HttpContext.GetLocalResourceObject("NonSupport").ToString();
However, I get an error saying that it needs at least two parameters: VirtualPath and ResourceKey. There is a third, CultureInfo but that one is optional. When I put this in as my virtual path:
HttpContext.GetLocalResourceObject("App_LocalResources/ExpandableListView.aspx.resx", "NonSupport").ToString();
I get the following compiler error message:
The relative virtual path 'App_LocalResources/ExpandableListView.aspx.resx' is not allowed here.
I must be doing something wrong with this since my searches (and some posts I found on here) say all I need to do is call the resource key.
Any thoughts? Thanks!
Did you put a resource file with the name (your aspx web page).aspx.resx into a App_LocalResource folder underneath the path where your ASPX page lives??
Furthermore, just simply call the GetLocalResourceObject method on your current page:
oContent.Text = GetLocalResourceObject("NonSupport").ToString();
No need to use HttpContext for that - the method is defined on the Page class.
Marc

Categories