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
I'm getting this exception when trying to read from the Windows Log using C#'s method EventRecord.FormatDescription():
System.Diagnostics.Eventing.Reader.EventLogException: The description string for parameter reference (%1) could not be found
at System.Diagnostics.Eventing.Reader.EventLogException.Throw(Int32 errorCode)
at System.Diagnostics.Eventing.Reader.NativeWrapper.EvtFormatMessageRenderName(EventLogHandle pmHandle, EventLogHandle eventHandle, EvtFormatMessageFlags flag)
at System.Diagnostics.Eventing.Reader.ProviderMetadataCachedInformation.GetFormatDescription(String ProviderName, EventLogHandle eventHandle)
The exception happens when the text of the event contains the string %% followed by a long number (some events from a source I don't control contain that pattern). Those %% are intended to be just text, I don't expect any parsing intelligence from Windows at that point.
Do you know what I can do to avoid .Net from throwing this error when the text of an event contains that pattern?
Here are the PowerShell commands that will cause the exception next time you try to read the event from a C# program:
New-EventLog -LogName Application -Source MyApp
Write-EventLog -Source MyApp -LogName Application -Message "%%4294967295" -EventId 3
The workaround I ended up implementing is as follows:
private string FormatEventDescription(EventRecord eventRecord)
{
try
{
return eventRecord.FormatDescription();
}
catch (EventLogException e)
{
return eventRecord.ToXml();
}
}
This is less than satisfactory, as that XML is not user-friendly, but at least it has all the information needed in case we need to know the original content of the EventRecord. Note the XML doesn't necessarily contain the description string inside, sometimes these events have a list of parameters which are used to fill a message template to generate the description string, so in this case you'll get the raw params.
I'm trying to build a simple custom SSIS component which looks at a single input column and validates it, creating an output column of type bool depending on the value of each row.
I've successfully built an even simpler component that takes a value and transforms it: that doesn't require fiddling with the output columns. In this instance I need to take in a string and output a boolean and the component needs to know that it outputs a boolean so I can feed the value into a conditional split.
I'm struggling to add the output columns. Based on code samples from Microsoft, I have done this:
public override DTSValidationStatus Validate()
{
IDTSOutput100 output = ComponentMetaData.OutputCollection[0];
IDTSOutputColumn100 outputcol = output.OutputColumnCollection.New();
outputcol.Name = "IsValid";
outputcol.SetDataTypeProperties(DataType.DT_BOOL, 0, 0, 0, 0);
return DTSValidationStatus.VS_ISVALID;
}
And then I attempt to populate it during the ProcessInput step:
public override void ProcessInput(int inputID, PipelineBuffer buffer)
{
while (buffer.NextRow())
{
string str = buffer.GetString(0);
buffer.SetBoolean(0, IsValid(str)); // validation code not relevant
}
}
When I try to use this component in the package, I get this error:
The component has detected potential metadata corruption during validation.
Error at Data Flow Task [Uppercase [24]]: System.MissingMethodException: Method not found: 'Void Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSOutputColumn100.SetDataTypeProperties(Microsoft.SqlServer.Dts.Runtime.Wrapper.DataType, Int32, Int32, Int32, Int32)'.
at EmailValidation.Uppercase.Validate()
at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostValidate(IDTSManagedComponentWrapper100 wrapper)
Searching on this error message has yielded nothing of value.
In the original sample - and some other tutorials online - adding output columns is done by looping through the input column and adding an additional output for each. I have tried this and get the same error.
I have also tried moving the output column code from Validate to OnInputPathAttached which still yields the same error.
What am I doing wrong?
On investigation this appears to be a bug in SQL Server Data Tools for Visual Studio 2015. I have built, deployed and used a custom component with customised output columns in an Integration Services package in Visual Studio 2013. However, the same tool deployed in a package in 2015 causes the error described.
In case it's still relevant, I encountered a similar issue (With the ComponentMetaData property rather than SetDataTypeProperties), and the solution that worked for me was setting the Embed Interop Types property of the Microsoft.SqlServer.DTSPipelineWrap and Microsoft.SQLServer.DTSRuntimeWrap references to false.
I found this solution here. It's listed as a solution for getting an InvalidCastException, but it seems relevant for whenever you're referencing the DTSPipelineWrap or the DTSRuntimeWrap assemblies in custom components.
I am writing a program which takes an ethereum contract ABI string in C# and uses it to call a function which allows me to interact with the smart contract using nethereum. When I use a smaller ABI string I am able to make it work but for some reason it won't work with this longer string or any other ABI which exceeds the length of a small example ABI. When I compile the code below I get the error message (bare in mind that I have tried JSON deserializing but that still makes the same error):
An exception of type 'Newtonsoft.Json.JsonReaderException' occurred in Newtonsoft.Json.dll but was not handled in user code
Additional information: After parsing a value an unexpected character was encountered: t. Path '[0].outputs[0].name', line 3, position 20.
protected void init()
{
web3 = new Nethereum.Web3.Web3();
string abi = #"[{'constant':false,'inputs':[{'name':'username','type':'string'},
{'name':'location','type':'string'}],'name':'addUser','outputs':
[{'name':','type':'string'}],'type':'function'},{'constant':false,'inputs'
:[],'name':'burnCoins','outputs':[{'name':','type':'uint256'}],'type':'function'},
{'constant':false,'inputs':[{'name':'vendor','type':'address'},
{'name':'recipient','type':'address'}],'name':'trade','outputs':[],
'type':'function'},{'constant':false,'inputs':[{'name':'vendor','type':'address'},
{'name':'isPositive','type':'bool'},{'name':'message','type':'string'}],
'name':'giveReputation','outputs':[],'type':'function'},{'constant':false,'inputs':
[{'name':'user','type':'address'}],'name':'showBurnedCoins','outputs':[{'name':
','type':'uint256'}],'type':'function'},{'constant':false,'inputs':[{'name':'user',
'type':'address'}],'name':'viewReputation','outputs':[{'name':','type':'uint256'},
{'name':','type':'uint256'},{'name':','type':'uint256'}],'type':'function'},
{'anonymous':false,'inputs':[{'indexed':true,'name':'user','type':'address'},
{'indexed':true,'name':'amountBurned','type':'uint256'}],'name':'_coinsBurned',
'type':'event'},{'anonymous':false,'inputs':[{'indexed':true,'name':'user',
'type':'address'},{'indexed':true,'name':'message','type':'string'}],'
name':'_positiveReputation','type':'event'},{'anonymous':false,'inputs'
:[{'indexed':true,'name':'user','type':'address'},{'indexed':true,'name':'message'
,'type':'string'}],'name':'_negativeReputation','type':'event'},
{'anonymous':false,'inputs':[{'indexed':true,'name':'username','type':'string'},
{'indexed':true,'name':'location','type':'string'},{'indexed':true,'name':
'user','type':'address'}],'name':'_addUser','type':'event'},{'anonymous':false,
'inputs':[{'indexed':true,'name':'vendor','type':'address'},{'indexed':true,
'name':'buyer','type':'address'}],'name':'_newTrade','type':'event'},{'anonymous':
false,'inputs':[{'indexed':true,'name':'user','type':'address'},{'indexed':true,
'name':'positive','type':'uint256'},{'indexed':true,'name':'negative','type':'uint256'},
{'indexed':false,'name':'total','type':'uint256'}],'name':'_viewedReputation',
'type':'event'}]";
string contractAddress = "0xd53c3dc2f3fcf1779b68ea8e441d857b4af5a413";
Reputation = web3.Eth.GetContract(abi, contractAddress);
}
From my comment:
The error is because of the line 'name':'showBurnedCouns', 'outputs':[{'name':','type':'uint256'}]. A ' is missing inside the outputs block.
See diiN_ comment on my question as this answers the question. Silly me!
I have CruiseControl(1.5) running in Win2k8R2 and svn(1.6.9) The error happens on a successful build after nant(0.86) Timeout(600 seconds). When I check the build dir everything is built correctly but CruiseControl Dashboard report Exception
Here is the error shown in console:
[:DEBUG] Exception: System.Xml.XmlException: The ',' character, hexadecimal value 0x2C, cannot be included in a name. Line 5544, position 274.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlWriter.WriteNode(XmlReader reader, Boolean defattr)
at ThoughtWorks.CruiseControl.Core.Util.XmlFragmentWriter.WriteNode(XmlReader reader, Boolean defattr)
at ThoughtWorks.CruiseControl.Core.Util.XmlFragmentWriter.WriteNode(String xml)
Generaly, this error happens when ccnet is trying to merge Nant ouput with non-xml info into the build report.
Verify the Nant ouput.
Maybe something similar here:
CruiseControl.Net complaining about xml