Skip to content

The (none) text does not display for Choose Data Source item in the DataGridView Tasks dialog in DemoConsole application #13231

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

Open
Zheng-Li01 opened this issue Apr 3, 2025 · 5 comments
Assignees
Milestone

Comments

@Zheng-Li01
Copy link
Member

.NET version

main branch of Winforms repo

Did it work in .NET Framework?

Yes

Did it work in any of the earlier releases of .NET Core or .NET 5+?

No

Issue description

The (none) text does not display for Choose Data Source item in the DataGridView Tasks dialog in DemoConsole application
.NET 10:
Image

.NET framework 4.8.1:
Image

.NET Application:
Image

Steps to reproduce

Test the sample app: DemoConsole in Winforms repo

@Zheng-Li01 Zheng-Li01 added the untriaged The team needs to look at this issue in the next triage label Apr 3, 2025
@Tanya-Solyanik Tanya-Solyanik removed the untriaged The team needs to look at this issue in the next triage label Apr 3, 2025
@Tanya-Solyanik Tanya-Solyanik added this to the .NET 10.0 milestone Apr 3, 2025
@Tanya-Solyanik
Copy link
Member

@ricardobossan , please root-cause this issue and report back.

@ricardobossan
Copy link
Member

@Tanya-Solyanik My findings so far:

  • The DataGridView Tasks dialog is displayed through the DesignerActionPanel.
  • The DataSource value shown there comes from the designer class, specifically DataGridViewDesigner.
  • The value of DataSource starts as null. If the user changes it to None in the dropdown, it is set back to null.
  • When the value is null, the field appears empty in the Tasks dialog.
  • A practical workaround is to return the string "(none)" when the DataSource property of DataGridViewDesigner is null, like so:
    public object? DataSource
    {
        get => _owner.DataSource ?? "(none)";
    }

@Tanya-Solyanik
Copy link
Member

Tanya-Solyanik commented Apr 8, 2025

We shouldn't replace a null return value with a string, this is a public API, the customers are expecting and handling a null. How is this supposed to work? how does it work in the Inproc designer or OOP designer? Does this work when demo console is retargeted to NETFX?

@ricardobossan
Copy link
Member

How is this supposed to work? how does it work in the Inproc designer or OOP designer?

  • On OOP, I debugged a standard .NET 10 WinForms project (VPN on), and the "(none)" message appeared as expected in the field:
    Image
  • I found one place where the string "(none)" appears during runtime. This seems to be the value returned from serialization:
    Image
  • Here’s the call stack for that serialization:
    > Microsoft.DotNet.DesignTools.Protocol.dll!Microsoft.DotNet.DesignTools.Protocol.DataPipe.Binary.BinaryMessageFormatter.StreamJsonRpc.IJsonRpcMessageFormatter.Serialize(System.Buffers.IBufferWriter<byte> bufferWriter, StreamJsonRpc.Protocol.JsonRpcMessage message) Line 158 C#
    >
    > StreamJsonRpc.dll!StreamJsonRpc.LengthHeaderMessageHandler.Write(StreamJsonRpc.Protocol.JsonRpcMessage content, System.Threading.CancellationToken cancellationToken) Unknown
    > StreamJsonRpc.dll!StreamJsonRpc.MessageHandlerBase.WriteAsync(StreamJsonRpc.Protocol.JsonRpcMessage content, System.Threading.CancellationToken cancellationToken) Unknown
    > [Resuming Async Method]
    > System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start<StreamJsonRpc.MessageHandlerBase.<WriteAsync>d**23>(ref StreamJsonRpc.MessageHandlerBase.<WriteAsync>d**23 stateMachine) Unknown
    > StreamJsonRpc.dll!StreamJsonRpc.JsonRpc.SendAsync(StreamJsonRpc.Protocol.JsonRpcMessage message, System.Threading.CancellationToken cancellationToken) Unknown
    > [Resuming Async Method]
    > System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start<StreamJsonRpc.JsonRpc.<SendAsync>d**149>(ref StreamJsonRpc.JsonRpc.<SendAsync>d**149 stateMachine) Unknown
    > StreamJsonRpc.dll!StreamJsonRpc.JsonRpc.HandleRpcAsync(StreamJsonRpc.Protocol.JsonRpcMessage rpc) Unknown
    > [Resuming Async Method]
    > System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
    > System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.AsyncStateMachineBox<StreamJsonRpc.JsonRpc.<HandleRpcAsync>d**165>.MoveNext(System.Threading.Thread threadPoolThread) Unknown
    > System.Private.CoreLib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod**12_0(System.Action innerContinuation, System.Threading.Tasks.Task innerTask) Unknown
    > System.Private.CoreLib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining) Unknown
    > System.Private.CoreLib.dll!System.Threading.Tasks.Task.RunContinuations(object continuationObject) Unknown
    > StreamJsonRpc.dll!StreamJsonRpc.JsonRpc.DispatchIncomingRequestAsync(StreamJsonRpc.Protocol.JsonRpcRequest request) Unknown
    > [Resuming Async Method]
    > System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
    > System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<StreamJsonRpc.Protocol.JsonRpcMessage>.AsyncStateMachineBox<StreamJsonRpc.JsonRpc.<DispatchIncomingRequestAsync>d**158>.MoveNext(System.Threading.Thread threadPoolThread) Unknown
    > System.Private.CoreLib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod**12_0(System.Action innerContinuation, System.Threading.Tasks.Task innerTask) Unknown
    > System.Private.CoreLib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining) Unknown
    > System.Private.CoreLib.dll!System.Threading.Tasks.Task.RunContinuations(object continuationObject) Unknown
    > StreamJsonRpc.dll!StreamJsonRpc.JsonRpc.DispatchRequestAsync(StreamJsonRpc.Protocol.JsonRpcRequest request, StreamJsonRpc.TargetMethod targetMethod, System.Threading.CancellationToken cancellationToken) Unknown
    > [Resuming Async Method]
    > System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
    > System.Private.CoreLib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod\_\_12_0(System.Action innerContinuation, System.Threading.Tasks.Task innerTask) Unknown
    > System.Private.CoreLib.dll!System.Threading.Tasks.AwaitTaskContinuation.System.Threading.IThreadPoolWorkItem.Execute() Unknown
    > System.Private.CoreLib.dll!System.Threading.ThreadPoolWorkQueue.DispatchWorkItem(object workItem, System.Threading.Thread currentThread) Unknown
    > System.Private.CoreLib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch() Unknown
    > System.Private.CoreLib.dll!System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() Unknown
    > System.Private.CoreLib.dll!System.Threading.Thread.StartHelper.RunWorker() Unknown

Does this work when demo console is retargeted to NETFX?

  • Yes, when I target DemoConsole to NETFX, the "(none)" message still appears normally, just as described in the original issue.

@Tanya-Solyanik
Copy link
Member

InProc designer will be closer to our demo console, please experiment with it as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants