Coder Social home page Coder Social logo

Comments (17)

evelynwu-msft avatar evelynwu-msft commented on June 4, 2024 2

I believe that this is related to .Net Native reflection. The error is happening because you have an implicit style for the Brainf_ckSharp.Uwp.Controls.Ide.Brainf_ckEditBox type, but the metadata provider isn't resolving the type. For Debug builds, we use a reflection-based metadata provider, but for Release builds we generate a table that is used for the lookup, so that's why this works in Release but not Debug. You should be able to work around this by adding the following property to all of your project files:
<EnableTypeInfoReflection>false</EnableTypeInfoReflection>

from brainf_cksharp.

evelynwu-msft avatar evelynwu-msft commented on June 4, 2024 2

[email protected]

from brainf_cksharp.

Sergio0694 avatar Sergio0694 commented on June 4, 2024

Hey @alwu-msft - just adding some more potentially useful info here as @LanceMcCarthy suggested.
I have another app, Legere, which is exhibiting very similar issues.
It's closed source too, I can add you as a collaborator too if you want.

That app is crashing at startup with .NET Native no matter what configuration I use.

  1. Release

image

  1. Debug with .NET Native

image

This is from an autogenerated file from the XAML compiler, and @MichalStrehovsky said an issue like this was likely due to an SDK bug, see his comment here: microsoft/microsoft-ui-xaml#2545 (comment).

Hope this helps!

from brainf_cksharp.

LanceMcCarthy avatar LanceMcCarthy commented on June 4, 2024

WOW!

Alan, every time I talk to you, I learn something new about how the .NET Native compiler works :)

from brainf_cksharp.

evelynwu-msft avatar evelynwu-msft commented on June 4, 2024

It's just outright avoiding use of .Net Native reflection by the XAML framework; it doesn't do anything to modify the behavior of .Net Native itself. :) I'm checking with one of my co-workers to see if this is a known, wider issue.

from brainf_cksharp.

Sergio0694 avatar Sergio0694 commented on June 4, 2024

@alwu-msft WOW that was super quick, thank you so much! ๐Ÿ˜„

Side note, I also have another app that is crashing both in Debug with .NET Native and in Release, let me see if applying this workaround changes things over there as well, at least in Debug!

from brainf_cksharp.

Sergio0694 avatar Sergio0694 commented on June 4, 2024

@alwu-msft So, I can confirm that fixed the Debug with .NET Native crash in the app! ๐Ÿš€

Potentially related, I have another app that's crashing again in both Release and Debug with .NET Native.
Interestingly enough, that app was already using this workaround you suggested (probably someone from the .NET Native team suggested that to me too a few months back, I forgot I had that in that app to be honest).

  1. Release crash:

image

  1. Debug with .NET Native crash:

image

This one in particular is exactly the same as the one I mentioned in the related GitHub issue: microsoft/microsoft-ui-xaml#2545.

Would you be interested in having a look at this too? I can add you as a collaborator if you'd like ๐Ÿ˜Š

Thanks again!

from brainf_cksharp.

evelynwu-msft avatar evelynwu-msft commented on June 4, 2024

Sure. Just clone the repo, load the solution in VS, and hit F5 to see crash on launch?

from brainf_cksharp.

Sergio0694 avatar Sergio0694 commented on June 4, 2024

@alwu-msft Sent you an invite for https://github.com/Sergio0694/Legere ๐Ÿ‘

And yup, just clone and build + run! You'll need the Multilingual App Toolkit installed to build though!
Other than that it should work right out of the box, no additional setup needed.

from brainf_cksharp.

evelynwu-msft avatar evelynwu-msft commented on June 4, 2024

I can't reproduce your Release crash, although I do get the following exception:

Refit.ApiException: 'Response status code does not indicate success: 401 ().'

 	[Managed to Native Transition]	
>	Refit.dll!Refit.RequestBuilderImplementation.BuildCancellableTaskFuncForMethod.AnonymousMethod__0(System.Net.Http.HttpClient client, System.Threading.CancellationToken ct, object[] paramList) Line 263	C#
 	[Resuming Async Method]	
 	Refit.dll!Refit.RequestBuilderImplementation.BuildCancellableTaskFuncForMethod.AnonymousMethod__0(System.Net.Http.HttpClient client, System.Threading.CancellationToken ct, object[] paramList)	C#
 	[Resuming Async Method]	

followed by a single endlessly spinning progress ring in the app.

As with your other project, it looks like Legere is crashing in Debug builds because one of the referenced libraries (Legere.Markdown) is being compiled with the reflection-based metadata provider, which just doesn't work with .Net Native (but unfortunately, it's not possible for that referenced project to realize that it's going to later be consumed by a project that's using .Net Native).

Moving forward, the simplest workaround is to probably just employ a Directory.Build.props file at least at the .sln level (if not higher in the directory hierarchy) that includes the property <EnableTypeInfoReflection>false</EnableTypeInfoReflection>; that allows you to avoid having to modify every individual project.

from brainf_cksharp.

Sergio0694 avatar Sergio0694 commented on June 4, 2024

Ah, sorry about that! You don't have my access tokens for the various REST services and apparently Unsplash just changed how one of their APIs endpoints worked, so that was causing the crash. I've pushed a quick workaround to master, would you mind fetching the changes (literally just ignored the 401 error it was returning) and trying again?

I did so on my maching and I can confirm I'm still getting this in Release:

image

As for Debug .NET Native, that makes perfect sense now! I have to say that at least, thankfully, that's not really a configuration I'd normally use, I'd either use Debug for quick testing or proper Release with .NET Native for validation before uploading a new package. So personally, I don't mind those issues in Debug .NET Native as much as the Release crash ๐Ÿค”

Thanks again for your time by the way! ๐Ÿ˜„

from brainf_cksharp.

evelynwu-msft avatar evelynwu-msft commented on June 4, 2024

Hi Sergio, sorry for the radio silence; it's been super busy these last couple weeks. I was able to find a little bit of time to take another look at Legere, but I'm not seeing the crash that you were seeing in Release. If you see it again, I'd recommend saving a crash dump and uploading that along with the app symbols and commit hash to a (private; probably don't want everybody to have access to the dump) cloud share; hopefully that will contain enough information to allow for meaningful postmortem debugging.

from brainf_cksharp.

Sergio0694 avatar Sergio0694 commented on June 4, 2024

Hey @alwu-msft - no worries! Thank you again for taking the time to look into this! ๐Ÿ˜„

It's weird that you're not seeing the crash, I'm still getting that in Release for both my apps actually, Legere and Brainf*ck#.
I'll prepare those crash dumps for you, hopefully those will help!

For now I'm just glad I can at least run the app in Debug, and that I don't need .NET Native to create Store packages to upload. As I mentioned, the remote .NET Native build the Store does during certification produces working binaries at least ๐Ÿคทโ€โ™‚๏ธ

from brainf_cksharp.

Sergio0694 avatar Sergio0694 commented on June 4, 2024

Alright I have prepared both dumps, along with the output I'm getting, the commit hashes and all the .pdb files I have.

@alwu-msft I actually plan to make this repo public eventually, so as you mentioned it wouldn't be a good idea to just link the dumps here as they would show up in the comment history - can you share an email/handle I can send the link to? ๐Ÿ˜„

from brainf_cksharp.

evelynwu-msft avatar evelynwu-msft commented on June 4, 2024

Both of those dumps contain exceptions with the message Non รจ stato possibile caricare il file o l'assembly 'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' o una delle relative dipendenze. Impossibile trovare il file specificato.. This doesn't seem related to XAML (which isn't even loaded yet); I'd suggest engaging with the .Net Native team to try to figure out what's going on.

from brainf_cksharp.

Sergio0694 avatar Sergio0694 commented on June 4, 2024

Hey @alwu-msft - thank you again for your time!
I see, well then does seem like some sort of issue either with .NET Native as you said, or with the SDK as Lance and Michal suggested. I've sent the two repros to the .NET Native team and also opened a VS feedback item (here), though unfortunately I've received no replies yet. I'll try to ping the VS issue again, hopefully someone will reach out eventually.

Thanks for your help! ๐Ÿ˜„

from brainf_cksharp.

Sergio0694 avatar Sergio0694 commented on June 4, 2024

Closing this as the issue in Brainfk*ck# was resolved, and I also did manage to fix the other issue separately at some point (can't remember exactly what it was, maybe some weird style thingy that was causing a crash). Thanks everyone for the help! ๐Ÿ˜„

from brainf_cksharp.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.