.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Value of 'null' is not valid for 'stream'.

Posted By:      Posted Date: October 15, 2010    Points: 0   Category :Windows Application

hi all,

i've got problem with load image PNG

my code :

Me.PictureBox_PngSource.Image = Image.FromStream(System.Reflection.Assembly.GetExecutingAssembly.GetManifestResourceStream("SISOLUSI.logo.png"))

ty before

View Complete Post

More Related Resource Links

error: null is not valid value for stream


Dim strm As System.IO.Stream = Me.GetType().Assembly.GetManifestResourceStream("fullbuttonface.bmp")

_buttonFace = New Bitmap(strm)

May be the  bitmap file is not part of the assembly, how do I put it in the assembly


Interesting error message with content organiser: Cannot resolve mailbox (null) to a valid user

Here is a site with content organiser site feature enabled, as well as the email integration feature. Emails are successfully delivered to the "Submitted Email Records" list, but is never routed to the Drop Off Library. (the content organiser web service works fine and the drop off library works as a custom send to destination and happily processes its rules. If I turn up the debug juice I get the error "Cannot resolve mailbox (null) to a valid user" for every item in any "Submitted Email Records" in the site collection. Area: Document managagement Category: Content organiser EventID: 8000 Message: Cannot resolve mailbox (null) to a valid user I have temporarily worked around the problem by email enabling the drop off library but it creates an intermittent race condition (similar to certain workflow and event receiver situations), so its not a real solution (and in fact I assume thats why the Submitted Email Records hidden list exists in the first place). I've run procmon, specifically focusing on OSWTIMER and nothing interesting shows up at all. The error message is intriguing and I can't really think of what it is trying to do. In troubleshooting I noted that this farm had configured inbound email but not outbound email. I have since rectified this and de/reactivated the content organiser features and reset the timer service and IIS, b

NULL value exception when trying to save to stream


Im trying to resize an image. I have the original file and then try to resize it and save it to a new image.
However, I get an exception because the value of stream cannot be null. This makes sense, but I dont know how to prevent it:

Value cannot be null.
Parameter name: stream

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: stream

Source Error:

Line 395:
Line 396:        Dim toStream As System.IO.Stream
Line 397:        thumbnailBitmap.Save(toStream, origimage.RawFormat)
Line 398:        thumbnailGraph.Dispose()
Line 399:        thumbnailBitmap.Dispose()

Dim origimage As Image=System.Drawing.Image.FromStream(FU.PostedFile.InputStream)
        Dim thumbnailBitmap = New Bitmap(newWidth, newHeight)
        Dim t

Testing for Valid Date or Null Value -- Using Conditional Split


I have a Flat File Source with several columns of data that should be valid dates.  Sometimes however they may either be NULL or not valid dates.  I understand the expresstion ISNULL([ColumnName]) will test for the NULL condition.  What is the syntax to test if the value is a valid date?  It might be a string such as "baddate" or it could be a date that is too old.  Could you provide an example of an expression that will test for both of these conditions?




'TDS Protocol stream is not valid' error when running SQL Server 2008 with jdbc driver of version


I am using SQL Server 2008 on Windows Server 2008 R2 and one of our servers running as a windows service (on Windows Server 2008 R2) contacts the SQL Server 2008 in a timely fashion to get some information. During one of these runs, we encountered the following error logs in the service logs and thereby we took a hit in serving client requests. The jdbc jar that is used for database connectivity is of version 3.0 (sqljdbc.jar).


I can provide more details on this issue. Can someone please let us know why this can be occurring ? Just so you know, the set of errors repeats itself after sometime although on a different JDBC Connection (with different ConnectionID). We have a reconnection algorithm running in case the JDBC Connection is lost for some reason (but I would be surprised if this issue relates to the re-connect algorithm).


INFO   | jvm 1    | 2011/02/28 22:26:54 | Feb 28, 2011 10:26:54 PM com.microsoft.sqlserver.jdbc.TDSParser throwUnexpectedTokenException
INFO   | jvm 1    | 2011/02/28 22:26:54 | SEVERE: TDSReader@4686d ( ConnectionID:25 TransactionID:0x0000000000000000): FetchBufferTokenHandler: Encountered unexpected TDS_RET_STAT (0x79)
INFO   | jvm 1    | 2011/02/28 22:26:54 | Feb 28, 2011 10:26:54 PM com.microsoft.sqlserver.jdbc.TDSReade

Parameter is not valid. memory stream error


Hi,  I have these 2 functions that save an image using a stream, it works with small images (1kb) but not with large ones.

and i get the error:

Parameter is not valid.


Line 202: long len = ms.Length;

Line 203: byte[] b = new byte[len];

Line 204: using (System.Drawing.Image image = System.Drawing.Image.FromStream(ms))

 Line 205: {

Line 206: image.Save(Path.Combine(@"C:\Trash\", fileName));


        public static string writeImage(string imageLink)
            string fileName = getFileName(imageLink);
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(imageLink);
            HttpWebResponse resp = (HttpWebResponse)req.GetResponse();

            using (Stream st = resp.GetResponseStream())

                MemoryStream ms = (MemoryStream)CopyStream(st);
                ms.Seek(0, SeekOrigin.Begin);
                long len = ms.Length;
                byte[] b = new byte[len];
                using (System.Drawing.Image image = System.Drawing.Image.FromStream(ms))

Using a CompareValidator to check input is a valid date

The CompareValidator can do more than just compare two controls. You can also compare it against several of the main .net data types such as Date, Integer, Double and Currency.

To do this you would set Operator="DataTypeCheck" and instead of setting the ControlToCompare or ValueToCompare attributes as you normally would you use the Type="Date" (or any of the data types I have listed above).

How to check for null/empty strings on dynamic objects?


What is the proper way to check for null or empty strings on dynamic objects? This is the only solution I've found so far:

if (admin.PasswordHash.GetType() == typeof(DBNull) || admin.PasswordHash == string.Empty)

If the field is null, the object returned is DBNull.Value, but if the field is empty string, it's return as a System.String object. This makes it impossible to do regular "admin.PasswordHash == DBNull.Value" check, as that will fail whenever the field has been set to empty string. Is my example the right (and only) way to go?

Users getting logged out because HttpContext.Current is null


We've  been trying to fix this one for a couple years, and I'm just out of ideas, so any help is really appreciated!

We've got a fairly large, complex web application that uses Forms Authentication to authenticate users.  Throughout the application we store and retrieve information about users in the Session object, and in some cases in cookies.  In a couple places we check for the existence of the context, and if it's null we send the user back to the login page to re-establish the session. 

Just a quick run-down of this web app: C#, .NET 3.5, IIS 6, ASP.NET State Service to manage session

As for the session timer, we use our own home-grown timer, which is basically a client-side timer, which is backed up by a check to the SQL database to see when their last activity was.  This seems to work well for us.  It's not perfect, but it allows us to notify the user before the session times out, and allows us to be certain we're not logging a user out before their 60 minutes of inactivity is up.

What's happening is that certain users are being logged out after just a few minutes.  We've eliminated the timer as a cause and believe what's happening is the HttpContext.Current is null, so the user is logged out.  We do not know why the HttpContext.Current is null, and I underst

ReportViewer :: Failed to enable constraints. But my statement is valid!!

  • A
  • n error has occurred during report processing.
      • Exception has been thrown by the target of an invocation.
        • Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

    Why do I keep getting this error, even when not using any data on the report. When I run the query in SQL server I get a resultset. However when I try to render the report I get this error.


    Path not valid.



    im trying to save a file, filename as current date and time.it will give an error.

    any ideas.

    here is my code

    string datetime=DateTime.Now.ToString();

    if (GridviewtoCSV("~/Admin/doc/Reports/" + batchid.ToString() + datetime + ".csv", transactiongrid) && GridviewtoPDF("~/Admin/doc/Reports/" + batchid.ToString() + datetime + ".pdf", transactiongrid))

    'element.className' is null or not an object



    I just downloaded the project, compiled it and ran it right out of the box and when I put the mouse pointer over or remove the mouse pointer from either MenuItem in the menu demo, I generate this error:

    'element.className' is null or not an object

    It points to this javascript method:

    updateClassName: function(operation, element, name, value) {
            this[operation + 'String'](
                    function() {
                        return element.className;
                    function(newValue) {
                        element.className = newValue;

    .NET Matters: Asynchronous Stream Processing


    This month Stephen Toub discusses asynchronous stream processing.

    Stephen Toub

    MSDN Magazine March 2008

    .NET Matters: Stream Pipeline


    This month Stephen Toub explains how to make the most of dual processors when running encryption and compression tasks.

    Stephen Toub

    MSDN Magazine February 2008

    ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
    Sql Server  SharePoint  Silverlight  Others  All   

    Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend