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

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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...
 
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
 
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
 
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...
 
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
 
Back
Top