KirillOsenkov / RoslynQuoter

Roslyn tool that for a given C# program shows syntax tree API calls to construct its syntax tree
http://roslynquoter.azurewebsites.net
Apache License 2.0
918 stars 118 forks source link

"Get Roslyn API calls to generate this code as LINQPad file!" button doesn't work #60

Closed Pzixel closed 3 years ago

Pzixel commented 3 years ago

it just gets redirected to https://roslynquoter.azurewebsites.net/[object%20Object] which is a blank page

bernd5 commented 3 years ago

still the case

KirillOsenkov commented 3 years ago

@InRedikaWB any chance you could take a look into this?

Pzixel commented 3 years ago

I've checked sources, this line doesn't make much sense to me

function onSubmitLINQPad() {
    var arguments = generateQuery();

    arguments.generateLINQPad = true;

    window.location = arguments;
} 

I suppose it should be

function onSubmitLINQPad() {
    var arguments = generateQuery();
    arguments.generateLINQPad = true;
    getUrl(arguments, loadResults);
}
KirillOsenkov commented 3 years ago

OK this is now fixed with https://github.com/KirillOsenkov/RoslynQuoter/commit/90117a07c180f814b3da4d50a1cb882dc644b24c

Pzixel commented 3 years ago

Thanks you fixed it, but it looks like it duplicate an already-present logics, see https://github.com/KirillOsenkov/RoslynQuoter/blob/f3b595a683bda6323c13f407fdde275246fcf9b9/src/Quoter.Web/Controllers/QuoterController.cs#L55 and https://github.com/KirillOsenkov/RoslynQuoter/blob/master/src/Quoter.Web/wwwroot/scripts.js#L23

One of them seems redundant and may be safely removed. I'd expect the fix I proposed to work but if you think another endpoint is required then maybe you could remove this extra logic from the old place

KirillOsenkov commented 3 years ago

Yes, your proposal won't work because you can't cause a file download from an XMLHTTPRequest that is POST. I needed a GET endpoint for the download to work.

You're right about the duplication, I didn't care much but I guess I can remove it.