Skip to content

Conversation

RikkiGibson
Copy link
Member

@RikkiGibson RikkiGibson commented Oct 1, 2025

Closes dotnet/vscode-csharp#8586

@dibarbet @jasonmalinowski could you please take a look?

One bit of info that I didn't include, was: "did project initialization complete or not". I don't think that was one of the bits @DamianEdwards was asking for. It was more something I was interested in knowing, though not essential. I just didn't see an obvious way of obtaining that info during the design-time build.

I did verify that expected bits of info are present when debugging when C#+CDK are in use.
I wasn't sure if changes on CDK side are needed, in order to get a full picture of the case that file-based programs are not being used. I also wasn't sure if consumption side changes to ProjectLoadTelemetryEvent are needed, to ensure the telemetry actually makes it to the destination.

@RikkiGibson RikkiGibson requested a review from a team as a code owner October 1, 2025 22:45
[property: JsonPropertyName("FileCounts")] IEnumerable<int> FileCounts,
[property: JsonPropertyName("SdkStyleProject")] bool SdkStyleProject)
[property: JsonPropertyName("SdkStyleProject")] bool SdkStyleProject,
[property: JsonPropertyName("HasSolutionFile")] bool HasSolutionFile,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can confirm it is working in VSCode by

  1. Run command Developer: Set Log Level to Trace
  2. Open the telemetry window (command Developer: Show Telemetry)
  3. You should see a log entry like [Extension Telemetry] ms-dotnettools.csharp/ProjectConfiguration

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No sweat, I will open a PR on the client, and try to verify.

@dibarbet
Copy link
Member

dibarbet commented Oct 1, 2025

I wasn't sure if changes on CDK side are needed, in order to get a full picture of the case that file-based programs are not being used.

For this, CDK reports its own project configuration-like event when it loads a project. Historically the C# project configuration event was only used when CDK was not active. Now we will have to make sure the queries know that both CDK and C# may be reporting this telemetry from the same session.

@RikkiGibson
Copy link
Member Author

RikkiGibson commented Oct 2, 2025

Opened dotnet/vscode-csharp#8673

OK, I verified that the telemetry is sent. However we basically only get events for the "file based program" and "rich misc file" cases. It's not clear to me if that's a problem that needs solving or not. I think if the queries can pull together both CDK and C# extension telemetry for the same session, then it should be fine as-is.

@JoeRobich
Copy link
Member

JoeRobich commented Oct 2, 2025

However we basically only get events for the "file based program" and "rich misc file" cases.

We do get them for first load of real projects right? Or are you testing in a CDK scenario?

@DamianEdwards
Copy link
Member

Today we aggregate the 2 different "project load" events from C# and C#DK to get a full picture. My understanding is when C#DK is active, the load event from C# is suppressed (i.e. not sent) so I'd expect this change to ultimately result in new property(ies) on both the project load events.

@RikkiGibson
Copy link
Member Author

We do get them for first load of real projects right? Or are you testing in a CDK scenario?

I was testing in a CDK scenario. Here is an example of the file-based app telemetry with C#+CDK active (formatting applied manually).

2025-10-02 12: 23: 21.364 [trace] [Extension Telemetry] ms-dotnettools.csharp/ProjectConfiguration
{
    "properties": {
        "platform.architecture": "x86_64",
        "platform.platform": "win32",
        "SolutionId": "",
        "ProjectId": "4be4c39f028a4fe2",
        "SessionId": "-1901508737",
        "OutputType": "0",
        "ProjectCapabilities": "GenerateDocumentationFile CSharp Managed ReferencesFolder LanguageService RelativePathDerivedDefaultNamespace AssemblyReferences COMReferences ProjectReferences SharedProjectReferences OutputGroups AllTargetOutputGroups VisualStudioWellKnownOutputGroups SingleFileGenerators DeclaredSourceItems UserSourceItems CrossPlatformExecutable NativeAOT PublishAot PublishTrimmed SupportsHotReload SupportsComputeRunCommand Pack NetSdkOCIImageBuild",
        "TargetFrameworks": "net10.0",
        "References": "f9b57385e04dcef1|b04d1a92c03aa393|740a41f35e38e687|a650b002a55ee732|8bb25cdfa9f58d95|ca01f9c6c9519128|a7db6d4c13eb109a|54e24c103f927e3e|4787ec450370cdc|faae3cd2329a5f23|b136c9057d0eac41|a4be57a67913d9f2|c2f7e51423366080|9221249557edf7da|ac08b9147e6c6cc1|fc8f31a851b2f1e|3d1fab7a1546aa70|75c42701c310d265|6eac5906d797823f|51b6b65db45d8317|977562ede61122d1|6f06be6c7dad3d57|782a823a2d8cd40|13bbf2cbcdb96469|a8b1d9f359d7b4f|8db448e27f0bad1b|5faa84ffcc646d16|3dd9e1e713ce28c1|bc70a3688f03b546|3e025539204a5d59|12bec27505c61c10|65e9cc7358ddee2e|7df5bfe00323a6a8|ce3f444652eead51|feebdde9a00fe94b|22d24df113118e04|6a8ada60e30e6abf|6001a9b860f7e43|e94e5ff7b2eb39a9|46b5412910b12f1a|eac4975c939bd705|a777367473e5f95c|f67433e0978efe89|d574426ce261f3cd|2620772be337bacb|ce4b86769789bfd2|afe098e2b8eb2364|4bca77302b767821|b42e3bf9c2caf9d|11d6a5981dd09f1d|2528657f041a0f71|1a4910e7928d2be4|385f6cb9a1a92341|8a6a053fd546c4b9|4bd5d70d9487a7|546da94a433dd46b|c8cd67501180cdb3|99380cc3f9cb0f62|e9ad645088056795|2b71ac54faa4d900|6d26f5b6d581bb7a|e99748daf45287f7|a3ac73bd1c3ce685|88a79e3fbc9be5a5|baed534980001b3e|a094f278ebd28638|f02b6f1120327ed5|1fdb3be137e7c8ab|d8d06e6254ff9a8|7a37191fa2429c0|db2085d40be0c6b|732e2f41e1ec328f|cc0b8a0dc4b5cc17|b3ec78066692ce40|b633596fb5206911|b1c086ddba588d7f|3935c25fc587591d|5db9cd2d6d302594|1fe2caf02ff5116|d1e401c8e175f133|beb154638739ac8f|d795c4b069f42de2|28889d355be716fb|987004758afb653e|a93a13f245d3dbf5|c2c7e5dd6bcf2f46|f40e391e11837c28|1f1effdb4f95fef|4b3556ed143bb1a1|990c07b3a694f061|16f3b3c6aa66dbea|bbc2c7fb9307d0f8|cae96c695fa0a849|23af2e185bf7f884|10682f5180926917|531413e8ae8921e9|cbb2e2956b8bc5a1|693159958e045249|abb76040f918f212|2978ebe3fa017619|d753dc831058d377|5d5ab2fae13c7cd7|6f36e9e201c8abbc|2c2215284100c1bc|abef39459b5f8089|58b2ccb5d5268768|f4c238ed95a4c9e0|463559064b820a89|f46a5248555641f3|31a917d25f0111b0|d9a0d90fcf36b125|f707ec8ff0716b6a|d31ae060adc0cf68|b740561cbe999190|6f6cd086b29443f|3e2b84419c2678fe|16aa5cd16608904e|88efed4970ce8fb|525af1cb4f8c1ef|82365a1d92723ea2|f9081118726c671d|1dc6ba4b51a92fe2|480fcc9a46d59829|96ae799a9cd65a64|1f0a5acc2009b69e|53da3fcaf9d4a664|762862983c40286f|7143cd55e6267a10|9c4f1e8060c475b4|5641b1bfbef8f076|c074fd9cba688aec|6b8a7cd56172fed1|5d25704a6a0be6ed|7de0d61ed8a595ec|85c2a8db5105888|ec2dac2bf194d54a|baae63d2bc6dd501|6e18d5f5513ced07|ecc917c3c9b5c475|3e60a289d38463fa|3297b865f846bd0a|4d9b25b5312a81c5|34cfcce7d574a410|762c57508db7a1c2|81016cf6be9235ed|96f5a81e8df6f19c|bc2ea691e56496f8|5d957776a3bc8463|4fcdd50549f35f69|1613d6b76156e26a|609f5396c0534146|31be6951d8a1de6e|d373f3c4566c70c6|b42e1bda5a17dc0e|3017ef0c38e2d837|92e480fdaacc79e0|ffb314483a45fa40|3159cfd5553fa1b8|6a5eaa177b0b8d54|add48a46678bd09d|c70f2a1b237f229d|3beb376886d63c97|363b07840a344182|f638dfb632c7bb3e|4fc1e02f10ba6dcc|7f7e058ceeba44c4|76fdeb10eb04a251|c229c6a3986d545b",
        "FileExtensions": "-1257278712",
        "FileCounts": "1",
        "NetSdkVersion": "10.0.0-rc.1.25451.107",
        "sdkStyleProject": "true",
        "HasSolutionFile": "false",
        "IsFileBasedProgram": "true",
        "IsMiscellaneousFile": "false",
        "useModernNet": "true",
        "common.os": "win32",
        "common.nodeArch": "x64",
        "common.platformversion": "10.0.26100",
        "common.telemetryclientversion": "0.9.0",
        "common.extname": "ms-dotnettools.csharp",
        "common.extversion": "42.42.42-placeholder",
        "common.vscodemachineid": "879a162bcbea1f71ff19cac0baa48e5768d068967782867eac1992c28ec0c70f",
        "common.vscodesessionid": "4675534d-5d38-42d7-ae07-3499ed16aa261759432974554",
        "common.vscodecommithash": "e3a5acfb517a443235981655413d566533107e92",
        "common.sqmid": "{9ABF3ED2-B71F-46C3-9ACC-1617B95F8FBD}",
        "common.devDeviceId": "9f870499-4c68-402e-9ecf-f5d8481e5269",
        "common.vscodeversion": "1.104.2",
        "common.vscodereleasedate": "2025-09-24T11:21:37.073Z",
        "common.isnewappinstall": false,
        "common.product": "desktop",
        "common.uikind": "desktop",
        "common.remotename": "none",
        "version": "PostChannel=4.0.4"
    }
}

Then, when C# only is running, there are two events in my manual test--one for the ordinary project loading, and one for the FBP. Trimmed down the properties to an "illustrative" subset:

2025-10-02 12: 33: 30.880 [trace] [Extension Telemetry] ms-dotnettools.csharp/ProjectConfiguration
{
    "properties": {
        "sdkStyleProject": "true",
        "HasSolutionFile": "true",
        "IsFileBasedProgram": "false",
        "IsMiscellaneousFile": "false",
        "useModernNet": "true",
    }
}
2025-10-02 12: 33: 30.944 [trace] [Extension Telemetry] ms-dotnettools.csharp/ProjectConfiguration
{
    "properties": {
        "sdkStyleProject": "true",
        "HasSolutionFile": "true",
        "IsFileBasedProgram": "true",
        "IsMiscellaneousFile": "false",
        "useModernNet": "true",
    }
}

In the C#+CDK case, I wasn't able to tell which telemetry event from CDK I should look for, re: the load of the ordinary project. Any tips on that would be appreciated.

My understanding is when C#DK is active, the load event from C# is suppressed (i.e. not sent)

It appears that the way this suppression works is, the "base C# project system", is simply not used for ordinary projects, and thus its telemetry events are not sent for ordinary projects.

With this change, the "base C# project system", will start sending events for "rich misc files" and "file-based programs", regardless of whether CDK is loaded.

@RikkiGibson RikkiGibson requested a review from dibarbet October 2, 2025 19:37
@dibarbet
Copy link
Member

dibarbet commented Oct 2, 2025

In the C#+CDK case, I wasn't able to tell which telemetry event from CDK I should look for, re: the load of the ordinary project. Any tips on that would be appreciated.

C#DK telemetry is reported a bit differently. You can use VSTelemetryMonitor with the steps outlined here to enable it.
The event name is vs/projectsystem/server/activateproject IIRC.

It appears that the way this suppression works is, the "base C# project system", is simply not used for ordinary projects, and thus its telemetry events are not sent for ordinary projects.

Yup, this is correct.

With this change, the "base C# project system", will start sending events for "rich misc files" and "file-based programs", regardless of whether CDK is loaded.

Yeah this is what will happen. The C#DK event will also be sent for the normal solution load. So a single session can now contain the project load events from both C# and C#DK.

@RikkiGibson RikkiGibson merged commit 96cc0a9 into dotnet:main Oct 2, 2025
26 checks passed
@RikkiGibson RikkiGibson deleted the fbp-telemetry branch October 2, 2025 20:44
@RikkiGibson
Copy link
Member Author

Will do the work to make vscode-csharp consume this build, and finally report the new telemetry, once an official build for this change is available.

@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Oct 2, 2025
333fred added a commit to 333fred/roslyn that referenced this pull request Oct 3, 2025
* upstream/main: (149 commits)
  Fix
  Simplify and add additional asserts
  Update proposal adjuster to acquire feature flags from VS (dotnet#80541)
  Remove First/Last
  Docs
  Docs
  Deprecate method and use workaround
  Remove support for ccreating EmbeddedStrings
  Remove methods
  Move more into extensions
  Move more into extensions
  Proper slice
  Proper slice
  Proper slice
  Move to slices
  Extract extensions
  Downstream
  Simplify the virtual char api
  Add telemetry indicating when file-based programs are used (dotnet#80538)
  Fix thread safety issue in BuildServerConnection.TryCreateServer environment variable handling (dotnet#80498)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Telemetry should include whether file-based apps or projects are being used

5 participants