Mono(Touch): System.Xml.Schema.Extensions - mono

I tried validating an XML file via the XDocument.Validate method defined in System.Xml.Schema.Extensions. However the compiler says that XDocument “does not contain a definition for ‘Validate’ and no extension method ‘Validate’ of type ‘System.Xml.Linq.XDocument’ could be found”.
Is the System.Xml.Schema.Extensions class really missing from MonoTouch? And if so, is there any other way to validate an XML read into a XDocument?
edit:
The class in question seems to be missing from Mono as well, according to their documentation. Is there any replacement?

MonoTouch is based on the Silverlight profile. Neither Silverlight nor WinPhone7 include System.Xml.Schema.Extensions.
Fortunately, Mono is open source, so you can take the code you need and add it to your project:
https://github.com/mono/mono/blob/master/mcs/class/System.Xml.Linq/System.Xml.Schema/Extensions.cs

Extensions appears to be new in 3.5 - MonoTouch is core 2.0, with bits of later versions (ie, LINQ) included.

Related

How to correctly reference IHeaderDictionary?

I want to use interface IHeaderDictionary (or the class HeaderDictionary) in a class library. It is an interface defined in ASP.NET Core which represents a collection of http request or response headers. We have some classes working with it in a separate git repository and we want to define a contract separately in a yet another separate git repository. So I have a tiny C# project and there is only a contract in it, nothing else.
The question is this: Which nuget should I reference to be able to use IHeaderDictinary in my contract?
MSDN says it is defined in nuget Microsoft.AspNetCore.App.Ref. And it is really there, but it is forbidden to reference that nuget. (It has package type DotnetPlatform which effectively prevents it to be included in regular class libraries, as mentioned in other discussions.) But which nuget should I reference if not that one? I tried to reference Microsoft.AspNetCore.App, but it is a framework one, so it cannot be referenced too. Then we found that in an older application we used this interface from nuget called Microsoft.AspNetCore.Http.Features. And it works, I can still use this one but when I look to nuget gallery, I can see it is an abandoned nuget, the latest version is 6.0.0-preview, so apparently this is not the correct way how Microsoft intended us to use IHeaderDictionary.
So what am I missing here? Typically, authors of nugets provide something like "contract" or "abstractions" nugets which are tiny and can be included in other contracts. Please help me to understand what is the problem with ASP.NET and how to use it in contracts.

ExcelRichTextHtmlUtility is missing from nuget package

ExcelRichTextHtmlUtility does not appear in the EPPlus 4.5.1 library (or 4.1 for that matter). I see it's in the code in source control but doesn't get shipped I guess. Is there a particular reason or maybe I'm doing something wrong.
It's in the source code but not compiled as part of the project anymore. When I include ExcelRichTextHtmlUtility.cs, the following line does not compile:
s = System.Web.HttpUtility.HtmlDecode(s);
In taking a look at the project settings, EPPlus targets the .NET 3.5 Client Profile framework. The Client Profile is a subset of the framework which for example does not include System.Web, so HttpUtility cannot be used so they must have just simply excluded the class.
I couldn't find any reference to exactly when and why this was changed so this probably does not completely answer your question.

Where is the source code of Mono?

For example, I want to find the source code of IEnumerable, but it is not in
https://github.com/mono/mono/tree/master/mcs/class/System/System.Collections.Generic
So where is it?
I went to the GitHub repository and pressed T to activate the file finder and then typed in IEnumerable and one of the search results was:
https://github.com/mono/mono/blob/master/mcs/class/corlib/System.Collections.Generic/IEnumerable.cs
#MattWard already pointed out the key.
I just want to inform you that not all System.* classes are in System.dll, even for Microsoft .NET. If you go to MSDN you can see clearly that IEnumerable is defined in mscorlib.dll, which maps to "corlib" in Mono.
This tip applies to other classes as well.

WSDL Importer not generating list correctly

I have this service: https://mnavwcfservices.stcenergy.com/FlexProcurementService.svc?singleWsdl
I am trying to use this inside Delphi XE5
I have used the WSDL Importer
The generated file is here https://www.stcenergy-online.com/dev/service.txt
Although the top level classes have been generated correctly, the lists are using list of AnyType
How do I get the correct classes to be generated?
One example is ClipMonthSummaryLine - this is in the wsdl file but does not make it into the generated file by the WSDL importer which I think is why the ArrayOfType has come in
This appears to have been caused by the use of interfaces in the C# classes
This is an absolute nightmare for me now as I never have lists of concrete classes but I think I can get round this by creating new classes that use concrete lists and mapping the data
Sir Rufo's response suggested using the Web Services Toolkit as opposed to the default WDSL importer that comes with Delphi. Although this looks very good it has proved to be a total nightmare to use to the point I may have to raise a new question about it. My new problem https://stackoverflow.com/questions/25961758/list-not-loaded-correctly-from-soap-message-wcf may have been caused by the default importer as well, but getting the files generated by the toolkit to work in Delphi is a nightmare and the documentation is not as good as it first appears.

Displaying Version Information in a Web Service

Can anyone suggest a way of getting version information into a Web Service? (VB.NET)
I would like to dynamically use the assembly version in the title or description, but the attributes require constants.
Is manually writing the version info as a string the only way of displaying the information on the .asmx page?
Yeah, attributes cannot have anything but constants in them, so you cannot use reflection to get the version number. The WebServiceAttribute class is sealed too, so you cannot inherit it and do what you want from there.
A solution might be to use some kind of placeholder text as the Name, and set up an MsBuild task to replace it with the version number when building the project.
You need to pick a type in your assembly and then do the following:
typeof(Some.Object.In.My.Assembly).Assembly.GetName().Version;
via reflection you can get the Assembly object which contains the assembly version.