Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the trailing dot on a C# type indicate?

Tags:

I've been looking at some code in a debugger associated with Razor View engine and I noticed that some of the types appear in Debugger with a trailing dot character at the end of the type name e.g.:

{Nancy.ViewEngines.Razor.RazorViewEngine.}

Does anyone know what this indicates? It's not valid syntax to use it when specifying a cast on an object so I'm intrigued as to what it indicates within the debugger.

EDIT: As requested by @Damien_The_Unbeliever, screenshot of the variable in debugger:

Debug Image

And the code that I'm looking at:

public TCompiledView GetOrAdd<TCompiledView>(             ViewLocationResult viewLocationResult, Func<ViewLocationResult, TCompiledView> valueFactory)         {             TCompiledView compiledView = default(TCompiledView);             compiledView = (TCompiledView)this.cache.GetOrAdd(viewLocationResult, x => valueFactory(x)); 

To give a little more background, we're trying to add logging to our Nancy View Cache to investigate an intermittent issue with Razor Views throwing compilation errors, but that isn't really relevant to the question.

like image 896
Henry Wilson Avatar asked Aug 05 '13 13:08

Henry Wilson


People also ask

What is trailing dot?

The trailing dot is the part of the FQDN, it means the “root zone” in the internet domain name hierarchy system. So from top to bottom is “the dot” means the root, and the top level domain for example “com” or “org”, then the company or organization domain name “google”, and subdomain “www”.

What does C followed by a dot mean?

Cedilla. The cedilla is the diacritical mark ( ̧ ) that is placed under the letter 'c,' as in the spelling of the French words façade and garçon, to indicate that the letter is to be pronounced \s\, rather than \k\.

Does Cname need a dot at the end?

Some domain providers require a dot at the end of a CNAME record value. If the user then does not add it the domain itself would be added to the value.

What does the trailing dot mean in a CNAME?

The trailing dot tells the DNS server that this is a fully qualified name. The dot is the root of the DNS heirarchy. If you don't use the dot, the DNS server will assume that it's a record in the current zone and will append it for you. For example, if you have a CNAME in exmaple. com that points to host. example.

What does the dot at the end of a record mean?

Technically the "." on the end of a record such as www.serverfault.com. indicates the separator between the "com" gTLD and the "" root zone. Show activity on this post. The trailing dot tells the DNS server that this is a fully qualified name. The dot is the root of the DNS heirarchy.

Why is there no trailing dot in the hosts section?

The original designers wanted to be able to specify hosts in zone files with a minimum of typing, therefore it defaults to appending the zone to each entry unless fully qualified with a trailing dot. This is an implementation quirk that everydns.net realizes leads to newbie errors and confusion; therefore they eliminated it.

Is it possible to add a dot at the end of DNS?

No, the dot at the end is correct. You can try it here. Try adding a dot at the end of "www.dns-sd.org", as shown in the subtitle at the top of this page, and you should still get the same page. It's a little-known fact, but fully-qualified (unambiguous) DNS domain names have a dot at the end.


1 Answers

I've seen this happen when the variable/value is actually of a compiler generated type (e.g. for holding the "local variables" captured by a lambda, async, iterator, etc). The debugger (in various places) seems unable to display the actual class name.


E.g. this example program:

class Program {     static void Main(string[] args)     {         var p = new Program();         p.DoStuff();     }      void DoStuff()     {         int i = 19;         Expression<Func<int>> j = () => i + 10;         var k = (((j.Body as BinaryExpression).Left as MemberExpression).Expression as ConstantExpression).Value;         Console.ReadLine();     } } 

With a breakpoint on Console.ReadLine(), you'll find the k class's type looks like Program. rather than Program+<>_DisplayClass0


Addition by Jeppe: This example is a slight simplification of the above, avoiding the expression tree. Looks at a delegate instance's Target which will be an instance of a generated class. For comparison also looks at an iterator block type:

using System; using System.Collections.Generic;  static class Program {   static void Main()   {     int i = 19; // to be captured by lambda, will become field on a generated class     Func<int> f = () => i;     var target = f.Target;  // when debugging type looks like "Program."     Console.WriteLine(target.GetType().ToString()); // writes "Program+<>c__DisplayClass1"      var seq = GetSeq();  // when debugging type looks like "Program.GetSeq"     Console.WriteLine(seq.GetType().ToString()); // writes "Program+<GetSeq>d__3"   }    static IEnumerable<int> GetSeq() // returns "state machine" (iterator block)   {     yield return 42;   } } 
like image 152
Damien_The_Unbeliever Avatar answered Sep 21 '22 16:09

Damien_The_Unbeliever