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

WinUI 3 supports? #38

Open
lunelake opened this issue Jun 6, 2022 · 98 comments
Open

WinUI 3 supports? #38

lunelake opened this issue Jun 6, 2022 · 98 comments

Comments

@lunelake
Copy link

lunelake commented Jun 6, 2022

Vungle SDK doesn't seem to support WinUI 3.0 yet. Will you support it in the future?

@gregthatcher
Copy link

Yes, we are currently trying to make our SDK compatible with WinUI 3. Would you be interesting in helping us beta test this in the coming months. If so, can you give us more details about how you are using WinUI 3? e.g. are you using C++ or C#, and are you targeting desktop and/or UWP?

@lunelake
Copy link
Author

lunelake commented Jun 8, 2022

Yes, I would like to participate in the beta test!
I'm converting my app from UWP to desktop with WinUI 3 and developing using C#.

@gregthatcher
Copy link

Thanks much for volunteering to Beta test. We are some weeks away from our first MVP, but I'll let you know when we have something ready,

@lunelake
Copy link
Author

Thanks! I'll wait for it.

@Qws
Copy link

Qws commented Aug 31, 2022

MAUI is powered by WinUI3, I hope it will also work for MAUI?

@gregthatcher
Copy link

@Qws , thanks for bringing this to our attention. Yes, our goal is to make the new SDK work with .Net 6, Xamarin, and (now that you've brought it to our attention), Maui.

Would you also be interested in being a beta tester for us? We are still some weeks away from a Beta (hopefully October), but are trying to give development priority to development environments that we have beta testers for. If "yes", we will prioritize Maui over Xamarin.

@Qws
Copy link

Qws commented Sep 3, 2022

Yes, I'm interested in beta testing Vungle for MAUI (Windows and Android).

@gregthatcher
Copy link

@lunelake can you confirm (or deny) that you are using .Net 6 for your WinUI app, and not some older version (e.g. .Net Core 3.1)?

@lunelake
Copy link
Author

Sure, I'm using .Net 6 with WinUI.

@gregthatcher
Copy link

@lunelake , are you also using Maui?

@lunelake
Copy link
Author

lunelake commented Oct 4, 2022

@gregthatcher I mainly use WinUI, but I can also help with testing in MAUI.

@atecey
Copy link

atecey commented Oct 18, 2022

How can I sign up to test WinUI3 .Net 6? Not using Maui

@gregthatcher
Copy link

Hi @atecey , I have added you to our list of Beta testers -- thanks very much. Unfortunately, we're running a big behind on our development, but we're hoping to have something for beta test at the end of November or early December.

@lunelake
Copy link
Author

lunelake commented Mar 1, 2023

@gregthatcher Hello, Is there any update for this?

@gregthatcher
Copy link

@lunelake , unfortunately, this project was delayed for a few months, but we are now back on it, and hope to have a beta soon. Very sorry for the delays.

@peerlessDJ
Copy link

@lunelake,不幸的是,这个项目被推迟了几个月,但我们现在又回来了,希望尽快有一个测试版。非常抱歉延误。

Have any betas for WinUI3 .Net 6

@peerlessDJ
Copy link

Hi @atecey , I have added you to our list of Beta testers -- thanks very much. Unfortunately, we're running a big behind on our development, but we're hoping to have something for beta test at the end of November or early December.

please add me to your list of Beta testers

@gregthatcher
Copy link

I have added you to the list @peerlessDJ . We are still some weeks out from a beta test, but hope to have something for you soon.

@Francis365
Copy link

@gregthatcher , hope to get the release soon, please add me to the list.

@gregthatcher
Copy link

@Francis365 , I have added you to the list. We are nearing alpha, and hope to have a beta soon. I apologize to everyone here for the delays.

@jlyttle1
Copy link

I'm available to help test with MAUI.

@gregthatcher
Copy link

I have added you to the list, @jlyttle1 . We almost have betas for WinUI 3, WinForms, WPF, and UWP ready. Unfortunately, Maui will take a little longer (because of issues with its WebView), but I'll let you know when it's ready.

@nestebe
Copy link

nestebe commented Dec 1, 2023

Hello, I'm also ready for testing the MAUI SDK if you need

@gregthatcher
Copy link

@nestebe , I'm going to try to get a WinUI version up this week.

For anyone here interested in WPF, I have an early Beta SDK here https://vungle2-sdk-dev-scratch.s3.amazonaws.com/windows/7.0/LiftoffSDK.WPF.dll

and a sample app and source here:
https://vungle2-sdk-dev-scratch.s3.amazonaws.com/windows/7.0/Demo+Apps/LiftoffWpfDemoApp.zip

@gregthatcher
Copy link

@lunelake , @atecey , @peerlessDJ , @Francis365 ,

My apologies for all the delays.

I have uploaded an early beta of the SDK and some sample source showing how to use it at https://vungle2-sdk-dev-scratch.s3.amazonaws.com/windows/7.0/Demo+Apps/LiftoffWinUI3DemoApp.zip

Please try it out, and let me know how it works.

For anyone here waiting for Maui, we are having some technical issues which we hope the Maui team will resolve soon, and hope to have this beta ready sometime in the new year.

@Francis365
Copy link

@lunelake , @atecey , @peerlessDJ , @Francis365 ,

My apologies for all the delays.

I have uploaded an early beta of the SDK and some sample source showing how to use it at https://vungle2-sdk-dev-scratch.s3.amazonaws.com/windows/7.0/Demo+Apps/LiftoffWinUI3DemoApp.zip

Please try it out, and let me know how it works.

For anyone here waiting for Maui, we are having some technical issues which we hope the Maui team will resolve soon, and hope to have this beta ready sometime in the new year.

Thanks @gregthatcher , very excited to try this out. Please keep us updated on new versions.

@EdwinVD
Copy link

EdwinVD commented Dec 18, 2023

@gregthatcher Thanks for sharing the SDK for winUI3. I was playing around with the SDK and I noticed only rewarded and Interstitial ads work. Can you add loading XAML Banner example (320 x 50) to the SDK and in the sample?

@lunelake
Copy link
Author

@gregthatcher I've been waiting for a long time, and I'm glad to hear that it's finally out. Thanks for sharing. I also downloaded it and tested it, but as Edwin mentioned above, the Banner ads are not showing. So, I added Interstitial ads from the Vungle site, but they don't appear in the list, so I can't test them. I hope this can be improved later.

@EdwinVD
Copy link

EdwinVD commented Mar 7, 2024

@gregthatcher any new version we can test?

@gregthatcher
Copy link

Hi @EdwinVD , we will be uploading a new version late next week.

@gregthatcher
Copy link

@KGLongWang , please try this version https://vungle2-sdk-dev-scratch.s3.amazonaws.com/windows/7.0/LiftoffSDK.WinUI3.dll

I suspect that you are calling LoadAd right after initialization with no delay. Is this correct? I believe that there was a race condition there which I have now fixed.

@powerpdw
Copy link

Hello,
I tried testing the display of FullScreen ads, but I'm encountering the following error:

Ad has started playing...
Placement : 66b9fc45a54c4126bde7c5fc; Campaign ID : FULLSCREEN-9020769; Creative ID : 64945c752cd22ee67ed80c87; Event Id : 664758ba6c0bb80dd4ab0b1e
The thread 66484 has exited with code 0 (0x0).
12-8월 21:13:17.331 Error M_timer_Tick AD IS BAD -- NO VIDEO OR TPAT EVENTS! Closing. 

12-8월 21:13:17.333 Error M_timer_Tick AD IS BAD -- NO VIDEO OR TPAT EVENTS! Closing. 

Could you help me understand why this is happening?

@gregthatcher
Copy link

@powerpdw , sorry to hear about the problems you are having. We have reproduced this problem also, and are trying to find a fix.

@powerpdw
Copy link

@powerpdw , sorry to hear about the problems you are having. We have reproduced this problem also, and are trying to find a fix.

Thank you for your response. Please let me know once this issue is resolved.

@gregthatcher
Copy link

We're still working on it, @powerpdw. We hope to have a new version soon.

@gregthatcher
Copy link

@powerpdw , I have uploaded a new version at
https://vungle2-sdk-dev-scratch.s3.amazonaws.com/windows/7.0/LiftoffSDK.WinUI3.dll
There is also a demo app at :
https://vungle2-sdk-dev-scratch.s3.amazonaws.com/windows/7.0/Demo+Apps/LiftoffWinUI3DemoApp.zip

We believe we have fixed your issue, but please let us know if you disagree. Very sorry for all of the delays.

@EdwinVD
Copy link

EdwinVD commented Sep 4, 2024

@gregthatcher, I'm testing your new SDK. But notice the follow things:

@gregthatcher
Copy link

@EdwinVD , I see some issues with the way your DEFAULT-5891839 is configured. Is this the placement you are having problems with? I suggest you create a new placement that is not a "Banner" placement, as we don't have much of a supply for banner ads currently, and I see your placement returning "sleep codes" (our servers temporarily do not have ads for you).

@EdwinVD
Copy link

EdwinVD commented Sep 4, 2024

Hey @gregthatcher, I don't use DEFAULT-5891839 - only use reward video "type Rewarded". I removed from my account now. Is this SDK limit for only USA/Canada? Some countries get nothing (black screen) or I only get this
Screenshot 2024-09-04 at 4 41 59 PM

I use you last version from yesterday (sep 3)

@gregthatcher
Copy link

@EdwinVD , can you please get me a Fiddler or Charles trace of your network traffic, so that I can see the traffic to the Vungle servers for one of these black screens?

@powerpdw
Copy link

powerpdw commented Sep 5, 2024

@powerpdw , I have uploaded a new version at https://vungle2-sdk-dev-scratch.s3.amazonaws.com/windows/7.0/LiftoffSDK.WinUI3.dll There is also a demo app at : https://vungle2-sdk-dev-scratch.s3.amazonaws.com/windows/7.0/Demo+Apps/LiftoffWinUI3DemoApp.zip

We believe we have fixed your issue, but please let us know if you disagree. Very sorry for all of the delays.

In the new version, ads are displayed correctly.
However, there is one issue.

Currently, I am using a NavigationView and a custom TitleBar (please refer to the MainWindow() constructor for the custom TitleBar implementation).

When running the attached project and displaying ads, the clickable area for the speaker icon is slightly below the actual icon. Additionally, the close(X) icon does not function, as clicking it does not close the window.

I am attaching the project that is causing the issue. Please take a look.

LiftoffWinUI3DemoApp_WithNavigationView.zip

@EdwinVD
Copy link

EdwinVD commented Sep 5, 2024

@powerpdw , I have uploaded a new version at https://vungle2-sdk-dev-scratch.s3.amazonaws.com/windows/7.0/LiftoffSDK.WinUI3.dll There is also a demo app at : https://vungle2-sdk-dev-scratch.s3.amazonaws.com/windows/7.0/Demo+Apps/LiftoffWinUI3DemoApp.zip
We believe we have fixed your issue, but please let us know if you disagree. Very sorry for all of the delays.

In the new version, ads are displayed correctly. However, there is one issue.

Currently, I am using a NavigationView and a custom TitleBar (please refer to the MainWindow() constructor for the custom TitleBar implementation).

When running the attached project and displaying ads, the clickable area for the speaker icon is slightly below the actual icon. Additionally, the close(X) icon does not function, as clicking it does not close the window.

I am attaching the project that is causing the issue. Please take a look.

LiftoffWinUI3DemoApp_WithNavigationView.zip

Hi @powerpdw,

I got that issue before also did you use this:
AdConfig adConfig = new AdConfig();
adConfig.YOffset = 38;

It will move the Y like 38 px lower (titlebar height).

That should work. ;-)

@powerpdw
Copy link

@powerpdw , I have uploaded a new version at https://vungle2-sdk-dev-scratch.s3.amazonaws.com/windows/7.0/LiftoffSDK.WinUI3.dll There is also a demo app at : https://vungle2-sdk-dev-scratch.s3.amazonaws.com/windows/7.0/Demo+Apps/LiftoffWinUI3DemoApp.zip
We believe we have fixed your issue, but please let us know if you disagree. Very sorry for all of the delays.

In the new version, ads are displayed correctly. However, there is one issue.
Currently, I am using a NavigationView and a custom TitleBar (please refer to the MainWindow() constructor for the custom TitleBar implementation).
When running the attached project and displaying ads, the clickable area for the speaker icon is slightly below the actual icon. Additionally, the close(X) icon does not function, as clicking it does not close the window.
I am attaching the project that is causing the issue. Please take a look.
LiftoffWinUI3DemoApp_WithNavigationView.zip

Hi @powerpdw,

I got that issue before also did you use this: AdConfig adConfig = new AdConfig(); adConfig.YOffset = 38;

It will move the Y like 38 px lower (titlebar height).

That should work. ;-)

I applied it to the code, and it worked perfectly. Thank you for your helpful advice!

@Francis365
Copy link

Hi @gregthatcher,

I’ve been trying to run the LiftoffSDK.WinUI3.dll library in a .NET MAUI WinUI application, but I’ve encountered several issues:

  1. SDK Initialization Issues:
  • The SDK sometimes initializes, but it doesn’t always return all the placements configured on the dashboard (as observed from the initialization callback).
  • Occasionally, the SDK fails to initialize and logs an error.
  1. Ad Loading Issues:
  • When I call LoadAd(), sometimes the ad loads, but other times it fails.
  • Even when an ad successfully loads, it doesn’t play. Instead, I get the following error: "16-Oct 05:07:53.702 Error LoadAd Don't have a placement with that name!". This was for an INTERSTITIAL ad.

I’ve removed my AppId from the attached code. Additionally, I didn’t set the AdConfig.ApiEndpoint—is this necessary for proper functioning?

Could this be a .NET MAUI-specific issue? I assumed the SDK should work as expected in a MAUI WinUI app.

Please take a look at my AdService.cs code and the attached error log for more context. I’d appreciate any guidance on what I might be missing.
Archive.zip

@Francis365
Copy link

Francis365 commented Oct 16, 2024

@gregthatcher I now get a steady sdk initialization and successful call to LoadAd(). But when I call PlayAdAsync(). I get this error:

Warn RequestController_RequestComplete Sleep code for APP_INTERSTITIA_PLACEMENT-4324998; Reason: unknown reason! \ \ 16-Oct 20:14:05.261 Warn PlayAd APP_INTERSTITIA_PLACEMENT-4324998 doesn't have any bundles to play!

Please check the log
play_ad_error_2.txt

@gregthatcher
Copy link

@Francis365 , you don't need to set the AdConfig.ApiEndpoint.

It looks to me like your placement is misconfigured. I can see you have an advanced feature called "in-app" bidding enabled. You should turn this off (or let me know if you want me to turn it off). You will need to wait for 30-60 minutes after making this change. You will also probably want to re-install your app (or delete all of its files), as our SDK will "remember" that the ad request failed, and that it is supposed to wait a while before allowing you to request another ad.

image

We are working on a .net maui implementation, and are a bit surprised that you can get this to work using our WinUI 3 sdk. We would be very interested if you can get this to work on non-Windows platforms.

@Francis365
Copy link

Thanks @gregthatcher , I've disabled the in-app bidding as you said. I cleared the build files and tried again after about an hour, it still responds with "doesn't have any bundles to play!". Maybe I'll have to wait a bit longer.

To get it to work on .net MAUI, I had to get the active Window from App.xaml.cs. then retrieve the PlatformView, which is a WinUI window. I'm yet to confirm if this is the right approach

`
AdService? adService;

// This method is called when a new Window is created
protected override Window CreateWindow(IActivationState activationState)
{
    var window = base.CreateWindow(activationState);


    // Window is available here, you can initialize or subscribe to events
    OnWindowCreated(window);

    return window;
}

// Custom method that handles the window creation event
private void OnWindowCreated(Window window)
{
    // Access the window object and perform actions here
    Console.WriteLine("Window has been created!");

    // Example: Hook into lifecycle events
    window.Activated += OnWindowActivated;
    window.Deactivated += OnWindowDeactivated;
}

// Example event handlers for window lifecycle events
private void OnWindowActivated(object sender, EventArgs e)
{
    if (adService != null)
    {
        return;
    }

    Console.WriteLine("Window is activated");

    // Cast the sender to MAUI Window and get the platform-specific window
    var mauiWindow = sender as Window;

    adService = ServiceProvider.GetService<AdService>();
    adService.ShowAdOnStartIfNeeded(mauiWindow);
}

private void OnWindowDeactivated(object sender, EventArgs e)
{
    Console.WriteLine("Window is deactivated");
}

`

@Francis365
Copy link

Francis365 commented Oct 17, 2024

Hi @gregthatcher

I made some adjustments to the placement, I now get this:

`17-Oct 21:13:31.098 Warn CheckForPendingRequests https://adx.ads.vungle.com/api/v5/ads in pending list

17-Oct 21:13:31.120 Info SendRequest Sending request https://adx.ads.vungle.com/api/v5/ads

True
17-Oct 21:13:33.623 Info SendRequest Reading response from https://adx.ads.vungle.com/api/v5/ads

17-Oct 21:13:33.636 Info SendRequest Done reading response from https://adx.ads.vungle.com/api/v5/ads

17-Oct 21:13:33.647 Warn GetTimeStampDelivered timestamp_delivered was missing from /ads response. Will set it from SDK.

17-Oct 21:13:33.668 Warn CheckForPendingRequests https://cdn-lb.vungle.com/zen/44a51527c6e2a0759dd3d5f69171bc90-960x540-h264-Q2.mp4 in pending list

17-Oct 21:13:33.671 Warn CheckForPendingRequests https://cdn-lb.vungle.com/assets/5f9336eb0dd79600174cb014/icon.png in pending list

17-Oct 21:13:33.674 Warn CheckForPendingRequests https://fonts.gstatic.com/s/opensans/v13/cJZKeOuBrn4kERxqtaUH3SZ2oysoEQEeKwjgmXLRnTc.ttf in pending list

17-Oct 21:13:33.678 Warn CheckForPendingRequests https://cdn-lb.vungle.com/templates/defaults/img/4.5-stars.svg in pending list

17-Oct 21:13:33.686 Warn CheckForPendingRequests https://cdn-lb.vungle.com/templates/a0820b3b3f83ee07ccf367c1e7466a40.zip in pending list

17-Oct 21:13:33.692 Info SendRequest Sending request https://cdn-lb.vungle.com/zen/44a51527c6e2a0759dd3d5f69171bc90-960x540-h264-Q2.mp4

17-Oct 21:13:36.369 Info SendRequest Reading response from https://cdn-lb.vungle.com/zen/44a51527c6e2a0759dd3d5f69171bc90-960x540-h264-Q2.mp4

17-Oct 21:13:36.379 Info WriteHttpResponseToFile Downloading 44a51527c6e2a0759dd3d5f69171bc90-960x540-h264-Q2.mp4 to APP_INTERSTITIA_PLACEMENT-4324998_1

17-Oct 21:13:36.383 Error WriteHttpResponseToFile Can't write response to file because we don't have CreativesFolder.

17-Oct 21:13:36.394 Error SendRequest Exception System.NullReferenceException: Object reference not set to an instance of an object.
at LiftoffSDK.Controllers.RequestController.SendRequest(RequestBase request)

17-Oct 21:13:36.398 Info SendRequest Sending request https://cdn-lb.vungle.com/assets/5f9336eb0dd79600174cb014/icon.png

17-Oct 21:13:37.097 Info SendRequest Reading response from https://cdn-lb.vungle.com/assets/5f9336eb0dd79600174cb014/icon.png

17-Oct 21:13:37.102 Info WriteHttpResponseToFile Downloading icon.png to APP_INTERSTITIA_PLACEMENT-4324998_1

17-Oct 21:13:37.112 Error WriteHttpResponseToFile Can't write response to file because we don't have CreativesFolder.
17-Oct 21:13:37.125 Error SendRequest Exception System.NullReferenceException: Object reference not set to an instance of an object.
at LiftoffSDK.Controllers.RequestController.SendRequest(RequestBase request)

17-Oct 21:13:37.131 Info SendRequest Sending request https://fonts.gstatic.com/s/opensans/v13/cJZKeOuBrn4kERxqtaUH3SZ2oysoEQEeKwjgmXLRnTc.ttf

17-Oct 21:13:37.813 Info SendRequest Reading response from https://fonts.gstatic.com/s/opensans/v13/cJZKeOuBrn4kERxqtaUH3SZ2oysoEQEeKwjgmXLRnTc.ttf

17-Oct 21:13:37.823 Info WriteHttpResponseToFile Downloading cJZKeOuBrn4kERxqtaUH3SZ2oysoEQEeKwjgmXLRnTc.ttf to APP_INTERSTITIA_PLACEMENT-4324998_1

17-Oct 21:13:37.830 Error WriteHttpResponseToFile Can't write response to file because we don't have CreativesFolder.

17-Oct 21:13:37.838 Error SendRequest Exception System.NullReferenceException: Object reference not set to an instance of an object.
at LiftoffSDK.Controllers.RequestController.SendRequest(RequestBase request)

17-Oct 21:13:37.844 Info SendRequest Sending request https://cdn-lb.vungle.com/templates/defaults/img/4.5-stars.svg
GPUpdate.exe (5852): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.0-rc.2.24473.5\System.Net.Quic.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
17-Oct 21:13:38.020 Info SendRequest Reading response from https://cdn-lb.vungle.com/templates/defaults/img/4.5-stars.svg

17-Oct 21:13:38.025 Info WriteHttpResponseToFile Downloading 4.5-stars.svg to APP_INTERSTITIA_PLACEMENT-4324998_1

17-Oct 21:13:38.027 Error WriteHttpResponseToFile Can't write response to file because we don't have CreativesFolder.

17-Oct 21:13:38.031 Error SendRequest Exception System.NullReferenceException: Object reference not set to an instance of an object.
at LiftoffSDK.Controllers.RequestController.SendRequest(RequestBase request)

17-Oct 21:13:38.037 Info SendRequest Sending request https://cdn-lb.vungle.com/templates/a0820b3b3f83ee07ccf367c1e7466a40.zip

17-Oct 21:13:38.218 Info SendRequest Reading response from https://cdn-lb.vungle.com/templates/a0820b3b3f83ee07ccf367c1e7466a40.zip

17-Oct 21:13:38.224 Info WriteHttpResponseToFile Downloading a0820b3b3f83ee07ccf367c1e7466a40.zip to APP_INTERSTITIA_PLACEMENT-4324998_1

17-Oct 21:13:38.229 Error WriteHttpResponseToFile Can't write response to file because we don't have CreativesFolder.

17-Oct 21:13:38.234 Error SendRequest Exception System.NullReferenceException: Object reference not set to an instance of an object.
at LiftoffSDK.Controllers.RequestController.SendRequest(RequestBase request)`

I have this in Package.appxmanifest:
<Capabilities> <rescap:Capability Name="runFullTrust" /> <Capability Name="internetClient" /> </Capabilities>

Looks like the ad was downloaded, but wasn't able to save the downloaded files to local

@gregthatcher
Copy link

@Francis365 ,

I believe the problem is that the WinUI 3 SDK does not have a way to create a folder.
Specifically, it is using a call like this ApplicationData.Current.LocalFolder.CreateFolderAsync("folderName", CreationCollisionOption.OpenIfExists), and I believe this call is failing on your Maui setup.

I suspect that things might work better for you if you tried one of our other SDKs.

You can download our WinForms sdk here https://vungle2-sdk-dev-scratch.s3.us-east-1.amazonaws.com/windows/7.0/LiftoffSDK.WinForms.dll
(Note that we also have a legacy, .net 4.6.2 sdk, but I suspect that isn't what you want).

You can download a sample app here : https://vungle2-sdk-dev-scratch.s3.us-east-1.amazonaws.com/windows/7.0/Demo+Apps/LiftoffWinFormsDempApp.zip

@Francis365
Copy link

Thanks @gregthatcher ,

I've updated my project with the WinForms SDK, it looks like it isn't compatible with my project, I got an error after calling "InitializeAsync()" from the sdk.

29-Oct 08:54:37.382 Error InitializeAsync Exception System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Web.WebView2.WinForms, Version=1.0.2739.15, Culture=neutral, PublicKeyToken=2a8ab48044d2601e'. The system cannot find the file specified.
File name: 'Microsoft.Web.WebView2.WinForms, Version=1.0.2739.15, Culture=neutral, PublicKeyToken=2a8ab48044d2601e'
at LiftoffSDK.Models.DeviceModels.DeviceInfo..ctor()
at LiftoffSDK.Controllers.DeviceInfoController..ctor() in C:\source\windows-sdk-dev-clone\LiftoffSDK\SDKs\LiftoffSDK\Controllers\DeviceInfoController.cs:line 21
at LiftoffSDK.CrossCuttingConcerns.AbstractFactories.VungleSdkConcreteFactory.CreateDeviceInfoController() in C:\source\windows-sdk-dev-clone\LiftoffSDK\SDKs\LiftoffSDK\CrossCuttingConcerns\AbstractFactories\VungleSdkConcreteFactory.cs:line 34
at LiftoffSDK.CrossCuttingConcerns.InstanceManager..ctor(String nameSpace, IVungleSdkAbstractFactory abstractFactory) in C:\source\windows-sdk-dev-clone\LiftoffSDK\SDKs\LiftoffSDK\CrossCuttingConcerns\InstanceManager.cs:line 68
at LiftoffSDK.Public.LiftoffAds.InitializeAsync(String appID, LiftoffSdkConfig config) in C:\source\windows-sdk-dev-clone\LiftoffSDK\SDKs\LiftoffSDK\Public\LiftoffSdk.cs:line 69

29-Oct 08:54:37.492 Error InitializeAsync Exception System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Web.WebView2.WinForms, Version=1.0.2739.15, Culture=neutral, PublicKeyToken=2a8ab48044d2601e'. The system cannot find the file specified.

File name: 'Microsoft.Web.WebView2.WinForms, Version=1.0.2739.15, Culture=neutral, PublicKeyToken=2a8ab48044d2601e'
at LiftoffSDK.Models.DeviceModels.DeviceInfo..ctor()
at LiftoffSDK.Controllers.DeviceInfoController..ctor() in C:\source\windows-sdk-dev-clone\LiftoffSDK\SDKs\LiftoffSDK\Controllers\DeviceInfoController.cs:line 21
at LiftoffSDK.CrossCuttingConcerns.AbstractFactories.VungleSdkConcreteFactory.CreateDeviceInfoController() in C:\source\windows-sdk-dev-clone\LiftoffSDK\SDKs\LiftoffSDK\CrossCuttingConcerns\AbstractFactories\VungleSdkConcreteFactory.cs:line 34
at LiftoffSDK.CrossCuttingConcerns.InstanceManager..ctor(String nameSpace, IVungleSdkAbstractFactory abstractFactory) in C:\source\windows-sdk-dev-clone\LiftoffSDK\SDKs\LiftoffSDK\CrossCuttingConcerns\InstanceManager.cs:line 68
at LiftoffSDK.Public.LiftoffAds.InitializeAsync(String appID, LiftoffSdkConfig config) in C:\source\windows-sdk-dev-clone\LiftoffSDK\SDKs\LiftoffSDK\Public\LiftoffSdk.cs:line 69

Adding this package reference causes a conflict with Maui WebView2
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2849.39" />

I think the Liftoff WinUI sdk would be more suited for MAUI, could it be that this

ApplicationData.Current.LocalFolder.CreateFolderAsync("folderName", CreationCollisionOption.OpenIfExists),

failed because my project is set to run with .net9-preview or maybe just the directory permission issue

@gregthatcher
Copy link

@Francis365 , I believe you are getting this error because your project does not have a "package identity".

I asked Chat GPT about this, and there are some instructions (too long to post here) that you can use to create a package identity.

In case that solution doesn't work for you, can you try the following code in your app:

        string appName = Process.GetCurrentProcess().ProcessName;

        // Access the base Local Application Data folder
        string localAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

        // Combine it to form the Packages path with the app name
        string fullPath = Path.Combine(localAppDataPath, "Packages", appName, "LocalState", "VungleSDK");

        var dirInfo = Directory.CreateDirectory(fullPath);

Then, please confirm that this directory was actually created. If that works, I will try to create an override for you in the SDK that lets you create and use this folder.

@Francis365
Copy link

@gregthatcher It finally worked, but i'm still not sure why it behaved the way it did.
The code you share did create the folder successfully, though didn't resolve the issue.

When I debug the project using vs code, I get this error:

Error WriteHttpResponseToFile Can't write response to file because we don't have CreativesFolder.

But when I publish the app as .msix file "dotnet publish". The ad shows up correctly.

I'm not sure the reason for this, maybe vscode doesn't have permission to create the folder or something else.

Note that I got this error during the sdk initialize call:

Error SetSettingBoolValue Exception System.TypeInitializationException: The type initializer for 'LiftoffSDK.Controllers.PersistentSettingsController' threw an exception.
---> System.InvalidOperationException: Operation is not valid due to the current state of the object.
at WinRT.ExceptionHelpers.g__Throw|38_0(Int32 hr)
at ABI.Windows.Storage.IApplicationDataStaticsMethods.get_Current(IObjectReference _obj)
at Windows.Storage.ApplicationData.get_Current()
at LiftoffSDK.Controllers.PersistentSettingsController..cctor()
--- End of inner exception stack trace ---
at LiftoffSDK.Controllers.PersistentSettingsController.SetSettingBoolValue(String key, Boolean newValue)

System.InvalidOperationException: Operation is not valid due to the current state of the object.
at WinRT.ExceptionHelpers.g__Throw|38_0(Int32 hr)
at ABI.Windows.Storage.IApplicationDataStaticsMethods.get_Current(IObjectReference _obj)
at Windows.Storage.ApplicationData.get_Current()
at LiftoffSDK.Controllers.PersistentSettingsController..cctor()

@Francis365
Copy link

From your last comment, you mentioned my project might not have package identity, just to confirm if this is what you meant:

<Identity Name="63333FrostBit.GPUpdateGPACalculator" Publisher="CN=7AFB8844-B2C5-4F9F-B2A1-B2108068B0C5" Version="2.0.2.0" />

From Package.appxmanifest

@gregthatcher
Copy link

Here is more info on what I meant by "package identity"
https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/package-identity-overview

I don't believe that your app has this, and that this is why the SDK can't create the folder it needs.

If the code I gave above does work for you, then I can try to modify the SDK, and give you a special flag to use that will use this different folder. It appears that your app doesn't have access to the folder created from the "package identity".

@Francis365
Copy link

Francis365 commented Nov 10, 2024

Hi @gregthatcher ,
I've confirmed that I have the package identity in Package.appxmanifest file as Identity tag:

<Identity Name="63333FrostBit.GPUpdateGPACalculator" Publisher="CN=7AFB8844-B2C5-4F9F-B2A1-B2108068B0C5" Version="2.0.2.1" />

Correct me if I'm wrong here.

I ran the code you sent earlier (The folder is created under: ~/AppData/Local/Packages/GPUpdate/LocalState/VungleSDK):

    string appName = Process.GetCurrentProcess().ProcessName;

    // Access the base Local Application Data folder
    string localAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

    // Combine it to form the Packages path with the app name
    string fullPath = Path.Combine(localAppDataPath, "Packages", appName, "LocalState", "VungleSDK");

    var dirInfo = Directory.CreateDirectory(fullPath); 

Then called await LiftoffAds.InitializeAsync().

I still got the error after calling LoadAd();

Error WriteHttpResponseToFile Can't write response to file because we don't have CreativesFolder.

For some reason, building the app this way, the ad works (Release Mode):
dotnet publish ./GPUpdate.csproj -f net9.0-windows10.0.22621.0 -c Release ...
The Creatives folder for Release build is under: "~/AppData/Local/Packages/63333FrostBit.GPUpdateGPACalculator_brppa21vfw7f4/LocalState/VungleSDK/Creatives"

@gregthatcher
Copy link

@Francis365 , I did not expect the code I sent you to fix your problem. I wanted to see if that code worked for you, so that I could try to add a work-around in the SDK for you using that code. Note that the code I sent creates a different directory than what the SDK creates.

Here is the code that the SDK currently uses:
ApplicationData.Current.LocalFolder.CreateFolderAsync("VungleSDK", CreationCollisionOption.OpenIfExists);

If your "package identity" is in fact correctly set up (I believe this requires more than updating your manifest file), then the above code should work.

Can you please try running this code:
ApplicationData.Current.LocalFolder.CreateFolderAsync("VungleSDK", CreationCollisionOption.OpenIfExists);

and see if your package identity setup allows you to create the directory in the correct location?

@Francis365
Copy link

@gregthatcher , I ran the code:

ApplicationData.Current.LocalFolder.CreateFolderAsync("VungleSDK", CreationCollisionOption.OpenIfExists);

I got this error:

Exception has occurred: CLR/System.InvalidOperationException
An exception of type 'System.InvalidOperationException' occurred in System.Private.CoreLib.dll but was not handled in user code: 'Operation is not valid due to the current state of the object.'
at WinRT.ExceptionHelpers.g__Throw|38_0(Int32 hr)
at ABI.Windows.Storage.IApplicationDataStaticsMethods.get_Current(IObjectReference _obj)
at Windows.Storage.ApplicationData.get_Current()
at GPUpdate.src.Services.AdService.d__4.MoveNext() in C:\Users\Francis\Documents\Projects\Maui\GPUpdate-Maui\GPUpdate\src\Services\AdService.cs:line 43
at GPUpdate.src.Services.AdService.d__10.MoveNext() in C:\Users\Francis\Documents\Projects\Maui\GPUpdate-Maui\GPUpdate\src\Services\AdService.cs:line 165
at GPUpdate.App.d__14.MoveNext() in C:\Users\Francis\Documents\Projects\Maui\GPUpdate-Maui\GPUpdate\App.xaml.cs:line 78

The folder wasn't created

@gregthatcher
Copy link

Sorry to hear about that, but I think this means you need to take more steps in setting up your package identity. That is, I don't think you have done all of the steps. I believe the document above says that there are some steps in addition to setting up the package manifest.

@Francis365
Copy link

Thanks for pointing that out. I’ve reviewed the steps again but haven’t found anything I missed yet. I'll let you know if I figure it out.

@powerpdw
Copy link

powerpdw commented Feb 5, 2025

It's been a while since I last contacted you.

I have integrated ads into my app, but I haven't generated any revenue.
To check the issue, I ran a sample program and found the following status:

"Info LoadAd Placement FULLSCREEN-9020769 is sleeping..."

App ID: 6698abd930f0637f5c7d2048
Placement ID: FULLSCREEN-9020769
Could you please check this issue?

Thank you.

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