473,396 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Multiple Type Definition Causes Resource Failure

Hello,

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.

Nov 21 '05 #1
4 1208
I read somewhere that you must always declare the form class before any
other non-designable declerations. otherwise the Designer does not read
the form properly.

This might relate to your case also:
Try to declare the enum after the form decleration, and see what happens
to the namespace entry.

Atara

*** Sent via Developersdex http://www.developersdex.com ***
Nov 21 '05 #2
Yes this works. There was no problem in the designer however. The problem
was/is in the assembly manifest. So its more of a compilier issue. I dont
suppose you have the link to the info you were talking about? Ive tried
Googling the problem but given the keywords im using i get nothing but
noise.

FJ

"Atara" <At***@DD.com> wrote in message
news:ev**************@tk2msftngp13.phx.gbl...
I read somewhere that you must always declare the form class before any
other non-designable declerations. otherwise the Designer does not read
the form properly.

This might relate to your case also:
Try to declare the enum after the form decleration, and see what happens
to the namespace entry.

Atara

*** Sent via Developersdex http://www.developersdex.com ***

Nov 21 '05 #3

<url:http://groups-beta.google.com/group/...dotnet.framewo
rk.windowsforms/browse_thread/thread/97b90bda835ce6a9/d97ceb96927bfcd0?l
nk=st&q=dotnet+designer+%22two+forms%22&rnum=1&hl= en#d97ceb96927bfcd0>

"...The final thing that I know of that could cause this is that the
designer
will not open if the first class is not the designable class. So, if you
put
an enum or other class at the top of the file, the designer will try to
parse that class instead of the form, and it will fail."


*** Sent via Developersdex http://www.developersdex.com ***
Nov 21 '05 #4
O.k thanks Atara,

Ive had a look at that link but it is for a different problem. My question
is about a problem that doesn;t affect the designer but the manifest.
Mine is about a compliation/runtime issue not a designer issue. Thanks
anyway.

fj

"Atara" <At***@DD.com> wrote in message
news:eo**************@TK2MSFTNGP12.phx.gbl...

<url:http://groups-beta.google.com/group/...dotnet.framewo
rk.windowsforms/browse_thread/thread/97b90bda835ce6a9/d97ceb96927bfcd0?l
nk=st&q=dotnet+designer+%22two+forms%22&rnum=1&hl= en#d97ceb96927bfcd0>

"...The final thing that I know of that could cause this is that the
designer
will not open if the first class is not the designable class. So, if you
put
an enum or other class at the top of the file, the designer will try to
parse that class instead of the form, and it will fail."


*** Sent via Developersdex http://www.developersdex.com ***

Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Graham Banks | last post by:
Does using multiple inheritance introduce any more performance overhead than single inheritance?
6
by: Boyd Reilly | last post by:
I have a form that has the user pick the type of question he will answer. The input field will be a text, numeric or date type. So, after the question is answered, I need to change the input...
9
by: lbj137 | last post by:
I have two files: A.c and B.c. In both files I define a global variable, int xxxx; When I compile with a green hills compiler (and also i think with a GNU compiler) I get no errors or warnings....
2
by: pawel.pabich | last post by:
Hajo, I know only one way of forcing element to have one or more childes: <xs:element name="saleOrSupplyMethod"> <BR/> <xs:complexType> <xs:choice> <xs:sequence> <xs:element...
12
by: bj7lewis | last post by:
I am working on a project I want to add a few files as resource to access(copy them to FS and use) at runtime. So far in VS.NET IDE, I Add Files to the project and set its Build Action to...
11
by: lars.uffmann | last post by:
Easily described problem: Using g++ version 3.3.5 under suse 9.3, bla.h: ----------- #ifndef myTEST #define myTEST ZFSInt test; #endif
3
by: Antonio Rivas | last post by:
Hello all. I've got a problem of multiple definition in a program that at first glance looks correct (I won't type the whole code, just the relevant one and as examples since seems is a linkage...
58
by: bonneylake | last post by:
Hey Everyone, Well recently i been inserting multiple fields for a section in my form called "serial". Well now i am trying to insert multiple fields for the not only the serial section but also...
482
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if this is more of a coldfusion problem or a javscript problem. So if i asked my question in the wrong section let me know an all move it to the correct place. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.