How to mark obsolete classes/methods in the output with sandcastle - c#

I'm building an API documentation with Sandcastle. The code has multiple classes and methods which are marked deprecated. Now I want that in the API-documentation output these methods are clearly marked (crossed-out or other marker). However the Sandcastle output doesn't mark obsolete methods/classes at all.
My question is. What do I need to do to have the obsolete methods/classes marked by Sandcastle.
Thanks for any advice/help.

Well I found the issue. The issue is a mix of the API and Attribute filters I had in place.
So I added the System-namespace to my API filters, so that it includes the Obsolete-Attribute:
<apiFilter>
<namespace name="System" expose="true">
<type name="ObsoleteAttribute" expose="true" />
<type name="SerializableAttribute" expose="false" />
</namespace>
<!-- rest of the stuff -->
</apiFilter>
And added it also to the list of Attribute-Filters:
<attributeFilter expose="true">
<namespace name="System" expose="false">
<type name="ObsoleteAttribute" expose="true" />
</namespace>
<!-- rest of the stuff -->
</attributeFilter>
I had the 'ObsoleteAttribute' in my attribute-filter, but not in the API-filter.
This thread was also helpful: http://docproject.codeplex.com/discussions/74716?ProjectName=docproject

Related

What level of complexity can a custom ConfigSection XML contain while using built-in Section Handler classes?

This example on MSDN shows how to implement a simple dictionary inside a custom App.config section:
https://msdn.microsoft.com/en-us/library/aa719887(v=vs.71).aspx
The XML looks like this, and it employs SingleTagSectionHandler:
<sampleSection setting1="Value1" setting2="value two"
setting3="third value" />
Is this the most complicated my custom XML section can be before I have to write my own config section class? Because I wish to have a section which is slightly more complex e.g:
<mySection>
<mappings>
<mapping name="A" val1="12" val2="32"/>
<mapping name="B" val1="2" val2="2"/>
</mappings>
<add name="URL" value="http://..."/>
</mySection>
Or something along those lines at least, the exact structure isn't rigid.
How far can I push the built-in section handlers? I couldn't see a good tutorial on what is actually provided in system.configuration.

How to create the shims for the sealed classes, and where can I find the `fakes`-format description?

I need to generate the shims through Microsoft Fakes Platform for three sealed classes of external managed assembly. I wrote this:
<Fakes xmlns="http://schemas.microsoft.com/fakes/2011/">
<Assembly Name="acmgd" Version="17.2.0.0"/>
<StubGeneration>
<Clear/>
</StubGeneration>
<ShimGeneration>
<Clear />
<Add FullName=
"Autodesk.AutoCAD.ApplicationServices.Application"/>
<Add FullName=
"Autodesk.AutoCAD.ApplicationServices.DocumentCollection"/>
<Add FullName=
"Autodesk.AutoCAD.ApplicationServices.Document"/>
</ShimGeneration>
</Fakes>
The each of these classes is sealed. The Microsoft Fakes Platform doesn't create the shim for Autodesk.AutoCAD.ApplicationServices.Application (the ShimApplication class is not exist in the result):
The type or namespace name ShimApplication does not exist in the
namespace Autodesk.AutoCAD.ApplicationServices.Fakes (are you
missing an assembly reference?)
I haven't this problem for other two types. How can I fix it?
Also I have a question about the fakes-file structure. I can't find info about the ShimGeneration element. In the MSDN samples I see the StubGeneration element using only. From MSDN:
Stubbing concrete classes and virtual methods
By default, stub types are generated for all non-sealed classes. It is
possible to restrict the stub types to abstract classes through the
.fakes configuration file:
<Fakes xmlns="http://schemas.microsoft.com/fakes/2011/">
<Assembly Name="mscorlib" />
<!-- user code -->
<StubGeneration>
<Types>
<Clear />
<Add AbstractClasses="true"/>
</Types>
</StubGeneration>
<!-- /user code -->
</Fakes>
But in real life the XSD schema doesn't define the Types and the Add hasn't AbstractClasses attribute...
Where can I find actual and detailed info about the fakes-format?

Resharper External Attributes with MSTest's [DeploymentItem]

In certain cases (like when writing URIs in XAML), ReSharper magically figures out I am writing out a relative path to a file in the current project and offers very useful smart-completion for it, and a warning if I misspell something and get it wrong, and even goes to the file if I ctrl+click it.
Can I somehow tell ReSharper to do the same when I'm typing in the parameter to MSTest's DeploymentItem attribute?
This should work through an external annotation. Open the following file:
C:\Program Files (x86)\JetBrains\ReSharper\v7.1\Bin\ExternalAnnotations\Visual Studio\Microsoft.VisualStudio.QualityTools.UnitTestFramework.xml
(Or whatever version of Resharper you're using.)
Add these lines inside the assembly tag:
<member name="M:Microsoft.VisualStudio.TestTools.UnitTesting.DeploymentItemAttribute.#ctor(System.String)">
<parameter name="path">
<attribute ctor="M:JetBrains.Annotations.PathReferenceAttribute.#ctor" />
</parameter>
</member>
<member name="M:Microsoft.VisualStudio.TestTools.UnitTesting.DeploymentItemAttribute.#ctor(System.String,System.String)">
<parameter name="path">
<attribute ctor="M:JetBrains.Annotations.PathReferenceAttribute.#ctor" />
</parameter>
</member>
That tells Resharper to throw the PathReference attribute on the path parameter of both constructors of DeploymentItem.
However, after testing for some time now I cannot see this attribute working on anything that I try within the C# text editor. It could be that it doesn't work for my version (7.1), but I'm a bit stumped. Perhaps someone can add to this?

How to declare the Unity InjectionFactory in XML configuration

I'm in the process of moving our Unity configuration to the web.config file. I'm stuck on how to migrate the following code config to the xml format:
var container = new UnityContainer();
container.RegisterType<IPrincipal>(new InjectionFactory(x=> HttpContext.Current.User));
return container;
Here are the XML declartion:
<unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
<alias alias="IRepository" type="Model.IRepository, Model" />
<alias alias="Repository" type="Data.Repository, Data" />
<container>
<register type="IRepository" mapTo="Repository" />
</container>
</unity>
InjectionFactory is the one thing that can't be represented in XML out of the box. In order for it to completely work, you'd have to write a C# parser that could work on the XML file, which was way more than I wanted to bite off at the time.
However, I do have a sample on bitbucket which shows a way to get a limited version of factory creation working via XML. Might give you some ideas.

Web.Config, external file for system.serviceModel

Using VS2010
I have the following in my web.config (detail removed).
<system.serviceModel>
<behaviors />
<services />
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
<bindings />
<client />
</system.serviceModel>
I would like to use attribute configSource the same as appSettings can use to get the detail of these elements from another config file.
I have tried to apply configSource attribute to either system.serviceModel or to each of the sub nodes.
However, I get the invalid blue wavvy line saying:
The 'configSource' attribute is not allowed
I refer to the second answer (by Tom Brothers) in this question which demonstrates what I would like.
Can a web.config read from an external xml file?
Additional
Here is the configuration from that post. Has invalid blue wavvy lines.
<connectionStrings configSource="web\config\connectionStrings.config" />
<appSettings configSource="web\config\appSettings.config" />
<system.diagnostics configSource="web\config\diagnostics.config" />
<system.serviceModel>
<bindings configSource="web\config\serviceModelBindings.config" />
<behaviors configSource="web\config\serviceModelBehaviors.config" />
<services configSource="web\config\serviceModelServices.config" />
<client configSource="web\config\serviceModelClient.config" />
</system.serviceModel>
How can I use the configSource attibute in this case?
You cannot apply configSource= to <system.serviceModel> since that is a config section group - not a simple config section, and the configSource attribute is only available on simple configuration sections.
You should however absolutely be able to apply the configSource attribute to any of the nodes inside <system.serviceModel> - I do this all the time, in production systems - and it just works. Have you even really tried??
Or did you let yourself be scared off by Visual Studio... it might show you (and tell you) that configSource="...." is not allowed (by those wavy underlines) - but that's just a shortcoming in the Visual Studio editor - on the child nodes of <system.serviceModel>, it is allowed to have a configSource= attribute!
Can you show us (by editing your original question) what your e.g. serviceModelBehaviors.config looks like??
Also: is that file physically in the web\config subdirectory of your web application??

Categories

Resources