ReportViewer 10.0.0.0 in DotNetNuke 4.8.X: PageLoadException - dotnetnuke

We had a MS ReportViewer 9.0.0.0 control on a custom DotNetNuke module in the (legacy) 4.8.2 version. While trying to upgrade to 10.0.0.0 we run into the following error:
PageLoadException: Page cannot be null. Please ensure that this operation is being performed in the context of an ASP.NET request.
Here's the relevant ASCX code for the main View control in the DotNetNuke module:
<%# Register assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
<rsweb:ReportViewer ID="report" runat="server" ProcessingMode="Remote" />
Additionally, there's some code behind that sets the IReportServerCredentials, I've left out that bit of code as the problem occurs before the report's even rendered.
The stack trace is quite large, but here are some of the relevant bits:
DotNetNuke.Services.Exceptions.PageLoadException
System.InvalidOperationException: Page cannot be null
at System.Web.UI.ScriptManager.get_IPage()
...
at Microsoft.Reporting.WebForms.ReportViewer.Render(HtmlTextWriter writer)
...
at DotNetNuke.Framework.PageBase.Render(HtmlTextWriter writer)
My Google-fu is not helping me at all. I've tried fiddling with the ScriptManager in DotnetNuke's Default.aspx.vb file, playing around with the properties of the ReportViewer control, and reading the various related MSDN articles. No dice.
The question: How to get ReportViewer 10.0.0.0 working in DotNetNuke 4.8.x?

This is one of the few questions I've had lately which couldn't be answered by searching on SO. After some more fiddling around I've solved the problem and figured I'd give the new Answer your own question feature a spin. So here's what solved the problem for me.
This problem can be solved by enabling the DotNetNuke AJAX implementation for the specific control in your module that holds the ReportViewer. Credits go to this old post detailing the steps to get this working. See also the 2007 DotNetNuke blogpost on this feature. The essence is as follows:
Log in as DNN Host
Go to the module definition for your module
Edit the settings for the module
Find the control with the ReportViewer
Click to edit the settings for the control
Hit the Supports Partial Rendering setting checkbox
Save the settings
The ReportViewer control should now work.

Related

CefSharp.Wpf: FileLoadException when trying to load assembly

We have an old legacy application that is running with MS Access. We are in the process of migrating it to WPF. For that we created a WinForms control, that is showing our new WPF stuff in an ElementHost. This WinForms control is then somehow used in a COM ocx which then is placed on a MS Access form. This works so far, and for the time being this is like it is and I can't change it.
Until now we used the built-in WebBrowser control from .NET to show web sites, but since this control is based on IE 11, we are looking for a replacement. WebView2 is not working in an ElementHost, so now we are investigating and testing CefSharp for WPF.
In all of my stand-alone tests it worked so far, but when I tried to integrate it into our software today I stumbled upon a problem and I'm not sure how to fix that.
When I put the ChromiumWebBrowser control from CefSharp onto our WPF window and ran our software I got an IO.FileLoadException for the file CefSharp.Wpf. Checking that with fuslogvw.exe I've seen, that .NET looked for that file in the directory where the MSAccess.exe is situated, probably because this in fact is the executing assembly.
So I registered an AppDomain.CurrentDomain.AssemblyResolve event to manually load the necessary files from where they are situated. This worked for
CefSharp.Wpf
CefSharp
CefSharp.Core
But then it tried to load CefSharp.Core.Runtime and although this assembly is present I get an IO.FileLoadException (this file or one of its dependencies can't be found) when loading this assembly. I assume that it tries to find one of its own dependencies (non .NET) and looks for it in the wrong place (maybe the MS Access directory again?).
Do you have any suggestions how I can tell CefSharp and all of its dependencies (direct or indirect) where they can be found and where they should be loaded from?

SharePoint embed of Silverlight app breaking ControlTemplates

Strange problem here, I have a page with 4 ControlTemplates declared in the page resources. In the code for the page, I declare a reference to each of these ControlTemplates so that I can use them in binding. This works fine Out-Of-Browser, and In-Browser, except when it is running in the Silverlight Web Part in SharePoint. In SharePoint, the buttons that I want templated are shown as just normal buttons with the class as the text instead of the special layout and content I define in the template. Any idea why it would work everywhere but in SharePoint?
While I am not sure what caused the null reference only while being ran in SharePoint, I refactored my code to make the ItemsControl.ItemsSource reference a property instead of a single assignment of a List<> to it. Now it is working just like it should.
Helpful in figuring this out was the ability to attach Visual Studio to the Internet Explorer (didn't work so well for Chrome) process that was running the Silverlight Web Part. This is found in Visual Studio by going to the Tools menu > Attach to Process. Which IE process it is will be obvious as it will have Silverlight in the Type column.

Codeplex sample browser - what UI technology is it?

Codeplex has a strange application for downloading and browsing Windows samples, and I have not been able to understand just what it is:
http://1code.codeplex.com/releases/view/64539
When the click-once application above is installed, it creates a single file in the form of a shortcut which contains the following line only:
http://1code.codeplex.com/releases/clickonce/SampleBrowser.application#SampleBrowser.application, Culture=neutral, PublicKeyToken=48e4844f2d49d017, processorArchitecture=msil
Then, when this shortcut is double-clicked, a sort of browser application comes up, but it has no window borders and is very modern looking. What type of technology is this? I am including the WPF tag otherwise I am at my wit's end as to what it is.
(Wanted to include an image of the said application here but can't seem to upload an image as I am getting the following error: "Failed to upload image; imgur is rejecting the request") Here's a link to that image: http://imgur.com/B38P6
Thanks.
The initial part about the odd link is simply a click-once application. The rest of the application is hidden away somewhere in your user directory.
The "browser" is simply a window which has had its chrome modified. Could be pretty much any technology. A couple examples in winForms and wpf.
As a caution, if doing a custom chrome in wpf don't use the AllowTransparency="True" if you want your comboboxes and such to work properly on XP.

Visual Studio 2010 Designer Error on Run

I am using using VS2010 and if I have a form open in designer mode and run my application the designer tab will no longer show the form designer but instead an error will be displayed (and it is only fixed by restarting the IDE) saying:
"To prevent possible data loss before loading the designer, the
following errors must be resolved:"
1 Error:
"The designer could not be shown for this file because none of the
classes within it can be designed. The designer inspected the
following classes in the file: ##### --- The base class ##### could
not be loaded. Ensure the assembly has been referenced and that all
projects have been built"
I then shows the following call stack:
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(IDesignerSerializationManager manager)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host)
Any help is greatly appreciated this is really annoying.
Thanks,
Joel.
I get this visual studio bug too now and then, and I deeply ignore the error text, instead I do the following:
Close the Design-tab
Reopens the Design mode by double click in Solution Explorer, or by right clicking Source code tab and select View Designer
Suddenly everything works again!
If not helping, you may have to change bullet 2 into:
Close and restart Visual Studio.
Maybe this can help you out.
I usually close the visual form, rebuild the solution, right-click then select "view designer" in the form code.
Very, very annoying. I am thinking of dropping back to VS2008.
Close the form. Clean the solution. Rebuild the solution. Reopen the form. Worked for me when nothing else would.
I had this same issue and I was able to resolve this by creating new project and then compiled and run the project and then I imported all the files and ran the project again and automatically it was working again did nothing extra.
I'm able to avoid restarting VS by doing the following
Add a new user control
Drag and drop some of your custom user controls on to it (If it gives you an error, build the solution again).
Reopen your control.
In my case, I have a winforms project with several custom controls that are used by other custom controls. Whenever I open some of those custom controls, I get a the "The base class ..." error. Adding a new custom control, building the project and then adding some custom controls from my project to the new custom control allowed me to open the custom controls that were giving me the "The base class ..." error.
UPDATE: I think I found the problem. My controls were not 'added' properly to the csproj file. In the csproj file, the files for partial classes of UI controls/components need the 'DependentUpon' attribute.
E.x.:
before:
<Compile Include="Windows\Forms\DataGridView.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Windows\Forms\DataGridView.Designer.cs" />
after:
<Compile Include="Windows\Forms\DataGridView.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Windows\Forms\DataGridView.Designer.cs">
<DependentUpon>DataGridView.cs</DependentUpon>
</Compile>
I had a situation where a custom user control appeared to be creating the error (not sure why) so I removed references to the user control from the form and the error went away.
It seems that after installing SP1 the problem has gone away.
Thanks for your help everyone.
I had the same problem using A control With Generics
MvpUserControl<Presenter,IViewMode> : UserControl
what I do it's Remove the Reference and Add again, Clean and Rebuild the Solution I Hope this can be useful for anybody else
I had the same problem with VS2010 SP1. Finally using Windows Update I saw some updates for Visual Studio and .Net, I installed them and is not happening any more.
Old post, but for those whom may find this...
Just ran in to this error and for me it was relatively simple fix.
Found that it may have something to do with the names of your classes, and renaming the problematic class to a higher order. That is the alphabetical order it appears in the assembly (Where A is higher than Z).
MSDN Article
Good luck.
This error occur if the Form class is not a first class in the file, for example if there is some helper class at the beginning of the file.
To solve this issue, move all other classes except Form class to the bottom of the file.
Don't code in Form1.Designer.cs. Move your logic to Form1.cs (hit F7 on Form1.cs [Design] tab).
"In the project file (.vcxproj), locate the entry for the target
Framework version. For example, if your project is designed to use the
.NET Framework 4.5, locate
v4.5 in the
element of the element. "
(Microsoft)
In my case the "v4.5" didn't exist so I add it, and everything is good now.
I tried clean solution and re-build solution and worked for me.
Hope this help!
This solution works fine, please follow these steps below to solve your problem:
Check the reference if load correctly
Clean the solution and rebuild again
Clean the project and rebuild again
Clean your project and open it again
I was login as administrator in visual studio . I just close my visual studio and again open it without run as administrator and my problem is solved
I ran into this today after upgrading VS2019. I went to properties, configuration tab, and set the projects to Configuration = Debug, Platform = Any CPU. Then it worked.
I faced this issue.
To prevent possible data loss before loading the designer, the following errors must be resolved:
I found solution for this problem:
Close all open tabs, and refresh (sync active documents) the solution.
For more information, you can see this video : https://youtu.be/Q3x2HBd7BDs

Retrieve baseUri w/o resorting to Application.Current

My custom controls are not loading in VS.NET's designer because of a null reference exception. It's got everything to do with the way I am retrieving the baseUri of the application when it runs in the browser:
_uriPrefix = Application.Current.Host.Source.AbsoluteUri.Substring(0,
Application.Current.Host.Source.AbsoluteUri.IndexOf("/ClientBin")).Trim();
According to the exception details and the help file I'm directed to (here) I'm not correctly designing my app for a runtime that's not the browser (i.e. the new WPF editor in VS.NET or Expression Blend).
So, the question is how do retrieve the baseUri (the http://localhost:#### part of my application) if I can't use Application.Host which apparently is null during design time? is there a safe way to do this so I can load my custom controls in a designer?
To eleborate on the problem and solution (i wasn´t finished writing it when you posted your own answer)
Your problem is the runtime context you are in.
When your page is run as on a ASPX.Net page, your are hosted by the IIS->ASP.Net pipeline. This application will give your the HTTPContext and your Application.Current is refering to the W3WP.EXE process in which the ASP.Net pipeline is serving your page.
When your page is displayed in the MS Visual Studio designer it does not provide this HTTPContext since there is none. The request to render your control did not come through an HTTP request, but the Visual Studio designer running inside Visual Studio.
To have your control be displayed correctly during design time, you´ll have to add ´design time support classes´. There are a number in the .Net framework you can use directly, but for custom serialization (writing the server ASP.Net tags or rendering a HTML preview with styling) you´ll have to put in some more effort and write your own designer classes.
Hope this helps,
Duh! I hate/love when I do this. I'm answering my own question (again). I can use the DesignerProperties.IsInDesignTool boolean to test if I'm in design mode or not:
if (!DesignerProperties.IsInDesignTool)
_uriPrefix = Application.Current.Host.Source.AbsoluteUri.Substring(0,
Application.Current.Host.Source.AbsoluteUri.IndexOf("/ClientBin")).Trim();
Now I can view my custom control in the new VS 2010 editor. Yeah!

Resources