Identifying the field causing the error in Crystal Reports - c#

When I try to export to disk a crystal report from within asp.net code, crystal report throw an exception. Exception just says "Invalid object format", which means clearly some field in report is failing data type conversion. Now, I can try and resolve the problem, if I know the field name.
Sadly, crystal report is stupid, and never adds the exact field name in exception message. So, I am unable to find which field is causing the problem. Unless I can find that field, there is no way for me to resolve the issue. So, all I want is a way to identify that field.
P.S. This issue happened when we moved all of our reports to latest version of Crystal Reports, and happens only with couple reports, out of the hundreds we have.
Edit:
Stack trace of the error I am receiving
CrystalDecisions.CrystalReports.Engine.InternalException was unhandled by user code
HResult=-2147221760
Message=
Error in File RepairTag {40C68F49-F0B7-46D6-9E89-6E105808B13B}.rpt:
Invalid object format name.
Source=CrystalDecisions.ReportAppServer.DataSetConversion
StackTrace:
at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToDisk(ExportFormatType formatType, String fileName)
at FANUC.CSMS.Common.BusinessTier.ReportBC.GenerateReportAndExportToDisk(String strExportFormat, String strMapPath) in d:\FANUC\CSMS\BusinessTier\Common\ReportBC.cs:line 227
at FANUC.CSMS.Common.BusinessTier.ReportBC.GenerateReportWithSelection(String strReportID, String strClause, String strExportFormat, Row objLocalizedNames, String strSortFields, Hashtable htblLocalizedNamesForSubReport, String strFilterString, Row objParamaterFieldsValues, String strMapPath, String strFontOverwriteReqd, String strGroup) in d:\FANUC\CSMS\BusinessTier\Common\ReportBC.cs:line 180
at FANUC.CSMS.Reports.Web.Reports.Page_Load(Object sender, EventArgs e) in d:\FANUC\CSMS\CSMSWeb\Reports\Reports.aspx.cs:line 98
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException: System.Runtime.InteropServices.COMException
HResult=-2147483077
Message=
Error in File RepairTag {40C68F49-F0B7-46D6-9E89-6E105808B13B}.rpt:
Invalid object format name.
Source=rptcontrollers.dll
ErrorCode=-2147483077
StackTrace:
at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)
at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
InnerException:

Related

Unsupported by Aspose.HTML for .NET symbols in the name of input html file

I am using Aspose.HTML for .NET library and I found out that it doesn’t support ‘#’ character in the name of the input html file when windows handles it OK. Is there any solution of this issue?
Here is sample code:
using (var document = new HTMLDocument(#“D:\work\!%#&$^#.html”))
{
Console.WriteLine(document.BaseURI);
Console.WriteLine(“OK”);
}
Exception I get:
Unhandled Exception: System.Exception: ‘file:///D:/work/!%#&$^#.html’ could not be found. —> Aspose.Html.Dom.DOMException: ‘file:///D:/work/!%#&$^#.html’ could not be found.
at :clubs: .:heart: [T](UInt16 :slight_smile:, String :heart:, String :clubs:, Object[])
at :clubs: .:heart:(String :slight_smile:, Object[] :heart:)
at Aspose.Html.Dom.Document.:heart: .:slight_smile:.:slight_smile:()
at :clubs: .:slight_smile:()
— End of inner exception stack trace —
at .:heart: :slight_smile:(Boolean :slight_smile:)
at :heart: .Dispose()
at Aspose.Html.Dom.Document.:slight_smile:(☼ :slight_smile:)
at Aspose.Html.Dom.Document…ctor(IDocumentInit documentInit)
at Aspose.Html.HTMLDocument…ctor(RequestMessage :slight_smile:, Configuration :heart:, Byte :clubs:)
at Aspose.Html.HTMLDocument…ctor(String address)
at ConsoleApplication1.Program.Main(String[] args) in D:\Labs\PathTest\ConsoleApplication1\Program.cs:line 19
This file definitely exists. I am using Aspose.HTML 20.11.0. Updating to the latest one doesn’t solve this issue

CRM 4.0 Unhandled exception upon trying to export labels for translation

I'm having a strange issue with our Dynamics CRM 4.0 (we use it to develop customizations).
When trying to export labels (Settings -> Customization -> Export Labels for Translation) the system shows this error (Tracing + DevErrors are enabled, all show the same, aswell as the Event Viewer on the server itself):
Error 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.
Error Details:
Exception of type 'System.Web.HttpUnhandledException' was thrown.
Full Stack:
[ArgumentException: An item with the same key has already been added.]
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at Microsoft.Crm.Metadata.LabelCollection.Add(Label label)
at Microsoft.Crm.ObjectModel.OrganizationUIService.GetSectionTabAndFieldLabels(IBusinessEntity entity, ILabelLoader labelLoader, ExecutionContext context, Dictionary`2 labels)
at Microsoft.Crm.ObjectModel.OrganizationUIService.RetrieveAllFormLabelsWithAllLanguages(Int32 objectTypeCode, ExecutionContext context)
at Microsoft.Crm.Metadata.OrganizationUIHelper.RetrieveAllFormLabelsWithAllLanguages(Int32 objectTypeCode, ExecutionContext context)
at Microsoft.Crm.Tools.ImportExportPublish.FormXmlHandler.GetLocalizedLabelStringsCollection(Int32 baseLanguageCode, List`1 provisionedLanguages, Dictionary`2 locLabelCollection)
at Microsoft.Crm.Tools.ImportExportPublish.RootTranslationExportHandler.ExportLocalizedLabelStrings(Int32 baseLanguageCode, List`1 provisionedLanguages)
at Microsoft.Crm.Tools.ImportExportPublish.RootTranslationExportHandler.RunExportTranslations(Int32 baseLanguageCode, List`1 provisionedLanguages)
Apparently, no one in the world has ever had this issue (I've been googling around for 2 days)...
What I've tried:
I checked MetadataSchema.LocalizedLabels for any oddity, I tried joining it to Attribute and Entity to check for duped entries (Exception complains about a duplicate key, so ...), almost made LinqPad explode from the massive amount of queries I tried and ditched...
If it's worth anything, the latest Rollup should be on the server.
A single customized label for a "notes" tab in a custom entity main form was causing the issue. I still have no clue about Why it happened (it's been created via the stock form designer) but now my issue is resolved.
If anyone needs to follow my steps, you want to look this set of data:
USE <Organization_DB>
GO
SELECT * FROM Metadataschema.LocalizedLabel WHERE InProduction=1 AND CustomizationLevel=1
GO

VS 2010 error "Value to add was out of range. Parameter name: value "

I am facing a weird problem. My web application throws error "Value to add was out of range Parameter name :value ". Now this is not every time I run the program.Sometimes shows error and sometimes runs without problems (no changes done).stack traces given below the error is not clear (at least for me). Anybody faced this kind of issue ?
Error Details
Value to add was out of range.
Parameter name: value
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: Value to add was out of range.
Parameter name: value
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: Value to add was out of range.
Parameter name: value]
System.DateTime.Add(Double value, Int32 scale) +9388319
System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed) +8837703
System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories) +125
System.Web.Compilation.BuildManager.CompileCodeDirectories() +319
System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +248
[HttpException (0x80004005): Value to add was out of range.
Parameter name: value]
System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +62
System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +421
System.Web.Compilation.BuildManager.CallAppInitializeMethod() +31
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +605
[HttpException (0x80004005): Value to add was out of range.
Parameter name: value]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9013676
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +258
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
Just guesses: as the exception seems to be thrown from the code that you do not control, it is not your code that causes the error. However, that could be your system settings. For example, for some weird reason System.DateTime.Add(Double value, Int32 scale) is called with such parameters, that, as MSDN states,
The resulting DateTime is less than MinValue or greater than MaxValue.
Is it ever possible that the time on your computer is now set to some incredibly high value? Close to 23:59:59.9999999, December 31, 9999, for instance. Or maybe low value, close to 00:00:00.0000000, January 1, 0001. So the compiler for some reasons picks up the current date and needs to add some time span to it, which causes your error.
Just a wild guess, but maybe...
UPDATE
The code of the System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly method can be found here. In the code there is a line
DateTime waitLimit = DateTime.UtcNow.AddMilliseconds(3000);
That's the only place that could throw such exception (if the version I am looking at is the same as your environment). So it gives more votes for weird time set on your computer.
This can happen if the value you are trying to assign is null. Try coalescing the value
suppose:
int i = value ?? 0; //if value is null, zero is assigned to i
MyClass _class = ValueClass ?? new MyClass(); //same as above, except it instantiates.
DateTime someDate = getChuckNorrisBirthDate() ?? DateTime.Now.Date(); // beware of chuck norris
I have seen this error with DateTime variables.. but it was ages ago. Since you do not provide enough information about the type of variable etc (and the image is too small to make out anything) I am just guessing it on top of my head.
Issue solved. Just changed my regional settings,date/time settings in control panel to some random setting and then reverted them back to original followed by a PC restart and error is gone.Issue might be with the GetCodeDirectoryAssembly code as mentioned by #Michael Sagalovich.Will investigate for more details if the error pops up again :)
Thanks All

problem breaking up one SharePoint project into pieces

I'm trying to break my sharepoint project into a few smaller projects.
I could easily move utility files in different project.
However i encountered a problem when i moved custom-fields.
If i move custom-field from ProjectA to ProjectB and set ProjectA to reference ProjectB's DLL, building and deploying work fine. However, when program reference custom-field from SPListItem, it will throw System.ArgumentOutOfRangeException.
e.g.
SPListItem item = splist.GetItemById(id);<br>
CustomFieldValue custom = item["Custom"] // Error occurs here
Also, if i call AddFieldAsXml to define above custom-field, i get same error.
can anyone help me solve this problem?
thank you in advance...
Detail of Error occured in AddFieldAsXml (same error occurs when referencing)
Length cannot be less than zero.
Parameter name: length
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: Length cannot be less than zero.
Parameter name: length
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: Length cannot be less than zero.
Parameter name: length]
System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) +7494967
System.String.Substring(Int32 startIndex, Int32 length) +11
Microsoft.SharePoint.Publishing.PublishingHttpModule.CreateSPField(String fieldTypeName, SPFieldCollection collection, String fieldName) +80
Microsoft.SharePoint.SPFieldCollection.CreateSPField(Int32 index) +2746
Microsoft.SharePoint.SPFieldCollection.EnsureSPField(Int32 index) +89
Microsoft.SharePoint.SPFieldCollection.get_Item(Int32 iIndex) +113
Microsoft.SharePoint.SPFieldCollection.GetFieldByInternalName(String strName, Boolean bThrowException) +180
Microsoft.SharePoint.SPFieldCollection.GetFieldByInternalName(String strName) +38
Microsoft.SharePoint.SPFieldCollection.AddFieldAsXmlInternal(String schemaXml, Boolean addToDefaultView, SPAddFieldOptions op) +905
Microsoft.SharePoint.SPFieldCollection.AddFieldAsXml(String schemaXml, Boolean addToDefaultView, SPAddFieldOptions op) +45
This error displayed if string.substring(int startIndex, int length)'s length value is minus...
but i don't know why i get this error.
I solved the problem...
I didn't copy the fldtypes_xxxx.xml information.
so when the code try to read some information from the xml, exception is thrown...

IBatis.net converting project from VS2003 to VS2008 crashes on load

The project has been working fine in 2003 but when opening it in 2008 we now get the below error. I've tried ripping all of the code out of the 'Accessory' result map and then it just goes onto the next result map and tells me the same error with that one. Any thoughts?
[ERROR]-- Accessing Accessory Datasource --
Error: Data connection configurations are invalid.
Descriptive: Net.Autodata.Accessories.Exceptions.AccessoryConnectException: Failed loading iBATIS.NET Default SQL MAP ---> IBatisNet.Common.Exceptions.ConfigurationException:
- The error occurred while loading SqlMap.
- initialize ResultMap
- The error occurred in .
- Check the Accessories.Accessory. ---> IBatisNet.Common.Exceptions.ConfigurationException: Could not configure ResultMap named "Accessories.Accessory", Cause: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at IBatisNet.Common.Utilities.Objects.ObjectFactory.CreateFactory(Type typeToCreate, Type[] types)
at IBatisNet.DataMapper.Configuration.ResultMapping.ResultMap.GetChildNode(ConfigurationScope configScope)
at IBatisNet.DataMapper.Configuration.ResultMapping.ResultMap.Initialize(ConfigurationScope configScope)
--- End of inner exception stack trace ---
at IBatisNet.DataMapper.Configuration.ResultMapping.ResultMap.Initialize(ConfigurationScope configScope)
at IBatisNet.DataMapper.Configuration.Serializers.ResultMapDeSerializer.Deserialize(XmlNode node, ConfigurationScope configScope)
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.BuildResultMap()
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureSqlMap()
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Initialize()
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument document, DataSource dataSource, Boolean useConfigFileWatcher, Boolean isCallFromDao)
--- End of inner exception stack trace ---
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument document, DataSource dataSource, Boolean useConfigFileWatcher, Boolean isCallFromDao)
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument document, Boolean useConfigFileWatcher)
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureAndWatch(String resource, ConfigureHandler configureDelegate)
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureAndWatch(ConfigureHandler configureDelegate)
at IBatisNet.DataMapper.Mapper.InitMapper()
at IBatisNet.DataMapper.Mapper.Instance()
at Net.Autodata.Accessories.Processing.Editor.AccessoryEditor..ctor() in C:\Perforce\Clients\GM\Accessories\Editor\main\Editor.Processing\AccessoryEditor.cs:line 94
--- End of inner exception stack trace ---
at Net.Autodata.Accessories.Processing.Editor.AccessoryEditor..ctor() in C:\Perforce\Clients\GM\Accessories\Editor\main\Editor.Processing\AccessoryEditor.cs:line 98
at Net.Autodata.Accessories.Editor.AccessoryEditor.LoadEditor() in C:\Perforce\Clients\GM\Accessories\Editor\main\Editor\AccessoryEditor.cs:line 1028
Project was originally compiled with .Net v1.1 Upgraded IBatis DLL's to 2.0 and now it works fine.

Categories