Failed to produce diagnostic for expression; please submit a bug report

I got the error and I don’t how can I fix it help please struct MovieDetail: View { var movie: Movie

let screen = UIScreen.main.bounds

@State private var showSeasonPicker = true
@State private var selectedSeason = 0


var body: some View {
    
    ZStack {
        Color.black
            .ignoresSafeArea()
        
        ZStack {
            VStack {
                HStack {
                    Spacer()
                    
                    Button() {
                        // Closing Button
                    }label: {
                        Image(systemName: "xmark.circle")
                            .font(.system(size: 28))
                    }
                    
                }
                .padding(.horizontal, 22)
                
                ScrollView (.vertical, showsIndicators: false){
                    VStack {
                        StandardHomeMovie(movie: movie)
                            .frame(width: screen.width / 2.5)
                        
                        MovieInfoSubheadline(movie: movie)
                        
                        if movie.promotionHeadline != nil {
                            Text(movie.promotionHeadline!)
                                .bold()
                                .font(.headline)
                        }
                        
                        PlayButton(text: "Play", imagename: "play.fill", backgroundColor: .red) {
                            //
                        }
                        
                        
                        CurrentEpisodeInformation(movie: movie)
                        
                        CastInfo(movie: movie)
                        
                        HStack(spacing: 60){
                            SmallVerticalButton(text: "My List", isOnImage: "checkmark", isOffImage: "plus", isOn: true) {
                                //
                            }
                            
                            
                            SmallVerticalButton(text: "Rate", isOnImage: "hand.thumbsup.fill", isOffImage: "hand.thumbsup", isOn: true) {
                                //
                            }
                            
                            
                            SmallVerticalButton(text: "Share", isOnImage: "square.and.arrow.up", isOffImage: "square.and.arrow.up", isOn: true) {
                                //
                            }
                            
                            Spacer()
                        }
                        .padding(.leading, 20)
                        
                        CustomTabSwitcher(tabs: [.episodes, .trailers, .more], movie: movie, showSeasonPicker: $showSeasonPicker, selectedSeason: $selectedSeason)
                    }
                        
                    .padding(.horizontal, 10)
                    
                }
                
                Spacer()
            }
            .foregroundStyle(.white)
            
            if showSeasonPicker {
                Group {
                    Color.black.opacity(0.9)
                    
                    VStack(spacing: 40){
                        Spacer()
                        
                        ForEach(0..<(movie.numberOfSeasons ?? 0)) { season in
                            Button(action: {
                                self.selectedSeason = (season != 0)
                                self.showSeasonPicker = false
                                
                            }, label: {
                                Text("Season: \(season + 1)")
                                    .foregroundStyle(selectedSeason == season + 1 ? .white : .gray)
                                    .bold()
                                    .font(.title2)
                                
                            })
                        }
                        Spacer()
                        
                        Button(action: {
                            self.showSeasonPicker = false
                        }, label: {
                            Image(systemName: "xmark.circle.fill")
                                .foregroundStyle(.white)
                                .font(.system(size: 40))
                                .scaleEffect(x: 1.1)
                        })
                        .padding(.bottom, 30)
                    }
                }
                .ignoresSafeArea()
            }
        }
    }
}

}

#Preview { MovieDetail(movie: exampleMovie2) }

struct MovieInfoSubheadline: View { var movie: Movie

var body: some View {
    HStack(spacing: 20){
        Image(systemName: "hand.thumbsup.fill")
            .foregroundStyle(.white)
        
        
        Text(String(movie.year))
        
        RatingView(rating: movie.rating)
        
        Text(movie.numberOfSeasonsDisplay)
        
        ZStack{
            Text("HD")
                    .foregroundStyle(.white)
                    .font(.system(size: 12))
                    .bold()
        Rectangle()
                .stroke(.gray, lineWidth: 2)
                .frame(width: 30, height: 20)
        
        }
    }
    .foregroundStyle(.gray)
    .padding(.vertical, 6)
}

}

struct RatingView: View {

var rating: String
var body: some View {
    ZStack {
        Rectangle()
            .foregroundStyle(.gray)
        
        Text(rating)
            .foregroundStyle(.white)
            .font(.system(size: 12))
            .bold()
    }
    .frame(width: 50, height: 20)
}

}

struct CastInfo: View { var movie: Movie

var body: some View {
    
    VStack(spacing: 3) {
        HStack {
            Text("Cast: \(movie.cast)")
            
            Spacer()
        }
        
        HStack {
            Text("Creaters: \(movie.creaters)")
            
            Spacer()
        }
    }
    .font(.caption)
    .foregroundStyle(.gray)
    .padding(.vertical, 10)
}

}

struct CurrentEpisodeInformation: View { var movie: Movie

var body: some View {
    Group {
        HStack {
            Text(movie.episodeInfoDisplay)
                .bold()
            Spacer()
        }
        .padding(.vertical, 4)
        
        
        HStack {
            Text(movie.episodeDescriptionDisplay)
                .font(.subheadline)
            
            Spacer()
        }
    }
}

}

Welcome to the forum.

But, if you want anyone to help, please provide a comprehensive code to test.

  • Where is Movie defined ?
  • where is SmallVerticalButton defined ?
  • same for CustomTabSwitcher
  • What is the mainView (ContentView) ?
  • Where exactly do you get the error ?

What is StandardHomeMovie? What is Movie? What is exampleMovie2? What is CustomTabSwitcher? What is SmallVerticalButton? What is PlayButton?

Without this code we can't really help you. I could create a simple struct to cover each of those, but who's to say the issue isn't in one of those?

Failed to produce diagnostic for expression; please submit a bug report
 
 
Q