-
-
Notifications
You must be signed in to change notification settings - Fork 917
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
Repair projectwatcher #2106
Repair projectwatcher #2106
Conversation
ok ive tested it again, the current state works how it is, even when multiple times editing the same project or other projects in addition so only the overall rework should be adjusted |
sources/editor/Stride.Core.Assets.Editor/View/DefaultPropertyTemplateProviders.xaml
Outdated
Show resolved
Hide resolved
sources/editor/Stride.Assets.Presentation/AssetEditors/ProjectWatcher.cs
Outdated
Show resolved
Hide resolved
sources/editor/Stride.Assets.Presentation/AssetEditors/ProjectWatcher.cs
Outdated
Show resolved
Hide resolved
sources/editor/Stride.Assets.Presentation/AssetEditors/ProjectWatcher.cs
Outdated
Show resolved
Hide resolved
sources/editor/Stride.Assets.Presentation/AssetEditors/ProjectWatcher.cs
Outdated
Show resolved
Hide resolved
var waitTask = Task.Run(async () => | ||
{ | ||
while (!condition()) await Task.Delay(frequency); | ||
}); | ||
await waitTask; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why running in another task here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2ca2766
removed it, is this the way it should be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the goal here? To await for an asynchronous event? If so, there are other patterns that can be used instead of an active pull (which this repeated loop is a kind of).
For instance, SemaphoreSlim
or a TaskCompletionSource
could be used instead, depending on the expected usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the goal here is to wait until a list is ready, the delay was introduced as i didnt think it would work without but it does
even without waiting it works as long as it fills up the dictionary and doesnt get blocked by the idispatcher
what i want to do is
- on first change spawn notification ( stride is blocked )
- until the button is pressed sum up the assemblies in the dictionary
- on button click take the dictionary and do the stuff that is allready there
the projectwatcher never completes his task, neither does the debugger complete his task
they run in parallel, mybe semaphore would work but i have no idea how to implement it as i just read quickly over it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok it was easier than i thought with asnyc enumerable
3436b3f
problem is now i dont know what to write in the dispose... there was before a .Wait()... how can i actually stop that thing? or should it be stopped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got help from C# discord, i just have to run a break; to stop it
sources/editor/Stride.GameStudio/ViewModels/DebuggingViewModel.cs
Outdated
Show resolved
Hide resolved
sources/editor/Stride.GameStudio/ViewModels/DebuggingViewModel.cs
Outdated
Show resolved
Hide resolved
im open for any changes to make it a mergeable PR , like kryptos helped |
d13758e ive tried it and roslynpad "works" ... the exact same bug persists in roslynpad, no idea where that is comming from there a reload doesnt trigger the dependent projects to reload my main target was to fix it for the "normal way" |
and i think i fixed by accident that stride didnt reload the types after a failed compilation |
its finished so far and ready |
9e0b23d
to
a93b3b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nitpick but looks good otherwise. Sorry about the delay.
sources/editor/Stride.Assets.Presentation/AssetEditors/ProjectWatcher.cs
Outdated
Show resolved
Hide resolved
no problem, with the nitpick i found a nre , which may be the issue that projects dont reload on reference changes in the csproj |
Looks good, any last comment @Kryptos-FR ? |
fixes #2054 |
fixes #2022 , couldnt reproduce it removed half of the camera controller script , reloaded, added more syntax errors, reloaded again reverted everything, camera controller is there to be added |
there is a bug currently in my version and the current released one, when attaching a syncscript in a sub project then when opening stride it cant find the serializer for that one, dunno if i can track it down but its in both versions probably better to make a separate issue and pr |
ok so i investigated #2125 when this is merged it would lead people into using that feature, then they will run into the next bug i will add the fix for it, but im not too sure about it yet so i will add wip for now |
startup is now also fixed of non root projects so a new review would be needed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will attempt to refactor CodeViewModel
. Its initialization looks a bit clumsy (previous code was even worse).
@@ -139,6 +113,33 @@ void TrackedAssemblies_CollectionChanged(object sender, Core.Collections.Trackin | |||
//SymbolDisplayPartExtensions.StyleRunFromSymbolDisplayPartKind = StyleRunFromSymbolDisplayPartKind; | |||
//SymbolDisplayPartExtensions.StyleRunFromTextTag = StyleRunFromTextTag; | |||
} | |||
private Task ProjectUpdate; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is it used?
}).Wait(); | ||
}), new DataflowLinkOptions()); | ||
|
||
ProjectUpdate = UpdateProjects(projectWatcher, workspace, strideAssetsViewModel); | ||
return workspace; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point, we are returned a workspace that might not be up to date yet (the async loop in UpdateProjects might not have completed yet). It feels very unstable (the previous code was like that as well).
What if instead, we make the whole continuation (from line 64) asynchronous as well so that we ensure that workspaceTask
(and thus the Workspace
property from line 152) only completes when everything is ready?
The code would look like this:
// line 64
workspaceTask = workspaceTask.ContinueWith(async previousTask =>
{
var projectWatcher = await projectWatcherTask;
var workspace = await previousTask;
// code unchanged
// line 103
_ = UpdateProjects(projectWatcher, workspace, strideAssetsViewModel); // fire & forget
return workspace;
}
edit: UpdateProjects is an infinite loop so my previous remark doesn't stand.
[Editor] Refactor initialization of CodeViewModel
is it now fine? |
I'm guessing those last changes come from @Kryptos-FR - no need to ask him to review them. If so, sure, I can merge. Just let me know. |
i will test tomorrow again everything to be sure it works, and then notify you |
its fine, checked again the reloading it can be merged |
* Remove docs, has been moved to Stride docs repo * [OpenXR] Fixes build on graphics APIs other than D3D11 This build regression was introduced by previous commit d72aef5 * Update samples to Stride 4.2 (stride3d#2132) * [Samples] Update to 4.2 * [Samples] Remove Newtonsoft.Json dependency in CSharpIntermediate * [Tests] Fixes random test failures (stride3d#2133) * [Tests] Fixes random test failures Some of the tests in Stride.GameStudio.Tests must not run in parallel as they access a shared class which is not thread safe. * Sets wait time in TestFileVersionManager to 500ms (from 200) Should make it less likely that unit tests on teamcity fail. * Repair projectwatcher (stride3d#2106) * use positive 77 * repair projectwatcher * remove unused line * undo -77 change * undo -77 * order usings * fix formatting * remove unused solution * remove unused async * use previous cancelation method * remove extra task * add check to not throw assembly changes away * rework distribution of assemblychanges * remove unused using * add broadcast back in * remove assembly broadcast * add cancelation * replace cancelation location * improve if nesting * improve naming, fix reload on new references * fix loading chain of assets * refactor * [Editor] Refactor initialization of CodeViewModel --------- Co-authored-by: IXLLEGACYIXL <ixllegacy123@outlook.com> Co-authored-by: Nicolas Musset <musset.nicolas@gmail.com> * [OpenVR] Adds a minimal API to request and control Passthrough (supported by OpenXR) https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#XR_FB_passthrough * [OpenXR] Makes device construction internal and improves exception messages of new StartPassthrough method * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] * [Assets] Prevent crash of the assets compiler when an assembly cannot be fully loaded. (stride3d#2144) Fixes stride3d#2140 * [Build] Remove stylecop (stride3d#2105) Co-authored-by: IXLLEGACYIXL <ixllegacy123@outlook.com> * [Presentation] Rework AssetViewModelAttribute * [Editor] Cleanup * [Assets] Mark Editor as obsolete on AssetViewModel * [Editor] Make Asset property public on all editors * [Editor] Make IAssetEditorsManager a service * [Editor] Keep track of asset/editor association in AssetEditorsManager * [Editor] Add a method to find an opened editor * [Editor] Change binding logic in editor views The default DataContext is now the editor instead of the asset * [Editor] Update sprite editor bindings * [Editor] Update UI editor bindings * [Editor] Update entity hierarchy editor bindings * [Editor] Update script editor bindings * [Editor] Update graphics compositor editor bindings * [Editor] Removed pointless constraint on column width Which is also spamming the console with binding errors. * [Editor] Remove editor-related properties from AssetViewModel * [Editor] Rework AssetEditorViewModelAttribute - add AssetEditorViewAttribute - rework view creation and initialization * [Editor] Make AssetEditorViewModel.Asset property virtual C# has covariant return types since version 9 * [Editor] Rework plugins initialization * [Editor] Rework AssetPreviewViewModelAttribute & AssetPreviewAttribute - add AssetPreviewViewAttribute to break the dependency between a preview and its UI-dependent view * [Editor] Fix initialization of SpriteSheetEditorViewModel returning false * [Editor] Make Stride.Core.Presentation.Quantum cross-platform * [Editor] Make Stride.Core.Assets.Quantum cross-platform * [Editor] Do not load StrideDefaultAssetsPlugin from module. It currently hardcodes loading the templates from a package which causes some tests to fail. Partially reverts c98c72e * feat: Release.yml added for PR categorisation (stride3d#2137) * feat: Release.yml added for PR categorisation * Categories updated * [Editor] Fix scene editor loading screen * [VR] feat: Add haptic support to OpenVR and Oculus runtimes (stride3d#2169) Co-authored-by: Eideren <contact@eideren.com> * [Audio] Audio emitter multiple references to same asset bugfix (stride3d#2176) Co-authored-by: Eideren <contact@eideren.com> * Use correct destination path in asset import overwrite dialog * Use GetFullPath to correct directory seperator for display * fix: File GraphicsResourceMap.cs without references removed (stride3d#2181) * feat: Update samples/template to top-level statements (stride3d#2187) * Update README.md (prerequisites) * Update README.md (VSIX prerequisites) * [VSPackage] Revert a few package upgrades so that VSIX builds properly * [Presentation] Fix issue with binding quantum nodes when associated name is not found (stride3d#2195) Note: the solution is rather hackish at the moment. To be revisited once we have an Avalonia version. Should we then introduce a service for setting/retrieving the Unset value * fix: [Asset] Unified 3D asset importer (on behalf of Noa7/Noah7071) (stride3d#2163) Co-authored-by: noa7 <noahwdv@gmail.com> Co-authored-by: noa7707 <157441788+noa7707@users.noreply.github.com> Co-authored-by: Noah7071 <157886157+Noah7071@users.noreply.github.com> --------- Co-authored-by: JornosDesktop <aggror.jorn@gmail.com> Co-authored-by: Elias Holzer <elias@vvvv.org> Co-authored-by: Nicolas Musset <nicolas@color-rise.xyz> Co-authored-by: IXLLEGACYIXL <107197024+IXLLEGACYIXL@users.noreply.github.com> Co-authored-by: IXLLEGACYIXL <ixllegacy123@outlook.com> Co-authored-by: Nicolas Musset <musset.nicolas@gmail.com> Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> Co-authored-by: Jorn Theunissen <aggror.jorn@stride3d.net> Co-authored-by: Marian Dziubiak <marian.dziubiak@gmail.com> Co-authored-by: Vaclav Elias <vaclavelias@gmail.com> Co-authored-by: Addison Schmidt <addison@assurancefamily.com> Co-authored-by: Eideren <contact@eideren.com> Co-authored-by: Tim Conner <tim@timconner.com> Co-authored-by: Jakub Ławreszuk <31008367+Jklawreszuk@users.noreply.github.com> Co-authored-by: xen2 <virgile@stride3d.net> Co-authored-by: noa7 <noahwdv@gmail.com> Co-authored-by: noa7707 <157441788+noa7707@users.noreply.github.com> Co-authored-by: Noah7071 <157886157+Noah7071@users.noreply.github.com>
PR Details
Repairs Projectwatcher to behave correctly on reload
Description
The Problem is when you have Project A#1 references Project B#1, now you edit B#1 , B#1 gets reloaded and becomes B#2 but A#1 is dependent on it, A#1 has STILL B#1 types so the stamp of the roslyn workspace doesnt fit as #1 != #2 so the reference serializers die as the type dictionary is searched for it but type(BClass#1) isnt in the dictionary of registered serialziers, it has type(BClass#2) in it.
Now the proplem is in the ProjectWatcher
First i changed the workspace to use solution as we need the dependency tree of the solution,
Then find all dependents on the project and sum them up in the list for the broadcast
Now lets send the list through the broadcast with the 2 projects A#2 and B#2
The only receiver is the debugger view model, it waits for events incomming
Now the problem with the debugger view model
so B#2 and A#2 are getting sent through the broadcast, B#2 gets sent to the debugger view model, now it blcoks everything and waits for reload... now you press reload and you reload B#2... but what about A#2 ? its still in the queue
thats why i just wait until the project watcher sets the list of changes as public property and empty it then
this way A#2 and B#2 get reloaded when pressed
Problem with my solution:
Related Issue
fixes #2081
and partially #2107
fixes #2125
fixes #2022
fixes #2054
fixes #2123 ( cant reproduce it )
Now what
I think the broadcasting is useless now?
I dont have much exp with async and await and how to manage this situation.
![grafik](https://private-user-images.githubusercontent.com/107197024/296605980-873ac9fc-f548-489c-96ca-01bfbb35fe81.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2MjQzNjgsIm5iZiI6MTcxOTYyNDA2OCwicGF0aCI6Ii8xMDcxOTcwMjQvMjk2NjA1OTgwLTg3M2FjOWZjLWY1NDgtNDg5Yy05NmNhLTAxYmZiYjM1ZmU4MS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjI5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYyOVQwMTIxMDhaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1mOTk1YmU3M2JiMjYxYWRmYzY4YmExNTZkZmM0NjJlNGE1YzE3ZjdjYjU3Y2RjYWVmMWU3NDdmYmZjYThlMzI1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.PaKHr1D8fWmNZXLa_4CV5SM2D4JDh1Eq8r4lD5sX4UM)
All i know is if i edit B then A and B get reloaded
I cant continue here, i would love to see someone else taking over this who has more knowledge about handling this
just ignore the positive 77... had the wrong base branch
Types of changes
Checklist