Skip to content

Fix build with disabled event trace/perftracing#130305

Open
kant2002 wants to merge 5 commits into
dotnet:mainfrom
kant2002:kant/fix-event-trace
Open

Fix build with disabled event trace/perftracing#130305
kant2002 wants to merge 5 commits into
dotnet:mainfrom
kant2002:kant/fix-event-trace

Conversation

@kant2002

@kant2002 kant2002 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

That's changes only for NativeAOT and I did test only these configuration

set(FEATURE_PERFTRACING 0)
set(FEATURE_EVENT_TRACE 0)

Also disable EventSourceSupport in the AotCompilerCommon.props

@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Jul 7, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib
See info in area-owners.md if you want to be subscribed.

#endif // FEATURE_EVENT_TRACE

FireEtwGCSuspendEEBegin_V1(Info.SuspendEE.Reason, Info.SuspendEE.GcCount, GetClrInstanceId());
#endif // FEATURE_EVENT_TRACE

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's actually line which catch my attention. Other changes is from attempt to build things with disabled features

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should not actually be needed. There's another FireEtw 6 lines below that compiles just fine. I think these are #defined to nothing when FEATURE_EVENT_TRACE is not set.

};
};

#ifndef FEATURE_EVENT_TRACE

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is also interesting thing. This looks like implemented in the disabledeventtrace.cpp or if I guess incorrectly, then it should be removed from both implementations eventtrace.cpp and disabledeventtrace.cpp

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yep, this looks unnecessary. The inline prevents this from being a duplicate symbol error, but looks duplicated.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

actually either by order of inclusion, or by something else, inline does not prevent it from being build error for me. that's how I discover this.

@MichalStrehovsky MichalStrehovsky left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There are build breaks.

}

void ETW::GCLog::FireGcStart(ETW_GC_INFO * pGcInfo) { }
#if FEATURE_EVENT_TRACE

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is this one different?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's from

set(FEATURE_PERFTRACING 1)
set(FEATURE_EVENT_TRACE 0)

configuration probably, so given that we don't care about it. I remove it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

PERFTRACING is basically event pipe. EVENT_TRACE is ETW. Changes here are "allowing" to build PERFTRACING=1 EVENT_TRACE=0, but not really because we're not actually building event pipe.

I would undo the changes under /eventpipe/ and declare PERFTRACING=1 EVENT_TRACE=0 non-sensical.

void EventPipe_Shutdown();
bool DiagnosticServer_Shutdown();

#ifdef FEATURE_EVENT_TRACE

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would undo this one too for the same reason as /eventpipe/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same from

set(FEATURE_PERFTRACING 1)
set(FEATURE_EVENT_TRACE 0)

Removed.

static HRESULT ForceGCForDiagnostics();
static void ForceGC(LONGLONG l64ClientSequenceNumber);
static void FireGcStart(ETW_GC_INFO * pGcInfo);
#if defined(FEATURE_EVENT_TRACE)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why is this needed?

};
};

#ifndef FEATURE_EVENT_TRACE

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yep, this looks unnecessary. The inline prevents this from being a duplicate symbol error, but looks duplicated.

#endif // FEATURE_EVENT_TRACE

FireEtwGCSuspendEEBegin_V1(Info.SuspendEE.Reason, Info.SuspendEE.GcCount, GetClrInstanceId());
#endif // FEATURE_EVENT_TRACE

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should not actually be needed. There's another FireEtw 6 lines below that compiles just fine. I think these are #defined to nothing when FEATURE_EVENT_TRACE is not set.

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

Labels

area-NativeAOT-coreclr community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants