Skip to content
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

AsyncRewriter - Null conditional extension method call in async method breaks build #87

Open
samcook opened this issue Apr 19, 2018 · 0 comments

Comments

@samcook
Copy link
Collaborator

samcook commented Apr 19, 2018

A null conditional extension method call in an async method breaks the build of a project that uses AsyncRewriter (even if the class or method isn't attributed for rewriting).

namespace CrashTestDummy
{
	public class TestObject
	{
		public List<string> ChildObjects { get; }
	}

	public partial class TestClass
	{
		public async Task<string> GetDataAsync(TestObject obj)
		{
			var firstChild = obj.ChildObjects?.FirstOrDefault(); // null conditional extension method call in async method breaks build
			//var firstChild = obj.ChildObjects?.Find(x => true); // non extension method is fine
			return firstChild;
		}
	}
}

Results in this output at detailed level:

1>Target "GenerateAsyncSource" in file "c:\users\sam\documents\visual studio 2017\Projects\CrashTestDummy\packages\Shaolinq.AsyncRewriter.1.5.0.1286\build\Shaolinq.AsyncRewriter.targets" from project "c:\users\sam\documents\visual studio 2017\Projects\CrashTestDummy\CrashTestDummy\CrashTestDummy.csproj" (target "CoreResGen" depends on it):
1>Building target "GenerateAsyncSource" completely.
1>Input file "TestClass.cs" is newer than output file "obj\\Debug\GeneratedAsync.cs".
1>Using "AsyncRewriterTask" task from assembly "c:\users\sam\documents\visual studio 2017\Projects\CrashTestDummy\packages\Shaolinq.AsyncRewriter.1.5.0.1286\build\..\tools\Shaolinq.AsyncRewriter.exe".
1>Task "AsyncRewriterTask"
1>Done executing task "AsyncRewriterTask" -- FAILED.
1>Done building target "GenerateAsyncSource" in project "CrashTestDummy.csproj" -- FAILED.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant