Skip to content

[browser][coreCLR] adopt new API for async main and enable asyncV2 #121064

@pavelsavara

Description

@pavelsavara

Cleanup the code from #120976 that does lookup of the original async Main
Remove code:

#if defined(TARGET_BROWSER)
// WASM-TODO: this validation is too trivial, but that's OK for now because we plan to remove browser specific hack later.
// https://github.com/dotnet/runtime/issues/121064
if (nReturnType == ELEMENT_TYPE_GENERICINST)
{
if (nParamCount > 1)
ThrowMainMethodException(pFD, IDS_EE_TO_MANY_ARGUMENTS_IN_MAIN);
// this is Task<int> Main(String[] args)
*pType = EntryManagedMainAsync;
return;
}
if (nReturnType == ELEMENT_TYPE_CLASS)
{
if (nParamCount > 1)
ThrowMainMethodException(pFD, IDS_EE_TO_MANY_ARGUMENTS_IN_MAIN);
// this is Task Main(String[] args)
*pType = EntryManagedMainAsyncVoid;
return;
}
#endif // TARGET_BROWSER

// WASM-TODO: remove this
// https://github.com/dotnet/runtime/issues/121064
#if defined(TARGET_BROWSER)
else if (pParam->EntryType == EntryManagedMainAsync)
{
*pParam->piRetVal = 0;
MethodDescCallSite mainWrapper(METHOD__ASYNC_HELPERS__HANDLE_ASYNC_ENTRYPOINT);
OBJECTREF exitCodeTask = threadStart.Call_RetOBJECTREF(&stackVar);
ARG_SLOT stackVarWrapper[] =
{
ObjToArgSlot(exitCodeTask)
};
mainWrapper.Call(stackVarWrapper);
}
else if (pParam->EntryType == EntryManagedMainAsyncVoid)
{
*pParam->piRetVal = 0;
MethodDescCallSite mainWrapper(METHOD__ASYNC_HELPERS__HANDLE_ASYNC_ENTRYPOINT_VOID);
OBJECTREF exitCodeTask = threadStart.Call_RetOBJECTREF(&stackVar);
ARG_SLOT stackVarWrapper[] =
{
ObjToArgSlot(exitCodeTask)
};
mainWrapper.Call(stackVarWrapper);
}
#endif // TARGET_BROWSER

Depends on #121046
Depends on dotnet/roslyn#80873

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions