When can AssemblyName.Version be null?

Viewed 30

The docs show that AssemblyName.Version is nullable. So this could be null:

Assembly.GetExecutingAssembly().GetName().Version

Under what conditions could Version be null? The docs do not say.

1 Answers

Based on the comment by @EtiennedeMartel and an answer from the repo:

var an = new System.Reflection.AssemblyName("MyAssembly");
Console.WriteLine(an.Version is null);                     // true

So I don't expect it to be null for the cases above, but it could be null for an Assembly created dynamically (i.e. at runtime).

Related