There is a huge memory leak in Microsofts LocalReport implementation in .Net 4.0
The work around to make it a small memory leak is here,
and in the comments is how to make it go away...
Though I'll warn you it's a pain.
http://stackoverflow.com/questions/6220915/very-high-memory-usage-in-net-4-0
Thursday, November 15, 2012
Wednesday, November 14, 2012
Are you having a memory leak because of Strucutre map?
So here's the situation....
(My parents went away for a weeks vacation...(Soory, can't help myself, child of the 80s...))
Running a winforms app using a Library that has structure map all through it, and it uses ObjectFactory directly instead of IContainer....
So we get memory leaks that we can't get rid of as Structure map is hanging on to instances of the objects so they can't be garbage collected...
Here's the quick hack to fix in,
Since what I'm doing is in a loop, at the bottom of the loop construct I just type:
// strucutre map memory leak hack, works okay i guess, it's slower as expected - EWB
ObjectFactory.ResetDefaults();
and it flushes all the objects out of Structure map...
Of course it's slower because all the objects get re init-ed in each loop, but the memory
got tons better...
Also note that in an upcoming release,
ObjectFactory.ResetDefaults();
will get changed to
ObjectFactory.Reset();
(My parents went away for a weeks vacation...(Soory, can't help myself, child of the 80s...))
Running a winforms app using a Library that has structure map all through it, and it uses ObjectFactory directly instead of IContainer....
So we get memory leaks that we can't get rid of as Structure map is hanging on to instances of the objects so they can't be garbage collected...
Here's the quick hack to fix in,
Since what I'm doing is in a loop, at the bottom of the loop construct I just type:
// strucutre map memory leak hack, works okay i guess, it's slower as expected - EWB
ObjectFactory.ResetDefaults();
and it flushes all the objects out of Structure map...
Of course it's slower because all the objects get re init-ed in each loop, but the memory
got tons better...
Also note that in an upcoming release,
ObjectFactory.ResetDefaults();
will get changed to
ObjectFactory.Reset();
Tuesday, November 13, 2012
The parameter of type 61 did not have a valid value
The parameter of type 61 did not have a valid value
This is an error from the Sybade Database.
It means that a variable of type 61 (Date) does not have a valid value.
This is ususally caused by your Date time not being Nullable in your EO or you CV and because
Microsoft and Sybase have different Epochs, or Minimum Dates values.
Microsofts EPOCH for a DateTime is: 00:00:00.0000000, January 1, 0001
and Sybases depends on the exat type in your DB see the chart here:
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc35400.1550/html/osref/osref281.htm
But in essence here is what happens.
In the DB the Date is null,
In your EO the dateTime is not nullable
Net converts the null to DateTime.Min (01/01/01)
during an update this value is smaller than the allowed (for us ususally 01/01/1900)
Best fix, it to change the Datetimes in your EO & CV toall be nullable, OR to use a CV that does not contain any of the date fields for updating, and let JCDCHelper deal with it..
See here for the codes of all Sybase datatypes : http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.ase_15.0.tables/html/tables/tables69.htm
This is an error from the Sybade Database.
It means that a variable of type 61 (Date) does not have a valid value.
This is ususally caused by your Date time not being Nullable in your EO or you CV and because
Microsoft and Sybase have different Epochs, or Minimum Dates values.
Microsofts EPOCH for a DateTime is: 00:00:00.0000000, January 1, 0001
and Sybases depends on the exat type in your DB see the chart here:
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc35400.1550/html/osref/osref281.htm
But in essence here is what happens.
In the DB the Date is null,
In your EO the dateTime is not nullable
Net converts the null to DateTime.Min (01/01/01)
during an update this value is smaller than the allowed (for us ususally 01/01/1900)
Best fix, it to change the Datetimes in your EO & CV toall be nullable, OR to use a CV that does not contain any of the date fields for updating, and let JCDCHelper deal with it..
See here for the codes of all Sybase datatypes : http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.ase_15.0.tables/html/tables/tables69.htm
Tuesday, October 30, 2012
An error occurred during local report processing. ->An error occurred during local report processing. ->ClassName
So I was Moving an RDLC Report from one applicaiton to another,
I was getting this excpetion..
(summary of the messages of the exception and it's inner exceptions:
An error occurred during local report processing. --->
An error has occurred during report processing. --->
StudTarReportCV
Where StudTarReportCV is the name of the class I'm passign in a list of with the reprot Data.
Not alot to go on, basically it says "Something Bad Happned with the CV class"
The Actual Problem was that the DataSet Name I was Passing it didnt' match the one defined in the RDLC.
RDLC-> StudTarReportCV
PassedToReportViewer->EFolderReportGenerator3G_CV_StudTarReportCV
So how I fixed it was to modify the XML in thie RDLC file so that the dataSet Definition matched the value i was passing in:
<DataSetName>EFolderReportGenerator3G_CV_StudTarReportCV</DataSetName>
and then modified the use of the data set in the Tablix to match there:
<DataSet Name="EFolderReportGenerator3G_CV_StudTarReportCV">
Voilia, it's all working now...Full Text of Exception, incase anyone else runs into it:
Exception in StudentTar Ex = Microsoft.Reporting.WinForms.LocalProcessingException: An error occurred during local report processing. ---> Microsoft.ReportingServices.ReportProcessing.ProcessingAbortedException: An error has occurred during report processing. ---> Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: StudTarReportCV
at Microsoft.ReportingServices.OnDemandProcessing.RuntimeDataSet.RunDataSetQuery()
at Microsoft.ReportingServices.OnDemandProcessing.TablixProcessing.RuntimeOnDemandDataSet.Process()
at Microsoft.ReportingServices.OnDemandProcessing.RuntimeDataSet.ProcessConcurrent(Object threadSet)
--- End of inner exception stack trace ---
at Microsoft.ReportingServices.OnDemandProcessing.OnDemandProcessingContext.AbortHelper.ThrowAbortException(String reportUniqueName)
at Microsoft.ReportingServices.OnDemandProcessing.OnDemandProcessingContext.CheckAndThrowIfAborted()
at Microsoft.ReportingServices.OnDemandProcessing.RetrievalManager.FetchData(Boolean mergeTran)
at Microsoft.ReportingServices.OnDemandProcessing.RetrievalManager.PrefetchData(ReportInstance reportInstance, ParameterInfoCollection parameters, Boolean mergeTran)
at Microsoft.ReportingServices.OnDemandProcessing.Merge.FetchData(ReportInstance reportInstance, Boolean mergeTransaction)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ProcessOdpReport(Report report, OnDemandMetadata odpMetadataFromSnapshot, ProcessingContext pc, Boolean snapshotProcessing, Boolean reprocessSnapshot, Boolean processUserSortFilterEvent, Boolean processWithCachedData, ErrorContext errorContext, DateTime executionTime, IChunkFactory cacheDataChunkFactory, StoreServerParameters storeServerParameters, GlobalIDOwnerCollection globalIDOwnerCollection, SortFilterEventInfoMap oldUserSortInformation, EventInformation newUserSortInformation, String oldUserSortEventSourceUniqueName, ExecutionLogContext executionLogContext, OnDemandProcessingContext& odpContext)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RenderReport(IRenderingExtension newRenderer, DateTime executionTimeStamp, ProcessingContext pc, RenderingContext rc, IChunkFactory cacheDataChunkFactory, IChunkFactory yukonCompiledDefinition, Boolean& dataCached)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RenderReport(IRenderingExtension newRenderer, DateTime executionTimeStamp, ProcessingContext pc, RenderingContext rc, IChunkFactory yukonCompiledDefinition)
at Microsoft.Reporting.LocalService.CreateSnapshotAndRender(CatalogItemContextBase itemContext, ReportProcessing repProc, IRenderingExtension renderer, ProcessingContext pc, RenderingContext rc, SubreportCallbackHandler subreportHandler, ParameterInfoCollection parameters, DatasourceCredentialsCollection credentials)
at Microsoft.Reporting.LocalService.Render(CatalogItemContextBase itemContext, Boolean allowInternalRenderers, ParameterInfoCollection reportParameters, IEnumerable dataSources, DatasourceCredentialsCollection credentials, CreateAndRegisterStream createStreamCallback, ReportRuntimeSetup runtimeSetup)
at Microsoft.Reporting.WinForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, CreateAndRegisterStream createStreamCallback, Warning[]& warnings)
--- End of inner exception stack trace ---
at Microsoft.Reporting.WinForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, CreateAndRegisterStream createStreamCallback, Warning[]& warnings)
at Microsoft.Reporting.WinForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
at Microsoft.Reporting.WinForms.LocalReport.Render(String format, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
at Microsoft.Reporting.WinForms.Report.Render(String format, String deviceInfo, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
at EFolderReportGenerator3G.Reporting.WinForms.ReportGenerator.GetReportResult(ReportRenderParameters reportRenderParameters) in D:\Project Files\EFolderReportGenerator3G\WinForm\EFolderReportGenerator3G.Reporting\Web\ReportGenerator.cs:line 206
at EFolderReportGenerator3G.Reporting.WinForms.ReportGenerator.GetReportResult[T](String reportType, String dataSourceName, List`1 data, String reportFileName, List`1 reportParameters) in D:\Project Files\EFolderReportGenerator3G\WinForm\EFolderReportGenerator3G.Reporting\Web\ReportGenerator.cs:line 74
at EFolderReportGenerator3G.BLL.BusinessObjects.ETarBLL.GetStudTarReportNew(StudTarReportArgumentCV criteria) in D:\Project Files\EFolderReportGenerator3G\WinForm\EFolderReportGenerator3G.BLL\BusinessObjects\ETarBLL.cs:line 1398
at EFolderReportGenerator3G.BLL.BusinessObjects.ETarBLL.SaveStudTarReportNew(String& fnameExt, String& mineType, String rollingOrPy, EFolderReportArgCV args, StudentCV studentCv) in D:\Project Files\EFolderReportGenerator3G\WinForm\EFolderReportGenerator3G.BLL\BusinessObjects\ETarBLL.cs:line 1460
I was getting this excpetion..
(summary of the messages of the exception and it's inner exceptions:
An error occurred during local report processing. --->
An error has occurred during report processing. --->
StudTarReportCV
Where StudTarReportCV is the name of the class I'm passign in a list of with the reprot Data.
Not alot to go on, basically it says "Something Bad Happned with the CV class"
The Actual Problem was that the DataSet Name I was Passing it didnt' match the one defined in the RDLC.
RDLC-> StudTarReportCV
PassedToReportViewer->EFolderReportGenerator3G_CV_StudTarReportCV
So how I fixed it was to modify the XML in thie RDLC file so that the dataSet Definition matched the value i was passing in:
<DataSetName>EFolderReportGenerator3G_CV_StudTarReportCV</DataSetName>
and then modified the use of the data set in the Tablix to match there:
<DataSet Name="EFolderReportGenerator3G_CV_StudTarReportCV">
Voilia, it's all working now...Full Text of Exception, incase anyone else runs into it:
Exception in StudentTar Ex = Microsoft.Reporting.WinForms.LocalProcessingException: An error occurred during local report processing. ---> Microsoft.ReportingServices.ReportProcessing.ProcessingAbortedException: An error has occurred during report processing. ---> Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: StudTarReportCV
at Microsoft.ReportingServices.OnDemandProcessing.RuntimeDataSet.RunDataSetQuery()
at Microsoft.ReportingServices.OnDemandProcessing.TablixProcessing.RuntimeOnDemandDataSet.Process()
at Microsoft.ReportingServices.OnDemandProcessing.RuntimeDataSet.ProcessConcurrent(Object threadSet)
--- End of inner exception stack trace ---
at Microsoft.ReportingServices.OnDemandProcessing.OnDemandProcessingContext.AbortHelper.ThrowAbortException(String reportUniqueName)
at Microsoft.ReportingServices.OnDemandProcessing.OnDemandProcessingContext.CheckAndThrowIfAborted()
at Microsoft.ReportingServices.OnDemandProcessing.RetrievalManager.FetchData(Boolean mergeTran)
at Microsoft.ReportingServices.OnDemandProcessing.RetrievalManager.PrefetchData(ReportInstance reportInstance, ParameterInfoCollection parameters, Boolean mergeTran)
at Microsoft.ReportingServices.OnDemandProcessing.Merge.FetchData(ReportInstance reportInstance, Boolean mergeTransaction)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ProcessOdpReport(Report report, OnDemandMetadata odpMetadataFromSnapshot, ProcessingContext pc, Boolean snapshotProcessing, Boolean reprocessSnapshot, Boolean processUserSortFilterEvent, Boolean processWithCachedData, ErrorContext errorContext, DateTime executionTime, IChunkFactory cacheDataChunkFactory, StoreServerParameters storeServerParameters, GlobalIDOwnerCollection globalIDOwnerCollection, SortFilterEventInfoMap oldUserSortInformation, EventInformation newUserSortInformation, String oldUserSortEventSourceUniqueName, ExecutionLogContext executionLogContext, OnDemandProcessingContext& odpContext)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RenderReport(IRenderingExtension newRenderer, DateTime executionTimeStamp, ProcessingContext pc, RenderingContext rc, IChunkFactory cacheDataChunkFactory, IChunkFactory yukonCompiledDefinition, Boolean& dataCached)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RenderReport(IRenderingExtension newRenderer, DateTime executionTimeStamp, ProcessingContext pc, RenderingContext rc, IChunkFactory yukonCompiledDefinition)
at Microsoft.Reporting.LocalService.CreateSnapshotAndRender(CatalogItemContextBase itemContext, ReportProcessing repProc, IRenderingExtension renderer, ProcessingContext pc, RenderingContext rc, SubreportCallbackHandler subreportHandler, ParameterInfoCollection parameters, DatasourceCredentialsCollection credentials)
at Microsoft.Reporting.LocalService.Render(CatalogItemContextBase itemContext, Boolean allowInternalRenderers, ParameterInfoCollection reportParameters, IEnumerable dataSources, DatasourceCredentialsCollection credentials, CreateAndRegisterStream createStreamCallback, ReportRuntimeSetup runtimeSetup)
at Microsoft.Reporting.WinForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, CreateAndRegisterStream createStreamCallback, Warning[]& warnings)
--- End of inner exception stack trace ---
at Microsoft.Reporting.WinForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, CreateAndRegisterStream createStreamCallback, Warning[]& warnings)
at Microsoft.Reporting.WinForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
at Microsoft.Reporting.WinForms.LocalReport.Render(String format, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
at Microsoft.Reporting.WinForms.Report.Render(String format, String deviceInfo, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
at EFolderReportGenerator3G.Reporting.WinForms.ReportGenerator.GetReportResult(ReportRenderParameters reportRenderParameters) in D:\Project Files\EFolderReportGenerator3G\WinForm\EFolderReportGenerator3G.Reporting\Web\ReportGenerator.cs:line 206
at EFolderReportGenerator3G.Reporting.WinForms.ReportGenerator.GetReportResult[T](String reportType, String dataSourceName, List`1 data, String reportFileName, List`1 reportParameters) in D:\Project Files\EFolderReportGenerator3G\WinForm\EFolderReportGenerator3G.Reporting\Web\ReportGenerator.cs:line 74
at EFolderReportGenerator3G.BLL.BusinessObjects.ETarBLL.GetStudTarReportNew(StudTarReportArgumentCV criteria) in D:\Project Files\EFolderReportGenerator3G\WinForm\EFolderReportGenerator3G.BLL\BusinessObjects\ETarBLL.cs:line 1398
at EFolderReportGenerator3G.BLL.BusinessObjects.ETarBLL.SaveStudTarReportNew(String& fnameExt, String& mineType, String rollingOrPy, EFolderReportArgCV args, StudentCV studentCv) in D:\Project Files\EFolderReportGenerator3G\WinForm\EFolderReportGenerator3G.BLL\BusinessObjects\ETarBLL.cs:line 1460
Thursday, October 18, 2012
JCDCHelper code to return one column of one row cleanly
lots of us when returning one column, return an object and then have to cast that to a <T>
This fixes that to work more cleanly.
public T JcdcAdoGetOneColumn<T>(string mainSql){
object answer;
using (IAdoHelper ado = ObjectFactory.GetNamedInstance<IAdoHelper>("JCDC")) {
answer = ado.GetOneColumn<T>(mainSql, null); }
return ConvertObjectToT<T>( answer );}
private T ConvertObjectToT<T>( object answer )
{
// handle the cast for both primitive and non primitive types - EWB if ( answer is T ) {
return ( T ) answer; }
else {
try {
return ( T ) Convert.ChangeType( answer, typeof ( T ) ); }
catch ( InvalidCastException ) {
return default( T ); }
}
This fixes that to work more cleanly.
public T JcdcAdoGetOneColumn<T>(string mainSql){
object answer;
using (IAdoHelper ado = ObjectFactory.GetNamedInstance<IAdoHelper>("JCDC")) {
answer = ado.GetOneColumn<T>(mainSql, null); }
return ConvertObjectToT<T>( answer );}
private T ConvertObjectToT<T>( object answer )
{
// handle the cast for both primitive and non primitive types - EWB if ( answer is T ) {
return ( T ) answer; }
else {
try {
return ( T ) Convert.ChangeType( answer, typeof ( T ) ); }
catch ( InvalidCastException ) {
return default( T ); }
}
Thursday, August 30, 2012
How to get Vs2010 RDLC tablix to repeat group headers on each page
Go here do this:
http://www.codeease.com/how-to-repeat-table-header-on-every-page-in-rdlc-report.html
Incase it disappears here is the text of the workaround:
http://www.codeease.com/how-to-repeat-table-header-on-every-page-in-rdlc-report.html
Incase it disappears here is the text of the workaround:
- Go to your Visual Studio RDLC design screen, please look at the right bottom corner in design part. There is a small black rectangle there. Click it and check what you can see:
- Yes, you can see “Advanced Mode”, please check on it.
- After you check on Advanced Mode, you will see Row Groups and Column Groups like below:
- Click “Static” in Row Groups list, and check the properties on the right side:
- Set “RepeatOnNewPage” to “True”.
Cascading Dropdowns in JcdcHelper
(Post by Lloyd Bates)
In this example, the parent Drop list is named "SepTypeCd" and the child is "SepReason".
When an item is selected in the parent the change event looks to see if a child list is required to be available, if a child menu is needed, it populates it, if not it disables the child dropdown control.
With this pattern, we get to use the Ajax Wrapper function to allow getting all the error handling built in as a bonus.
This example has the "if" statement in it, but it doesn’t have to have it.
$(document).ready(function () {
… …
$(
"#SepTypeCd").change(SepTypeCdChange);
… …
});
{
JcdcAjaxDoGetRetrieveJson(actionMethodUrl, GetDDLDataSuccess, {
"Id" : sepTypeCd } );
}
$(
"#SepReasonCd").empty().end();
$(
"#SepReasonCd").attr("disabled", "disabled");
}
}
LoadOptions(jsonDDLDispValueCV,
"SepReasonCd");
}
$.each(jsonDDLDispValueCV,
function(index, option) {
reasons.append($(
'<option/>', { value: option.Value, text: option.Disp } ));
});
reasons.removeAttr(
"disabled").end();
}
Subscribe to:
Posts (Atom)