This error shows up when trying to deploy. What causes it and how do I fix it?

Exceeded maximum size of stream ‘ByteCode’: 67658

I assume assembly size to big, this happens when you deploy your project to the device i guess?

1 Like

I am at a bit of a standstill with this. Does anyone have any suggestions on where to find the size of the assembly that is causing this issue?

Doesnt the deployment output in visual studio tell you the size of each assembly?

It does when it is able to deploy, the list doesn’t show up when there is an error. (At least I can’t see find it when there is an error.)
Even then it doesn’t make sense to me. Attached is a screen grab of what is working. mscorlib is 72,560 and TincyCLR.UI is 211,876 which I would think is well above the 65K limit. So it seems to me that I am not looking at the right info.

Try to make Beltscale_2022 smaller a bit. This is not the size we see above.

I think I am figuring it out. I have broken up the main application into multiple visual studio projects and referenced them into the main project.
However, now when I deploy it uploads each of the new projects into the SitCore, one at a time then finally the main application. Maybe it is normal but it doesn’t seem correct as there are other libraries, like the TinyCLR.UI and FT5xx6 libraries that I have customized and added as a project and it doesn’t upload them individually.
The new projects/assemblies are set to Output type: Class Library. I can’t find any other settings difference between my new projects and the other library projects I have added.

The main application is set as the Startup Application.

1 Like

I found the solution to the multiple deployments of each assembly.

For those in the future who might have the same issue:
In Solution Explorer select the Solution at the top and right-click, select Properties. In the Property Page, select Configuration Properties → Configuration. Make sure only the main project is set to Deploy.

1 Like

@Dat_Tran I think I am back moving forward now that I have split things up. In the deploy list, it shows a file size. It appears this is not the value used to determine the maximum assembly size. Where can I find the correct value when determining if I am getting close to the 65K limit? It seems like this would be helpful information to have while working on a large project.

It is not the file size, it is bytecode size. You have to split your assembly. Try to move some static function to a new assembly first.

I have split the application into multiple assemblies and as of the end of last week, I believe it has resolved the main issue. However, I would like to know if there is a place I can look to know if a particular assembly is getting close to the limit so I can address the issue before there becomes a problem.

So based on your last reply where can I find the bytecode size of an assembly?

For now TinyCLR doesn’t support exposing this information yet.

this is a good link to keep in mind Limitations

You can check the actual file size in your “\bin\Debug” folder (and yes the limit is not exact 64kb, i have a dll from 68Kb that still deploys but is on the edge)