Skip to content

[browser][wasm] Handle null task exception message #38803

Closed

Description

@kjpou1

Executing the following:

			Task testTask = null;
			await testTask;

Will print the following.

dotnet.js:8653 Uncaught (in promise) System.AggregateException: One or more errors occurred. (Object reference not set to an instance of an object.)
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Test.Client.Main(JSObject output)
   --- End of inner exception stack trace ---

Other times it prints something like the following with a tp callback threw a System.NullReferenceException

dotnet.js:2356 
dotnet.js:2356 Unhandled Exception:
dotnet.js:2356 System.NullReferenceException: Object reference not set to an instance of an object.
dotnet.js:2356    at Test.Client.CloseWebSocket(String closeReason)
dotnet.js:2356    at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__140_1(Object state)
dotnet.js:2356    at System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute()
dotnet.js:2356    at System.Threading.ThreadPoolWorkQueue.Dispatch()
dotnet.js:2356    at System.Threading.ThreadPool.Callback()
dotnet.js:2344 tp callback threw a System.NullReferenceException

Code lines:

https://github.com/dotnet/runtime/blob/master/src/mono/mono/mini/mini-wasm.c#L606-L615

	if (!is_ok (error)) {
		printf ("tp callback failed due to %s\n", mono_error_get_message (error));
		mono_error_cleanup (error);
	}

	if (exc) {
		char *type_name = mono_type_get_full_name (mono_object_class (exc));
		printf ("tp callback threw a %s\n", type_name);
		g_free (type_name);
	}

Activity

  1. changed the title [-][browser][wasm] Handle null task exception [/-] [+][browser][wasm] Handle null task exception message[/+] on Jul 6, 2020
  2. removed
    untriagedNew issue has not been triaged by the area owner
    on Jul 8, 2020
  3. added this to the 5.0.0 milestone on Jul 8, 2020
  4. kg commented on Jul 27, 2020

    @kg
    Contributor

    I've been trying to reproduce this and can't. There must be more to it, like a set of conditions that lead to it happening. Does it need to be running in a browser environment in particular, or in node? Does the await need to happen in an event handler or a threadpool task?

  5. kjpou1 commented on Jul 28, 2020

    @kjpou1
    ContributorAuthor

    The issue may be a little misleading. The issue is basically documenting that the message being displayed is a little weird and probably should be changed from tp to thread pool.

    The system handles the case correctly though.

  6. added a commit that references this issue on Jul 28, 2020
    a3187f1
  7. added a commit that references this issue on Jul 28, 2020
    de7e2b2
  8. added a commit that references this issue on Jul 29, 2020
    cb630c2
  9. added a commit that references this issue on Aug 10, 2020
    720ba1b
  10. ghost locked as resolved and limited conversation to collaborators on Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions