is System.Windows.Forms DLL safe for server-side use?

G

Guest

I need to use the ResXResourceReader/Writer in my ASP.NET application, but
these classes are included in the Winforms assembly.
I am certain I CAN reference this assembly and use the classes, but is this
safe? In the sense of "does this assembly do anything that's not
server-friendly" ?

any thoughts/pointers/existing experience out there?
TIA
 
S

Steve C. Orr [MCSD, MVP, CSM, ASP Insider]

That all depends on which objects/methods you're using.
The resource functions you mentioned should be ok.
Then again, doing things like calling MessageBox.Show are not likely to
work...
 
G

Guest

Right, I understand that using a MessageBox would be like shooting myself in
the foot ;-)
I am primarily interested in finding out if just using this assembly might
cause any undesired behavior in server apps (example of a scenario that I am
worried about: developers of this assembly used the MessageBox to show some
info because they assumed the assembly would always be used in a GUI app)...

Steve C. Orr [MCSD said:
That all depends on which objects/methods you're using.
The resource functions you mentioned should be ok.
Then again, doing things like calling MessageBox.Show are not likely to
work...

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net


OlegD said:
I need to use the ResXResourceReader/Writer in my ASP.NET application, but
these classes are included in the Winforms assembly.
I am certain I CAN reference this assembly and use the classes, but is
this
safe? In the sense of "does this assembly do anything that's not
server-friendly" ?

any thoughts/pointers/existing experience out there?
TIA
 
D

Damien

Right, I understand that using a MessageBox would be like shooting myself in
the foot ;-)
I am primarily interested in finding out if just using this assembly might
cause any undesired behavior in server apps (example of a scenario that I am
worried about: developers of this assembly used the MessageBox to show some
info because they assumed the assembly would always be used in a GUI app)...
You can always use Lutz Roeder's .NET Reflector to explore a class and
see exactly what the code is doing. ResXResourceReader is thankfully
small enough to let you look through all of the code in less than an
hour.

Damien
 
G

Guest

Thank you for the tip, but my question is not about the ResXResourceReader
class itself, it is about the WinForms assembly. Are there any side-effects
to having this assembly loaded? Any static constructors that assume a GUI
environment, etc, etc...
 
D

Damien

Thank you for the tip, but my question is not about the ResXResourceReader
class itself, it is about the WinForms assembly. Are there any side-effects
to having this assembly loaded? Any static constructors that assume a GUI
environment, etc, etc...

Static constructors are only called on classes which your code uses,
not on every class within an assembly. Therefore, provided you are
only accessing ResXResourceReader, you're safe. If you're using other
classes, you can examine them for safety too.

Damien
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top