Reporting Services 2005: Attempt to export to Excel gives "Object reference not set to an instance of an object." error - sql-server

I have a moderately complex report consisting of a lot of subreports.
One particular one is causing an issue: if you run it standalone, it works fine. If you integrate it as a subreport, it refuses to allow you to export to Excel format (from Preview), with the following error:
An error occurred during local report processing.
An error occurred during rendering of the report.
An error occurred during rendering of the report.
Object reference not set to an instance of an object.
Producing to any other format works fine. Most of my Googling thus far has said "Reinstall Reporting Services", which I really don't want to do (I reinstalled for a previous issue, and it took me a good day or so to get everything happy again - possibly more), especially given it's not a guaranteed fix.
I don't know if it's significant, but the reports do make us of Dundas Charts, which may make it more difficult to parse.
Anyone know a better solution?
Update:
When I try Exporting to Excel on the report server, it gives me this:
Object reference not set to an instance of an object.
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: System.Exception: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[Exception: Object reference not set to an instance of an object.]
[Exception: An error occurred during rendering of the report.]
[Exception: An error occurred during rendering of the report.]
Microsoft.Reporting.WebForms.ServerReport.ServerUrlRequest(Boolean isAbortable, String url, Stream outputStream, String& mimeType, String& fileNameExtension) +520
Microsoft.Reporting.WebForms.ServerReport.InternalRender(Boolean isAbortable, String format, String deviceInfo, NameValueCollection urlAccessParameters, Stream reportStream, String& mimeType, String& fileNameExtension) +936
Microsoft.Reporting.WebForms.ServerReport.Render(String format, String deviceInfo, NameValueCollection urlAccessParameters, Stream reportStream, String& mimeType, String& fileNameExtension) +28
Microsoft.Reporting.WebForms.ServerReportControlSource.RenderReport(String format, String deviceInfo, NameValueCollection additionalParams, String& mimeType, String& fileExtension) +85
Microsoft.Reporting.WebForms.ExportOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response) +143
Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context) +152
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

I ran into the same issue with the below statement. Everything works fine as expected except when exporting to excel.
=iif(ReportItems!textbox343.Value>ReportItems!textbox344.Value or ReportItems!textbox346.Value>ReportItems!textbox347.Value,"Yes","No")
Here is the fix. Added braces and voila voodoo magic it works.
=iif((ReportItems!textbox343.Value>ReportItems!textbox344.Value) or (ReportItems!textbox346.Value>ReportItems!textbox347.Value),"Yes","No")

I believe that the Excel export of a report containing subreports is a known issue in SSRS 2005 and is addressed in 2008. I don't know if the upgrade is an option for you?

Related

Clickonce restart failing every third build and publish

I'm having trouble with ClickOnce and a WinForms application, .Net version 4. I can install the application and it works fine with say version 2.1.79.1.
I then do nothing except change the publish version to 2.1.79.2 and recompile and publish. When I run the app it updates correctly and restarts without a problem.
Then I do nothing except change the publish version to 2.1.79.3 and recompile and publish. When I run the app it appears to update correctly (no error messages) but when the app tries to restart there is a message that says 'Application cannot be started' and I get the 'Value does not fall within the expected range' error listed below.
So I uninstall the program and then reinstall. Version 2.1.79.3 runs fine.
I do nothing except change the publish version to 2.1.79.4 and recompile and publish. Everything is fine. I change to version 2.1.79.5, recompile and publish, everything is find. I change to 2.1.79.6, the update seems to run but restarting the app gives the 'Value does not fall within the expected range' error.
I am literally doing nothing between these builds except changing last number of the Publish version on the Publish tab in the project properties. No code is being changed. Every third build and publish is consistently failing in this way.
Does anyone have any idea what could be happening or any suggestions as to how I could troubleshoot this?
PLATFORM VERSION INFO
Windows : 10.0.15063.0 (Win32NT)
Common Language Runtime : 4.0.30319.42000
System.Deployment.dll : 4.7.2046.0 built by: NET47REL1
clr.dll : 4.7.2046.0 built by: NET47REL1
dfdll.dll : 4.7.2046.0 built by: NET47REL1
dfshim.dll : 10.0.15063.0 (WinBuild.160101.0800)
SOURCES
Deployment url : file:///C:/Users/MyUser/Desktop/MyAppName.appref-ms%7C
ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* Activation of C:\Users\MyUser\Desktop\MyAppName.appref-ms| resulted in exception. Following failure messages were detected:
+ Value does not fall within the expected range.
COMPONENT STORE TRANSACTION FAILURE SUMMARY
No transaction error was detected.
WARNINGS
There were no warnings during this operation.
OPERATION PROGRESS STATUS
* [5/8/2017 9:06:00 AM] : Activation of C:\Users\MyUser\Desktop\MyData.appref-ms| has started.
* [5/8/2017 9:06:00 AM] : Performing necessary update check as specified by the deployment.
ERROR DETAILS
Following errors were detected during this operation.
* [5/8/2017 9:06:00 AM] System.ArgumentException
- Value does not fall within the expected range.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.NativeMethods.CorLaunchApplication(UInt32 hostType, String applicationFullName, Int32 manifestPathsCount, String[] manifestPaths, Int32 activationDataCount, String[] activationData, PROCESS_INFORMATION processInformation)
at System.Deployment.Application.ComponentStore.ActivateApplication(DefinitionAppId appId, String activationParameter, Boolean useActivationParameter)
at System.Deployment.Application.SubscriptionStore.ActivateApplication(DefinitionAppId appId, String activationParameter, Boolean useActivationParameter)
at System.Deployment.Application.ApplicationActivator.Activate(DefinitionAppId appId, AssemblyManifest appManifest, String activationParameter, Boolean useActivationParameter)
at System.Deployment.Application.ApplicationActivator.ProcessOrFollowShortcut(String shortcutFile, String& errorPageUrl, TempFile& deployFile)
at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl, Uri& deploymentUri)
at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivationWithRetry(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivationWithRetry(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
COMPONENT STORE TRANSACTION DETAILS
No transaction information is available.

Random issues with ViewEngine in Nancy 2.0.0 pre-release

I've been experiencing some odd issues with my application that I am not sure how to go about tracking down because it is so random. I was wondering if there may be any ideas based on the stack trace below.
Here is some quick bullet points:
Issue seems to be related to code in the View (.cshtml)
It RANDOMLY appears and it has something to do with the session cookie because if you try from another computer then it is no issue or if you clear your cache it is no issue
My GetUserByIdentifier is wrapped in a try{}catch{} which returns NULL if we enter the catch{}.. which should redirect to the login screen.
Could this be something internal causing the error message? This unhandled exception can even happen on my login.cshtml page which doesn't even have any code in the view.
The error message:
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
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: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) +72
System.SZArrayHelper.get_Item(Int32 index) +13816967
Nancy.ViewEngines.Razor.RazorViewEngine.GetLineNumber(Int32 startLineIndex, IReadOnlyList`1 compilationSource) +39
Nancy.ViewEngines.Razor.<>c__DisplayClass19_0.<BuildErrorMessages>b__0(Diagnostic error) +118
System.Linq.WhereSelectArrayIterator`2.MoveNext() +80
System.Linq.WhereEnumerableIterator`1.MoveNext() +51
System.Linq.Buffer`1..ctor(IEnumerable`1 source) +250
System.Linq.Enumerable.ToArray(IEnumerable`1 source) +106
Nancy.ViewEngines.Razor.RazorViewEngine.BuildErrorMessages(IEnumerable`1 errors, IList`1 templateLines, IReadOnlyList`1 compilationSource) +272
Nancy.ViewEngines.Razor.RazorViewEngine.BuildErrorMessage(EmitResult result, ViewLocationResult viewLocationResult, String sourceCode) +366
Nancy.ViewEngines.Razor.<>c__DisplayClass14_0.<GenerateRazorViewFactory>b__0() +49
Nancy.ViewEngines.Razor.RazorViewEngine.GetViewInstance(ViewLocationResult viewLocationResult, IRenderContext renderContext, Object model) +1064
Nancy.ViewEngines.Razor.<>c__DisplayClass9_0.<RenderView>b__0(Stream stream) +4700
Nancy.Hosting.Aspnet.<ProcessRequest>d__2.MoveNext() +381
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13891908
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
System.Web.TaskAsyncHelper.EndTask(IAsyncResult ar) +69
System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +178

How to use ReactiveUI with WinForms

I have decided to learn ReactiveUI after seeing what can be done with it, but my enthusiasm has been broken at the first attempt to run a simple project. I have recreated the example from this article, using reactiveui-winforms.Net40 version 6.5.0 from NuGet. Everything compiles ok, but i get an exception during runtime at the following line
var OKCmdObs = this.WhenAny(vm => vm.EnteredText,
s => !string.IsNullOrWhiteSpace(s.Value));
System.InvalidOperationException occurred
HResult=-2146233079
Message=The current thread has no Dispatcher associated with it.
Source=System.Reactive.Windows.Threading
StackTrace:
at System.Reactive.Concurrency.DispatcherScheduler.get_Current()
at ReactiveUI.PlatformRegistrations.<>c.<Register>b__0_7() in C:\workspace\git-perso\ReactiveUI\ReactiveUI\Platform\Registrations.cs:line 75
InnerException:
Does anyone have any idea of what's happening ?
The mentioned article does not have the compiled project available for download, and i didn't find any complete "Hello-World" project for reactiveui-winforms.
My test project can be downloaded here.
In Visual Studio, if i Continue(F5), another exception occures :
System.NullReferenceException occurred
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=ReactiveUI
StackTrace:
at ReactiveUI.IROObservableForProperty.<>c__DisplayClass1_0.<GetNotificationForProperty>b__6(IReactivePropertyChangedEventArgs`1 x) in C:\workspace\git-perso\ReactiveUI\ReactiveUI\IROObservableForProperty.cs:line 44
InnerException:
If i continue to hit F5 i get :
System.Exception was unhandled by user code
HResult=-2146233088
Message=An OnError occurred on an object (usually ObservableAsPropertyHelper) that would break a binding or command. To prevent this, Subscribe to the ThrownExceptions property of your objects
Source=ReactiveUI
This exception is caused because RxUI always tries to initialize for WPF, even though (because you're also using the winforms package) it'll override this setting with a Winforms-based scheduler right after.
It should be harmless though, as it's catched and ignored. You're probably hitting it within VS ?

Elmah.MVC - MVC 5 ArgumentNullException: Value cannot be null. Parameter name id:

I am receiving an error when trying to render the elmah error logs and using SQL DB. "http://localhost:5525/elmah" [ArgumentNullException: Value cannot be null.
Parameter name: id]
Elmah.ErrorLogEntry..ctor(ErrorLog log, String id, Error error) in c:\builds\ELMAH-1.2-SP2\src\Elmah\ErrorLogEntry.cs:57
Elmah.SqlErrorLog.ErrorsXmlToList(XmlReader reader, IList errorEntryList) in c:\builds\ELMAH-1.2-SP2\src\Elmah\SqlErrorLog.cs:365
Elmah.SqlErrorLog.ErrorsXmlToList(String xml, IList errorEntryList) in c:\builds\ELMAH-1.2-SP2\src\Elmah\SqlErrorLog.cs:332
Elmah.SqlErrorLog.GetErrors(Int32 pageIndex, Int32 pageSize, IList errorEntryList) in c:\builds\ELMAH-1.2-SP2\src\Elmah\SqlErrorLog.cs:186
Elmah.ErrorLogPage.OnLoad(EventArgs e) in c:\builds\ELMAH-1.2-SP2\src\Elmah\ErrorLogPage.cs:76
System.Web.UI.Control.LoadRecursive() +54
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
I have the latest Core Elmah 1.2-SP2 and the latest Elmah.MVC 2.1.2. I installed the Nuget package Elmah.MVC with default web.config settings.
When I configure web.config to log errors to the database the errors are recorded in the database but I can't render the error page. When I don't configure the database the elmah page renders just fine.
<elmah>
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="Company" />
</elmah>
Decompiling Elmah I see in the constructor where the argument is thrown.
if (id == null)
throw new ArgumentNullException("id");
if (id.Length == 0)
throw new ArgumentException((string) null, "id");
All my ErrorId's in the database are populated GUIDs.
I am stumped as to what id is not being passed to the core elmah. Has anyone ran into this before?
I downloaded the core Elmah code and stepped through to find in SqlErrorLog.cs, method ErrorsXmlToList(XmlReader reader, IList errorEntryList) there is a call to get id which was the parameter missing: string id = reader.GetAttribute("errorId"); I lower cased "errorid" and everything worked. Obviously this is not a good solution because this is core code that everyone works with so I dug deeper.
This led me to look at stored procedure ELMAH_GetErrorsXml. I found in our database we had a lower case "errorid". I updated the stored procedure to select "errorId" and changed the core Elmah back to the original code and of course everything worked.

Need help for IBatis?

I am using IBatis for my applicaiton. I am using IBatis 1.6.1 version.I thought it can handle all operations related to DB connections. But I am having little bit concern about this now. Sometimes I am getting the following error details to my log file,
Message
Unable to open connection to "MySQL, MySQL provider 5.0.8.1".
Source
IBatisNet.DataMapper
Stack
at IBatisNet.DataMapper.SqlMapSession.OpenConnection(String connectionString) at IBatisNet.DataMapper.SqlMapSession.OpenConnection() at IBatisNet.DataMapper.Commands.DbCommandDecorator.System.Data.IDbCommand.ExecuteReader() at IBatisNet.DataMapper.MappedStatements.MappedStatement.RunQueryForObject(RequestScope request, ISqlMapSession session, Object parameterObject, Object resultObject) at IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForObject(ISqlMapSession session, Object parameterObject, Object resultObject) at IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForObject(ISqlMapSession session, Object parameterObject) at IBatisNet.DataMapper.SqlMapper.QueryForObject(String statementName, Object parameterObject) at Sunya.VideoStreaming.Persistence.SchoolRepository.GetSchoolDetailsByUrl(String SchoolUrl) in D:\SVN\Sprint104\Persistence\SchoolRepository.cs:line 192 at EduVisionBasePage.GetSchoolUrl(School& _school) at ASP.global_asax.Application_BeginRequest(Object sender, EventArgs e) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Message
Too many connections
Source
MySql.Data
Stack
at MySql.Data.MySqlClient.MySqlStream.OpenPacket() at MySql.Data.MySqlClient.NativeDriver.Authenticate411() at MySql.Data.MySqlClient.NativeDriver.Authenticate() at MySql.Data.MySqlClient.NativeDriver.Open() at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() at MySql.Data.MySqlClient.MySqlPool.GetConnection() at MySql.Data.MySqlClient.MySqlConnection.Open() at IBatisNet.DataMapper.SqlMapSession.OpenConnection(String connectionString)
Does someone has some idea about the error?
iBATIS has been around for quite a while (2001), and I have my doubts that there's a major bug in the MySQL provider. You mentioned that the error occurs "sometimes" - if it's intermittent, perhaps the problem lies elsewhere. "Unable to open connection" is likely to mean just that. Network errors, database outages, too many unreleased connections, authentication issues, etc. might all cause this error.
If you are using the JDBC transaction manager set the datasource to 'UNPOOLED' in you myBatisConfig.xml
<transactionManager type="JDBC"/>
<dataSource type="UNPOOLED">
.
.
.
</dataSource>
</environment>
That is the short answer. My hunch is The connection pool class is holding connections too long. Lowering the values for 'poolMaximunActiveConnection' and 'poolMaximunIdleConnections' may solve the problem.
Notes: using myBatis 3.0.3 Java, mySql Windows 5.5.9
search terms: iBatis, myBatis, 'Too many connections', mySQL

Resources