I have an object "retval" of type "MyCompany.Department.MyCrystalRpt"
(from the watch window:)
retval.GetType().ToString() "MyCompany.Department.MyCrystalRpt" String
This report is compiled to be part of a class library, and even has it's
resources compiled in correctly:
(from the watch window:)
retval.GetType().Assembly.GetManifestResourceNames {Length=2} String()
(0) "MyCompany.Department.MyCrystalRpt.resources" String
(1) "MyCompany.Department.MyCrystalRpt.rpt" String
According to the documentation, "If the full name of type is
"MyNameSpace.MyClasses" and name is "Net", GetManifestResourceStream will
search for a resource named MyNameSpace.Net.", so I'd expect this:
(from the watch window:)
retval.GetType().Assembly.GetManifestResourceStream( retval.GetType(),
"MyCrystalRpt.rpt")
To return a System.IO.Stream; however it return Nothing/null.
Now, I realise that there are other ways to get the manifest resource stream
, for instance:
retval.GetType().Assembly.GetManifestResourceStream(
"MyCompany.Department.MycrystalReport.rpt") does return a System.IO.Stream;
howwever, this issue is code identified in a third party component vendors
code (thanks to a certain amount of IL debugging), and I don't believe the
fault is with them, but instead within the 1.1 Framework?
Or am I being really stupid and mis-interpreting the documentation?
Rowland Shaw - 19 Dec 2005 13:05 GMT
Further down the rabbit hole I go...
It turns out that by some oddity, my classes had a different namespace than
the resources (by case only)
> I have an object "retval" of type "MyCompany.Department.MyCrystalRpt"
> (from the watch window:)
[quoted text clipped - 23 lines]
> fault is with them, but instead within the 1.1 Framework?
> Or am I being really stupid and mis-interpreting the documentation?
"Jeffrey Tan[MSFT]" - 20 Dec 2005 01:36 GMT
Hi Rowland,
It seems that your problem is caused by using a wrong namespace, which
caused the null reference returned. Yes?
Ok, after fixing this issue, Assembly.GetManifestResourceStream works well
for you now, yes? If you still have any concern, please feel free to tell
me, thanks
Best regards,
Jeffrey Tan
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.