-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
CoreCLR version in profiler API #12125
Comments
That API you mentioned looks for some defined variables to populate the info and generate the strings. However, the headers that contain them are pre-compiled. You can find the change that caused the changing strings here: dotnet/coreclr@2023be1#diff-56e523e96dfe1ef322266c2732ca3e72. So I'd expect the API to continue doing exactly the same as it was doing before the As for an API for this, @noahfalk do you think we should expose surface area that provides the same functionality? I'm not sure we obtain that information from anywhere in Corelib now so we'd have to pipe it down to the runtime to replicate the new API |
The algorithm we use everywhere else (e.g. in
I think the existing profiler API should be changed to use this same algorithm. |
I will change the existing |
Aligning it with the algorithm used for Environment.Version sounds good to me. Thanks all for jumping in 👍 @iskiselev - is your goal for the API to get a marketing version string that you can display to users and nothing else? Or were you hoping to make other inferences from it such as "In version X, the profiler API Y has behavior Z". If its the latter case we may have (or be able to create) better options. Thanks! |
@noahfalk, we are looking into it from APM point of view: profiler can be loaded by lot's of different application for which we should gather some information/statistics to be represented to users. So now we are interested in API that will give some string that can be used to identify CLR version on which we are executed on. It may be not marketing version, but it will be good if it will be some build number associated with only one particular version (and all values for public releases should be documented). I would say it is not a big problem if different servicing version will have the same version if CoreCLR was not rebuilt, though it will be better if API provide really unique version string. It may be beneficial if different builds (Ubuntu/Redhat/Windows/...) will be detectable by version information too, but we have no such need right now (or we can try to find some workarounds if it will be required, such as implement our own OS detection and guess CoreCLR version from it or so on). As we also use Profiler API for real instrumentation, I can see that we may need some profiler API feature/behavior detection, but we have not get any task that required it. Previously you was able to say (more or less) about feature/behavior by maximum ICorProfilerInfoX supported by framework. With dotnet/coreclr#22617 I've see, that there may be need with additional behavior detection mechanics, but it not affects me now. |
Changing the version from 4 to 3 will cause OpenCover to leak: https://github.com/OpenCover/opencover/blob/d94d935bfe77a48395096e17ab430a142b3f628b/main/OpenCover.Profiler/CodeCoverage.cpp#L389 (related to dotnet/coreclr#22851). If we go ahead with this change, we should submit PR to OpenCover to fix this, and also notify on #9305 to ask other profilers to apply the same fix if necessary. |
cc @davmason Nice spotting @jkotas! We do also have our announcments issue and breaking change doc that we should use to spread awareness. Previously the breaking change doc was at Documentation/Profiling/Profiler Breaking Changes.md but we lost it when dotnet/coreclr#22617 was reverted and so we'll need to bring at least that part back. EDIT: I later realized #9305 Jan mentioned is the announcments issue - sorry to be repetitive : ) |
Thanks for the info @iskiselev - it sounds like the new API behavior is the right choice for you (and hopefully many other profiler implementers will feel the same way). We'll certainly need to help smooth over some rough edges like what @jkotas found. |
@sywhang Could you please tell us when will you make changes in |
Load balancing to @davmason who can comment on @ee898's question |
@ww898 can you elaborate on what issues this will cause if not implemented? Currently it is marked as a backlog item which means it's not guaranteed to make it for 3.0. Knowing what trouble this causes will help define the priority of getting it implemented. |
@davmason @sywhang I develop a library which allows controlling profiling of the current process through the API based on P/Invoke. The library supports the case when both CLR v2 and CLR v4 (loaded into a single process) use the API simultaneously. Each of the CLRs communicates with a specific profiler COM instance with the help of a token. The token is generated using major and minor parts of the Unfortunately, now I should write the .NET Core v3 detector to process the unsymmetrical version change. And, what is even worse, this 'dirty hack' should work only till you update the |
@ww898 Could you use a workaround to unblock you? There are coreclr only interfaces, i.e. ICorProfilerInfo9/ICorProfilerInfo10, that you can QI for to know if you're on coreclr or not. In general the work to update the version returned will happen, it's just a question of when. Knowing how necessary this is will help me prioritize. |
@davmason Please correct me if I am wrong. To detect .NET Core v3.0 I should:
Is this correct? P.S. May be it is easier to fix the version of |
@davmason I have just implemented following checking to detect .NET Core v3.0:
Well, it's a fail, my tests are red, because .NET Core v2.1 / .NET Core v2.2 have same pattern. We really need something more unique to detect .NET Core v3.0. |
The problem with changing the version API is it is a breaking change and it is late in the development cycle for 3.0. It would fix your issues but cause issues for other vendors (for example the OpenCover issue mentioned by Jan earlier). My plan is to change it early in the .net 5.0 cycle so that profiler vendors have more time to react, and since 5 > 4 means that it will avoid certain classes of bugs. |
Hi @davmason, .NET Core 3.1 preview1 is out. And the issue came back. How to discern 3.1 and 3.0 in profiler agent? |
@ww898 can you help me understand why you need to know if you are targeting 3.0 or 3.1? From a profiler perspective it seems like if the API surface area is the same it shouldn't matter. |
@davmason We are using the fact that I don't understand your plans for |
I did not realize it was broken until late in the development cycle for 3.0 when it was reported to us. There are various profilers that were ported over from desktop that check I have a work item to fix |
Thanks @k15tfu and @davmason ! The |
Hi @davmason, just tested |
I found new |
Fixed in #35327 |
Profiler API already exposed method that expect to be used to resolve version, ICorProfilerInfo3::GetRuntimeInformation.
Unfortunately there is no documentation that will map results from it to marketing CoreCLR releases.
Per my tests it returns on Windows:
4.0.22220 for CoreCLR 2.0.9
4.0.30319 for CoreCLR 2.1.8, 2.2.0
Should it return value unique for each CoreCLR release? Should there be another API to resolve coreclr version (if we are talking about profiler, it will be some version associated with coreclr.dll)? Is there any existing way to resolve this version cross-platform? coreclr.dll on windows has File Version and Product version, are there something similar on other OS?
Will #12124 fix version resolution in profiler API?
cc: @noahfalk
The text was updated successfully, but these errors were encountered: