I was recently asked to look at someones code to see if i could determine
why a particular form was failing to load and instead generating an error
about a lack of available resources for that locale. The form inherited from
a base form and was defined with an inline namespace rather than defaulting
to the project option dialog namespace. Prior to the class/form definition,
an enum was defined within the namespace scope as below ( i haven't included
the actual definitions)
Namespace Company.Solutions.ProductName.UI.WinForms
Public Enum MyEnum
.......
End Enum
Public Class frmCredentials
Inherits ApplicationBaseForm
....
End Class
End Namespace
So i fired up Ildasm and had a look at the manifest and found that this
particular class had a resource entry like
..mresource public frmCredentials.resources
{
}
whereas all other classes/forms had a full namespace definitions as in
..mresource public Company.Solutions.Product.UI.WinForms.frmXYZ.resou rces
{
}
So i tried taking out the Enum definition and placing it in a separate .vb
file. This worked. The manifest now had a full namespace entry for the
resources file as below :
..mresource public
Company.Solutions.Product.UI.WinForms.frmCredentia ls.resources
{
}
And the form now loads and runs without error.
My question is what difference does this make? Why did this work? Whilst it
is not my preference to include multiple type defintions in the same file, I
wasn't aware that this would cause any problems with respect to compilation
and execution? Although the issue has been resolved, I dont know why what i
did worked?
Does anyone have any ideas? Note if i put the Enum back into the file. It
fails as above.
Thanks
Floppy J.