Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Value cannot be null. (Parameter 'stream') #2577

Open
domleg opened this issue Apr 3, 2024 · 1 comment
Open

Value cannot be null. (Parameter 'stream') #2577

domleg opened this issue Apr 3, 2024 · 1 comment
Assignees
Labels
1.77.3 Version 1.77.3 Need 2 check VNC Issues related to the VNC protocol

Comments

@domleg
Copy link

domleg commented Apr 3, 2024

Expected Behavior

That the RemoteDesktop Connect method works without errors.

Current Behavior

When using VNCSharp this method was working fine but the performance was very bad. I upgraded my project to .NET Core 8.0 and used VNCSharpCore instead.

// Create a new RemoteDesktop control
RemoteDesktop newRd = new RemoteDesktop();
vncPanel.Controls.Add(newRd); // Add the new control to the panel
newRd.Dock = DockStyle.Fill;

try
{
// Connect
newRd.Connect(ipAddress, true, true); // Adjust parameters as needed
// Optionally, handle disconnections or other events here
newRd.ConnectionLost += (sender, e) =>
{
MessageBox.Show("Connection lost.");
};
}
catch (Exception ex)
{
MessageBox.Show($"Failed to connect: {ex.Message}"); //fails here with the error in the title.
}

Possible Solution

I need to know what this Parameter 'stream' is so I can fix it.

Steps to Reproduce (for bugs)

Not sure as it's specific to our environment.

Context

Trying to make a grid of all our Linux devices where all VNC Clients are visible in the grid in real time over a local network at 1 Gbps.

Your Environment

VNC Servers are running on Linux, client can simply connect with IP address.

@Kvarkas Kvarkas self-assigned this Apr 10, 2024
@Kvarkas Kvarkas added VNC Issues related to the VNC protocol Need 2 check 1.77.3 Version 1.77.3 labels Apr 10, 2024
@imoore937
Copy link

imoore937 commented Jun 5, 2024

I have the same error trying to use this in a VB app. I also have upgraded to .NET 8.0 and VNCSharpCore instead of the unmaintained VNCSharp. I just have one RemoteDesktop control on a form.
Here's the code I use to connect to the server:

    Public Sub Connect()
        Dim vncex As VncProtocolException
        Dim oex As Exception
        ' As long as they didn't click Cancel, try to connect
        If (Not PiHost = Nothing) Then
            Me.Instance.Invoke(Sub()
                                   Try
                                       RemoteDesktop1.GetPassword = New VncSharpCore.AuthenticateDelegate(AddressOf GetPassword)
                                       Me.RemoteDesktop1.Connect(PiHost)
                                       BackgroundWorker1.WorkerReportsProgress = True
                                       BackgroundWorker1.ReportProgress(100)
                                   Catch vncex
                                       If vncex.HResult = "-2146232832" Then
                                           'VNC not running yet, so try sleeping for a bit
                                       Else
                                           MsgBox("Error " & vncex.HResult & ": " & vncex.Message)
                                       End If

                                       Exit Try
                                   Catch oex
                                       MsgBox(oex.Message)
                                   End Try
                               End Sub)
        End If
    End Sub

Once I click OK to the "Value cannot be null" error, VS gives an error:
System.NullReferenceException: 'Object reference not set to an instance of an object.'

at the last line in this part of the VNCSharp code:

public override Rectangle GetMouseMoveRectangle()
{
	Rectangle rectangle = vnc.Framebuffer.Rectangle;
	if (remoteDesktop.ClientSize.Width > remoteDesktop.Desktop.Size.Width)
	{
		rectangle.X = (remoteDesktop.ClientRectangle.Width - remoteDesktop.Desktop.Width) / 2;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.77.3 Version 1.77.3 Need 2 check VNC Issues related to the VNC protocol
Projects
None yet
Development

No branches or pull requests

3 participants