Friday, March 9, 2012

NullReferenceException when using data-driven subscription with custom data extension

Hello,
I am trying to set up a data-driven subscription, where the command
that returns the list of recipients is run against a custom data
provider extension. However, when I validate the query (on step 3 of
the wizard), I always get the error rsCannotPrepareQuery, with the
message "Object reference not set to an instance of an object." When I
step into the code, the exception is being thrown inside the following
stack trace:
Microsoft.ReportingServices.Library.SubscriptionManager.PrepareQuery()
Microsoft.ReportingServices.Library.RSService.PrepareQuery()
Microsoft.ReportingServices.WebServer.ReportingService.PrepareQuery()
System.Web.Services.Protocols.LogicalMethodInfo.Invoke()
...
The exception is thrown right after IDbConnection.Open() returns, which
is immediately before IDbConnection.CreateCommand() is called.
Everywhere else, my custom data provider extension works great. And it
doesn't matter what query or credentials I type it - the problem always
exists.
I am running MS RS 2000 SP1.
Thanks in advance.Which interfaces do you implement: RS.IDbConnection, etc or
System.Data.IDbConnection?
--
Alex Mineev
Software Design Engineer. Report expressions; Code Access Security; Xml;
SQE.
This posting is provided "AS IS" with no warranties, and confers no rights
<bigredgum1@.excite.com> wrote in message
news:1107886911.665093.180630@.c13g2000cwb.googlegroups.com...
> Hello,
> I am trying to set up a data-driven subscription, where the command
> that returns the list of recipients is run against a custom data
> provider extension. However, when I validate the query (on step 3 of
> the wizard), I always get the error rsCannotPrepareQuery, with the
> message "Object reference not set to an instance of an object." When I
> step into the code, the exception is being thrown inside the following
> stack trace:
> Microsoft.ReportingServices.Library.SubscriptionManager.PrepareQuery()
> Microsoft.ReportingServices.Library.RSService.PrepareQuery()
> Microsoft.ReportingServices.WebServer.ReportingService.PrepareQuery()
> System.Web.Services.Protocols.LogicalMethodInfo.Invoke()
> ...
> The exception is thrown right after IDbConnection.Open() returns, which
> is immediately before IDbConnection.CreateCommand() is called.
> Everywhere else, my custom data provider extension works great. And it
> doesn't matter what query or credentials I type it - the problem always
> exists.
> I am running MS RS 2000 SP1.
> Thanks in advance.
>|||My connection class implements
Microsoft.ReportingServices.DataProcessing.IDbConnection.
I am basically just using the code provided in the Microsoft article
"Using an ADO.NET DataSet as a Reporting Services Data Source."
Thanks for your help.|||I need more info. Could you please repro it once again and send me recent rs
logs?
thanks
--
Alex Mineev
Software Design Engineer. Report expressions; Code Access Security; Xml;
SQE.
This posting is provided "AS IS" with no warranties, and confers no rights
<bigredgum1@.excite.com> wrote in message
news:1108048910.737444.302770@.f14g2000cwb.googlegroups.com...
> My connection class implements
> Microsoft.ReportingServices.DataProcessing.IDbConnection.
> I am basically just using the code provided in the Microsoft article
> "Using an ADO.NET DataSet as a Reporting Services Data Source."
> Thanks for your help.
>|||Sure. To reproduce, follow these steps:
- Set up the custom data extension as described in the article "Using
an ADO.NET DataSet as a Reporting Services Data Source".
- Go to the Report Manager web site and view any report.
- Click on the Subscriptions tab.
- Click the New Data-driven Subscription button.
- On page 1, enter any description and delivery provider. Select
"Specify for this subscription only". Click Next.
- On page 2, select your custom data extension. Enter any connection
string. Select "Credentials stored securely in the report server" and
enter any user name and password. Click Next.
- On page 3, enter any text and click Validate. The error
rsCannotPrepareQuery and text "Object reference not set to an instance
of an object" is displayed.
(Incidentally, if you choose "Credentials are not required" on page 2,
then on page 3 when you attempt to validate your query, you will get
error rsInvalidDataSourceCredentialSetting. This appears to be another
bug or design mistake. If my custom data extension does not require
credentials (e.g. it obtains them from a configuration file), then
there is no reason I should have to enter them in the UI. This just
ends up being confusing for end users to enter meaningless
credentials.)
When I click the Validate button on step 3 of the data-driven
subscription wizard, the following is appended to the ReportServer log
(I cranked up logging to Verbose):
aspnet_wp!runningrequests!15c4!02/10/2005-14:42:53:: v VERBOSE: User
map'<Users><User><Name>Person
1</Name><Paths><Path>http://mymachine/ReportServer/reportservice.asmx</Path><NrReq>1</NrReq></Paths></User></Users>'
aspnet_wp!runningrequests!15c4!02/10/2005-14:42:53:: v VERBOSE:
SoapAction:
"http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices/GetSystemProperties"
aspnet_wp!library!15c4!02/10/2005-14:42:53:: v VERBOSE: Call to
GetSystemProperties()
aspnet_wp!library!15c4!02/10/2005-14:42:53:: v VERBOSE: Call to
GetSystemProperties completed.
aspnet_wp!runningrequests!17fc!02/10/2005-14:45:07:: v VERBOSE: User
map'<Users><User><Name>Person
1</Name><Paths><Path>http://mymachine/ReportServer/reportservice.asmx</Path><NrReq>1</NrReq></Paths></User></Users>'
aspnet_wp!runningrequests!17fc!02/10/2005-14:45:07:: v VERBOSE:
SoapAction:
"http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices/ListSecureMethods"
aspnet_wp!runningrequests!17fc!02/10/2005-14:45:07:: v VERBOSE: User
map'<Users><User><Name>Person
1</Name><Paths><Path>http://mymachine/ReportServer/reportservice.asmx</Path><NrReq>1</NrReq></Paths></User></Users>'
aspnet_wp!runningrequests!17fc!02/10/2005-14:45:07:: v VERBOSE:
SoapAction:
"http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices/GetSystemPermissions"
aspnet_wp!library!17fc!02/10/2005-14:45:07:: i INFO: Call to
GetSystemPermissions
aspnet_wp!runningrequests!17fc!02/10/2005-14:45:07:: v VERBOSE: User
map'<Users><User><Name>Person
1</Name><Paths><Path>http://mymachine/ReportServer/reportservice.asmx</Path><NrReq>1</NrReq></Paths></User></Users>'
aspnet_wp!runningrequests!17fc!02/10/2005-14:45:07:: v VERBOSE:
SoapAction:
"http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices/ListChildren"
aspnet_wp!library!17fc!02/10/2005-14:45:07:: v VERBOSE: Call to
ListChildren( '/', False )
aspnet_wp!library!17fc!02/10/2005-14:45:07:: v VERBOSE: Call to
ListChildren completed
aspnet_wp!runningrequests!17fc!02/10/2005-14:45:07:: v VERBOSE: User
map'<Users><User><Name>Person
1</Name><Paths><Path>http://mymachine/ReportServer/reportservice.asmx</Path><NrReq>1</NrReq></Paths></User></Users>'
aspnet_wp!runningrequests!17fc!02/10/2005-14:45:07:: v VERBOSE:
SoapAction:
"http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices/ListExtensions"
aspnet_wp!library!17fc!02/10/2005-14:45:07:: v VERBOSE: Call to
ListProviders: type (Data).
aspnet_wp!library!17fc!02/10/2005-14:45:07:: v VERBOSE: Call to
ListProviders completed.
aspnet_wp!runningrequests!17fc!02/10/2005-14:45:07:: v VERBOSE: User
map'<Users><User><Name>Person
1</Name><Paths><Path>http://mymachine/ReportServer/reportservice.asmx</Path><NrReq>1</NrReq></Paths></User></Users>'
aspnet_wp!runningrequests!17fc!02/10/2005-14:45:07:: v VERBOSE:
SoapAction:
"http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices/PrepareQuery"
aspnet_wp!library!17fc!02/10/2005-14:45:07:: v VERBOSE: Call to
PrepareQuery: dataSource
(<DataSource><DataSourceDefinition><Extension>My
DataSet</Extension><ConnectString>asdf</ConnectString><CredentialRetrieval>Store</CredentialRetrieval><WindowsCredentials>False</WindowsCredentials><ImpersonateUser>False</ImpersonateUser><UserName>user</UserName><Password>test</Password></DataSourceDefinition></DataSource>),
dataSet(<DataSet><Query><CommandType>Text</CommandType><CommandText>asdfasdf</CommandText></Query></DataSet>).
aspnet_wp!crypto!17fc!02/10/2005-14:45:07:: v VERBOSE: Starting crypto
operation DBProtectString
aspnet_wp!crypto!17fc!02/10/2005-14:45:07:: v VERBOSE: Completed crypto
operation DBProtectString
aspnet_wp!crypto!17fc!02/10/2005-14:45:07:: v VERBOSE: Starting crypto
operation DBProtectString
aspnet_wp!crypto!17fc!02/10/2005-14:45:07:: v VERBOSE: Completed crypto
operation DBProtectString
aspnet_wp!crypto!17fc!02/10/2005-14:45:07:: v VERBOSE: Starting crypto
operation DBProtectString
aspnet_wp!crypto!17fc!02/10/2005-14:45:07:: v VERBOSE: Completed crypto
operation DBProtectString
aspnet_wp!crypto!17fc!02/10/2005-14:45:07:: v VERBOSE: Starting crypto
operation DBUnProtectString
aspnet_wp!crypto!17fc!02/10/2005-14:45:07:: v VERBOSE: Completed crypto
operation DBUnProtectString
aspnet_wp!crypto!17fc!02/10/2005-14:45:07:: v VERBOSE: Starting crypto
operation DBUnProtectString
aspnet_wp!crypto!17fc!02/10/2005-14:45:07:: v VERBOSE: Completed crypto
operation DBUnProtectString
aspnet_wp!crypto!17fc!02/10/2005-14:45:07:: v VERBOSE: Starting crypto
operation DBUnProtectString
aspnet_wp!crypto!17fc!02/10/2005-14:45:07:: v VERBOSE: Completed crypto
operation DBUnProtectString
aspnet_wp!processing!17fc!02/10/2005-14:45:07:: v VERBOSE: A connection
object for the My DataSet data source has been created.
aspnet_wp!crypto!17fc!02/10/2005-14:45:07:: v VERBOSE: Starting crypto
operation DBUnProtectString
aspnet_wp!crypto!17fc!02/10/2005-14:45:07:: v VERBOSE: Completed crypto
operation DBUnProtectString
aspnet_wp!library!17fc!02/10/2005-14:45:07:: e ERROR: Throwing
Microsoft.ReportingServices.Diagnostics.Utilities.CannotPrepareQueryException:
The dataset cannot be generated. An error occurred while connecting to
a data source, or the query is not valid for the data source., ;
Info:
Microsoft.ReportingServices.Diagnostics.Utilities.CannotPrepareQueryException:
The dataset cannot be generated. An error occurred while connecting to
a data source, or the query is not valid for the data source. -->
System.NullReferenceException: Object reference not set to an instance
of an object.
at
Microsoft.ReportingServices.Library.SubscriptionManager.PrepareQuery(DataSource
dataSource, DataSetDefinition dataSet, Boolean& changed)
-- End of inner exception stack trace --
aspnet_wp!runningrequests!17fc!02/10/2005-14:45:07:: v VERBOSE: User
map'<Users><User><Name>Person
1</Name><Paths><Path>http://mymachine/ReportServer/reportservice.asmx</Path><NrReq>1</NrReq></Paths></User></Users>'
aspnet_wp!runningrequests!17fc!02/10/2005-14:45:07:: v VERBOSE:
SoapAction:
"http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices/GetSystemProperties"
aspnet_wp!library!17fc!02/10/2005-14:45:07:: v VERBOSE: Call to
GetSystemProperties()
aspnet_wp!library!17fc!02/10/2005-14:45:07:: v VERBOSE: Call to
GetSystemProperties completed.
No changes are made to the ReportServerService or ReportServerWebApp
logs. No other errors are listed in any of these logs.
For reference, here is my connection class:
using System;
using System.Data;
using System.Configuration;
using System.Xml;
using Microsoft.ReportingServices.DataProcessing;
namespace My.Samples.DataSetProcessingExtension
{
public class DSXConnection
: Microsoft.ReportingServices.DataProcessing.IDbConnection
{
private string _connString;
private int _connTimeout = 15;
private ConnectionState _state = ConnectionState.Closed;
public DSXConnection() {}
public DSXConnection(string connString) { _connString = connString; }
public string ConnectionString { get { return _connString; } set {
_connString = value; } }
public int ConnectionTimeout { get { return _connTimeout; } }
public ConnectionState State { get { return _state; } }
public Microsoft.ReportingServices.DataProcessing.IDbTransaction
BeginTransaction()
{
return null;
}
public void Open()
{
_state = ConnectionState.Open;
}
public void Close()
{
this.Dispose();
_state = ConnectionState.Closed;
}
// Implemented.
public Microsoft.ReportingServices.DataProcessing.IDbCommand
CreateCommand()
{
return new DSXCommand(this);
}
public string LocalizedName
{
get { return "DataSet Data Processing Extension"; }
}
public void SetConfiguration(string configuration) {}
public void Dispose() {}
}
}
I also have forms authentication and a custom security extension set
up, which works fine as far as I can tell. I don't know if that would
have any bearing on this issue, but I thought I'd mention it anyways.
Hope that helps. If you need more information feel free to post here or
e-mail me.

No comments:

Post a Comment