#Hey, Generating bindings is broken in my

1 messages ยท Page 1 of 1 (latest)

hasty steppe
#

We're looking into this

vital crane
#

Just saw the signature sorry

vague whale
#

Hey, thanks for the response ๐Ÿ™‚

#

Yea it is the same just without ILogger

#

I am fixing it manually in the meantime ๐Ÿ˜

#

but it happends every time I generate bindings, also - from the moment it started to happen I cant push my module with the deploy window - it says its above 10mb
but the weird thing is I can push it manually through CLI (the ccm file size is not really 10mb)

#

Something is wrong with the Cloud Code Module Reference File in the Unity Project maybe?
The module works perfectly fine.

vital crane
vague whale
#

Is this bug related to the module not deploying correctly?

#

Right now I have to publish-zip-copy-cli with every change

vital crane
#

I believe those two issues are not related

#

I want to work on a repro on the first issue, for that I'd like to see the dependency injection setup you have

vital crane
vague whale
#

Sure, just a clerification regarding sharing my code base, who can view this thread? besides the three of us?

vital crane
#

Let me get back to you on this

vague whale
#

As far as I can tell, its everyone ๐Ÿ˜… I can see other threads here

#

I will censor my stuff manually

#
public class ModuleConfig : ICloudCodeSetup
{
    public void Setup(ICloudCodeConfig config)
    {
        config.Dependencies.AddSingleton(GameApiClient.Create());
        config.Dependencies.AddSingleton<IPushClient>(PushClient.Create());
        config.Dependencies.AddSingleton<IAccountService, AccountService>();
        config.Dependencies.AddSingleton<IRewardsService, RewardsService>();
        config.Dependencies.AddSingleton<IInventoryService, InventoryService>();
        config.Dependencies.AddSingleton<IStoreService, StoreService>();
    }
}
#

using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Server.Accounts;
using Unity.Services.CloudCode.Core;

namespace Server.Games;

public class GameController
{
    [CloudCodeFunction("ClearStageRpc")]
    public async Task ClearStageRpc(IExecutionContext ctx, string playerId, ILogger<GameController> logger, IAccountService accountService)
    {
        logger.LogInformation("Player '${playerId}' clear stage Rpc Recieved.", playerId);
        await accountService.HandleClearStageAsync(ctx, playerId);
    }
}


#

I guess this is what you need.

vital crane
#

Thanks! at some point if you are uncomfortable sharing code, we can use DMs

vague whale
#

Sure, thanks

vital crane
vague whale
#

It does work

#

But The docs says its OK to DI through the methods

#

Why with other Unity classes or my own classes the DI works correctly in the method param?

vital crane
#

well they are registered in a different way, without you having to explicitly register the singleton in the setup function, I guess this special case isn't handled well in our code analysis, so it's a bug on our side. I'm filing it, we will fix it asap.
In the mean time, please avoid using the ILogger as injected dep in the method.

vague whale
#

Thanks for the update!
Is there a recommended DI method between the two? (method or constructor)

#

For the rest of the dependencies ofc

vague whale
#

And more importantly - how can I fix not being able to upload the module no more?

vital crane
#

Hey Arg4z, I would go with the constructor, simply because in case the logger is not a singleton it will avoid the reinstantiation at every function call.

#

Do you happen to have a link to the doc we offer where we advise to do DI directly in the method? Couldn't find it ๐Ÿฅฒ

vague whale
vital crane
livid timber
#

Hi @vague whale,

I'm looking into why the CLI and Editor would generate different sized .ccm files

I cant push my module with the deploy window - it says its above 10mb

I have a few questions for you:

  1. What version of the CLI are you using?
  2. What version of the Cloud Code package are you using in your project?
  3. Is it possible that your Cloud Code C# project legitimately contains a lot of code/dependencies?
vague whale
#

Hi ๐Ÿ™‚

  1. CLI Version 1.4.0

  2. Cloud Code Version 2.6.2, Deployment Package Version 1.3.0

  3. No, the project is quite new and small but
    Something Interesting I can say regarding the issue:
    I had two projects in the solution - main one, and a DTO library.
    It worked fine.

When I tried adding a test project (third one) it started to happen.
I even tried removing this project or start over completely (new solution, same name) and it does not work anymore.
CLI works fine.

#

CLI final size - 2.14 MB

livid timber
#

So using deploy with the CLI you get a .ccm file that's 2.14 MB?
Could you let me know with the Deployment Window how much the .ccm file ends up being?

You can run this to get the path where the .ccm file lives easily: Debug.Log($"{Path.GetTempPath()}/{your_solution_name}");

Note that you'll need to Deploy from the Deployment Window beforehand

vague whale
#

So using deploy with the CLI you get a .ccm file that's 2.14 MB`
Yes

#

I found it, It is 12.5 MB in size.

#

(the deployment tool generated one)

livid timber
#

Hi @vague whale,
To help me reproduce the bug, would you be willing to share your Cloud Code C# solution in DMs or over to yoan.bernatchez@unity3d.com?

It would be used solely to reproduce the bug, and discarded right after

There's another person also reporting a similar issue, so no pressure if you don't want to share it (just testing my luck) ๐Ÿ™‚

vague whale
#

For debugging purposes I am OK with sharing it, will DM you soon.

livid timber
#

Hi @vague whale,

I have a temporary solution that might work for you (for the 10mb+ problem) before we come up with an official guidance

Can you try disabling your Tests project in your 'Release' build configuration (in your IDE) and let me know if that helps?

vague whale
#

I have my own release build (I am using rider)

Should I create a new one named Release?

livid timber
#

I did some research and the way that the deploy works at the moment is that it uses the 'Release' configuration by default

This means if you have two configurations initially 'Debug' and 'Production', you'll have to add a third one 'Release' with your Test project deactivated

Let me know if that helps

https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/8.0/dotnet-publish-config

#

Although there's probably a solution configuration file somewhere where a specific configuration can be set to be used by default for publishing - looking into it

livid timber